I’m using Inno Setup to create an installer for my application. Part of the installation process includes installing the Ollama binary and running a couple of commands to set up models. However, the commands do not seem to run as expected. Here is my Inno Setup script:
[Setup]
AppName=Chat2Find
AppVersion=1.0
DefaultDirName={pf}\Chat2Find
DefaultGroupName=Chat2Find
OutputDir=.
OutputBaseFilename=Chat2FindInstaller
Compression=lzma
SolidCompression=yes
DiskSpanning=yes
[Files]
; Include the executable
Source: "C:\Users\presh\c2f\dist\Chat2Find.exe"; DestDir: "{app}"; Flags: ignoreversion
; Include the GGUF files to be extracted to a permanent location
Source: "C:\Users\presh\c2f\dist\Mistral-7B-Instruct-v0.3.Q4_K_M.gguf"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\presh\c2f\dist\Phi-3-mini-4k-instruct-q4.gguf"; DestDir: "{app}"; Flags: ignoreversion
; Include the Ollama setup binary
Source: "C:\Users\presh\c2f\dist\OllamaSetup.exe"; DestDir: "{tmp}"; Flags: ignoreversion deleteafterinstall
; Include other resources
Source: "C:\Users\presh\c2f\dist\menu.png"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\presh\c2f\dist\close.png"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\presh\c2f\dist\new_note.jpg"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\presh\c2f\dist\copy.png"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\presh\c2f\dist\send_icon.png"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\presh\c2f\dist\chat2find.jpeg"; DestDir: "{app}"; Flags: ignoreversion
[Icons]
Name: "{group}\Chat2Find"; Filename: "{app}\Chat2Find.exe"
Name: "{commondesktop}\Chat2Find"; Filename: "{app}\Chat2Find.exe"; Tasks: desktopicon
[Tasks]
Name: "desktopicon"; Description: "Create a &desktop icon"; GroupDescription: "Additional icons:"; Flags: checkedonce
[Run]
Filename: "{app}\Chat2Find.exe"; Description: "Launch Chat2Find"; Flags: nowait postinstall skipifsilent
; Run Ollama setup silently
Filename: "{tmp}\OllamaSetup.exe"; Description: "Install Ollama"; Flags: waituntilterminated
; Run Ollama commands silently using a script
Filename: "cmd.exe"; Parameters: "/C {app}\run_ollama_commands.bat"; Flags: runhidden postinstall
[Code]
procedure CurStepChanged(CurStep: TSetupStep);
var
GGUFDir: String;
MistralDef, Phi3Def, OllamaScript: String;
begin
if CurStep = ssPostInstall then
begin
GGUFDir := ExpandConstant('{app}');
if not DirExists(GGUFDir) then
begin
CreateDir(GGUFDir);
end;
MistralDef := GGUFDir + '\mistral_definition';
SaveStringToFile(MistralDef,
'FROM ' + GGUFDir + '\Mistral-7B-Instruct-v0.3-Q4_K_M.gguf' + #13#10 +
'TEMPLATE """[INST] {{ if .System }}{{ .System }} {{ end }}{{ .Prompt }} [/INST]"""' + #13#10 +
'PARAMETER stop "[INST]"' + #13#10 +
'PARAMETER stop "[/INST]"', False);
Phi3Def := GGUFDir + '\phi3_definition';
SaveStringToFile(Phi3Def,
'FROM ' + GGUFDir + '\Phi-3-mini-4k-instruct-q4.gguf' + #13#10 +
'TEMPLATE """<s>{{ if .Prompt }}' + #13#10 +
'{{ .Prompt }}' + #13#10 +
'{{ end }}' + #13#10 +
'{{ .Response }}"""' + #13#10 +
'PARAMETER stop' + #13#10 +
'PARAMETER stop' + #13#10 +
'PARAMETER stop' + #13#10 +
'PARAMETER num_ctx 4096', False);
OllamaScript := GGUFDir + '\run_ollama_commands.bat';
SaveStringToFile(OllamaScript,
'ollama create C2F_mistral -f "' + MistralDef + '"' + #13#10 +
'ollama create C2F_phi3 -f "' + Phi3Def + '"', False);
end;
end;
Problem:
The commands in run_ollama_commands.bat do not seem to execute as expected. How can I ensure that these commands run silently after the installation of the Ollama binary?
Additional Context:
The OllamaSetup.exe installs the Ollama binary correctly.
I need the models to be created using the GGUF files and templates provided during the installation.
The batch file (run_ollama_commands.bat) should run silently without showing a command prompt window.
Any insights or suggestions on how to correctly execute these post-install commands would be greatly appreciated!