ollama.iss 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. ; Inno Setup Installer for Ollama
  2. ;
  3. ; To build the installer use the build script invoked from the top of the source tree
  4. ;
  5. ; powershell -ExecutionPolicy Bypass -File .\scripts\build_windows.ps
  6. #define MyAppName "Ollama"
  7. #if GetEnv("PKG_VERSION") != ""
  8. #define MyAppVersion GetEnv("PKG_VERSION")
  9. #else
  10. #define MyAppVersion "0.0.0"
  11. #endif
  12. #define MyAppPublisher "Ollama"
  13. #define MyAppURL "https://ollama.com/"
  14. #define MyAppExeName "ollama app.exe"
  15. #define MyIcon ".\assets\app.ico"
  16. [Setup]
  17. ; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
  18. ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
  19. AppId={{44E83376-CE68-45EB-8FC1-393500EB558C}
  20. AppName={#MyAppName}
  21. AppVersion={#MyAppVersion}
  22. VersionInfoVersion={#MyAppVersion}
  23. ;AppVerName={#MyAppName} {#MyAppVersion}
  24. AppPublisher={#MyAppPublisher}
  25. AppPublisherURL={#MyAppURL}
  26. AppSupportURL={#MyAppURL}
  27. AppUpdatesURL={#MyAppURL}
  28. ArchitecturesAllowed=x64compatible arm64
  29. ArchitecturesInstallIn64BitMode=x64compatible arm64
  30. DefaultDirName={localappdata}\Programs\{#MyAppName}
  31. DefaultGroupName={#MyAppName}
  32. DisableProgramGroupPage=yes
  33. PrivilegesRequired=lowest
  34. OutputBaseFilename="OllamaSetup"
  35. SetupIconFile={#MyIcon}
  36. UninstallDisplayIcon={uninstallexe}
  37. Compression=lzma2
  38. SolidCompression=no
  39. WizardStyle=modern
  40. ChangesEnvironment=yes
  41. OutputDir=..\dist\
  42. ; Disable logging once everything's battle tested
  43. ; Filename will be %TEMP%\Setup Log*.txt
  44. SetupLogging=yes
  45. CloseApplications=yes
  46. RestartApplications=no
  47. RestartIfNeededByRun=no
  48. ; https://jrsoftware.org/ishelp/index.php?topic=setup_wizardimagefile
  49. WizardSmallImageFile=.\assets\setup.bmp
  50. ; Ollama requires Windows 10 22H2 or newer for proper unicode rendering
  51. ; TODO: consider setting this to 10.0.19045
  52. MinVersion=10.0.10240
  53. ; First release that supports WinRT UI Composition for win32 apps
  54. ; MinVersion=10.0.17134
  55. ; First release with XAML Islands - possible UI path forward
  56. ; MinVersion=10.0.18362
  57. ; quiet...
  58. DisableDirPage=yes
  59. DisableFinishedPage=yes
  60. DisableReadyMemo=yes
  61. DisableReadyPage=yes
  62. DisableStartupPrompt=yes
  63. DisableWelcomePage=yes
  64. ; TODO - percentage can't be set less than 100, so how to make it shorter?
  65. ; WizardSizePercent=100,80
  66. #if GetEnv("KEY_CONTAINER")
  67. SignTool=MySignTool
  68. SignedUninstaller=yes
  69. #endif
  70. SetupMutex=OllamaSetupMutex
  71. [Languages]
  72. Name: "english"; MessagesFile: "compiler:Default.isl"
  73. [LangOptions]
  74. DialogFontSize=12
  75. [Files]
  76. #if DirExists("..\dist\windows-amd64")
  77. Source: "..\dist\windows-amd64-app.exe"; DestDir: "{app}"; DestName: "{#MyAppExeName}" ;Check: not IsArm64(); Flags: ignoreversion 64bit
  78. Source: "..\dist\windows-amd64\ollama.exe"; DestDir: "{app}"; Check: not IsArm64(); Flags: ignoreversion 64bit
  79. Source: "..\dist\windows-amd64\lib\ollama\*"; DestDir: "{app}\lib\ollama\"; Check: not IsArm64(); Flags: ignoreversion 64bit recursesubdirs
  80. #endif
  81. #if DirExists("..\dist\windows-arm64")
  82. Source: "..\dist\windows-arm64\vc_redist.arm64.exe"; DestDir: "{tmp}"; Check: IsArm64() and vc_redist_needed(); Flags: deleteafterinstall
  83. Source: "..\dist\windows-arm64-app.exe"; DestDir: "{app}"; DestName: "{#MyAppExeName}" ;Check: IsArm64(); Flags: ignoreversion 64bit
  84. Source: "..\dist\windows-arm64\ollama.exe"; DestDir: "{app}"; Check: IsArm64(); Flags: ignoreversion 64bit
  85. #endif
  86. Source: "..\dist\ollama_welcome.ps1"; DestDir: "{app}"; Flags: ignoreversion
  87. Source: ".\assets\app.ico"; DestDir: "{app}"; Flags: ignoreversion
  88. [Icons]
  89. Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\app.ico"
  90. Name: "{userstartup}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\app.ico"
  91. Name: "{userprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\app.ico"
  92. [Run]
  93. #if DirExists("..\dist\windows-arm64")
  94. Filename: "{tmp}\vc_redist.arm64.exe"; Parameters: "/install /passive /norestart"; Check: IsArm64() and vc_redist_needed(); StatusMsg: "Installing VC++ Redistributables..."; Flags: waituntilterminated
  95. #endif
  96. Filename: "{cmd}"; Parameters: "/C set PATH={app};%PATH% & ""{app}\{#MyAppExeName}"""; Flags: postinstall nowait runhidden
  97. [UninstallRun]
  98. ; Filename: "{cmd}"; Parameters: "/C ""taskkill /im ''{#MyAppExeName}'' /f /t"; Flags: runhidden
  99. ; Filename: "{cmd}"; Parameters: "/C ""taskkill /im ollama.exe /f /t"; Flags: runhidden
  100. Filename: "taskkill"; Parameters: "/im ""{#MyAppExeName}"" /f /t"; Flags: runhidden
  101. Filename: "taskkill"; Parameters: "/im ""ollama.exe"" /f /t"; Flags: runhidden
  102. ; HACK! need to give the server and app enough time to exit
  103. ; TODO - convert this to a Pascal code script so it waits until they're no longer running, then completes
  104. Filename: "{cmd}"; Parameters: "/c timeout 5"; Flags: runhidden
  105. [UninstallDelete]
  106. Type: filesandordirs; Name: "{%TEMP}\ollama*"
  107. Type: filesandordirs; Name: "{%LOCALAPPDATA}\Ollama"
  108. Type: filesandordirs; Name: "{%LOCALAPPDATA}\Programs\Ollama"
  109. Type: filesandordirs; Name: "{%USERPROFILE}\.ollama\models"
  110. Type: filesandordirs; Name: "{%USERPROFILE}\.ollama\history"
  111. ; NOTE: if the user has a custom OLLAMA_MODELS it will be preserved
  112. [InstallDelete]
  113. Type: filesandordirs; Name: "{%TEMP}\ollama*"
  114. Type: filesandordirs; Name: "{%LOCALAPPDATA}\Programs\Ollama"
  115. [Messages]
  116. WizardReady=Ollama
  117. ReadyLabel1=%nLet's get you up and running with your own large language models.
  118. SetupAppRunningError=Another Ollama installer is running.%n%nPlease cancel or finish the other installer, then click OK to continue with this install, or Cancel to exit.
  119. ;FinishedHeadingLabel=Run your first model
  120. ;FinishedLabel=%nRun this command in a PowerShell or cmd terminal.%n%n%n ollama run llama3.2
  121. ;ClickFinish=%n
  122. [Registry]
  123. Root: HKCU; Subkey: "Environment"; \
  124. ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{app}"; \
  125. Check: NeedsAddPath('{app}')
  126. [Code]
  127. function NeedsAddPath(Param: string): boolean;
  128. var
  129. OrigPath: string;
  130. begin
  131. if not RegQueryStringValue(HKEY_CURRENT_USER,
  132. 'Environment',
  133. 'Path', OrigPath)
  134. then begin
  135. Result := True;
  136. exit;
  137. end;
  138. { look for the path with leading and trailing semicolon }
  139. { Pos() returns 0 if not found }
  140. Result := Pos(';' + ExpandConstant(Param) + ';', ';' + OrigPath + ';') = 0;
  141. end;
  142. { --- VC Runtime libraries discovery code - Only install vc_redist if it isn't already installed ----- }
  143. const VCRTL_MIN_V1 = 14;
  144. const VCRTL_MIN_V2 = 40;
  145. const VCRTL_MIN_V3 = 33807;
  146. const VCRTL_MIN_V4 = 0;
  147. // check if the minimum required vc redist is installed (by looking the registry)
  148. function vc_redist_needed (): Boolean;
  149. var
  150. sRegKey: string;
  151. v1: Cardinal;
  152. v2: Cardinal;
  153. v3: Cardinal;
  154. v4: Cardinal;
  155. begin
  156. sRegKey := 'SOFTWARE\WOW6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\arm64';
  157. if (RegQueryDWordValue (HKEY_LOCAL_MACHINE, sRegKey, 'Major', v1) and
  158. RegQueryDWordValue (HKEY_LOCAL_MACHINE, sRegKey, 'Minor', v2) and
  159. RegQueryDWordValue (HKEY_LOCAL_MACHINE, sRegKey, 'Bld', v3) and
  160. RegQueryDWordValue (HKEY_LOCAL_MACHINE, sRegKey, 'RBld', v4)) then
  161. begin
  162. Log ('VC Redist version: ' + IntToStr (v1) +
  163. '.' + IntToStr (v2) + '.' + IntToStr (v3) +
  164. '.' + IntToStr (v4));
  165. { Version info was found. Return true if later or equal to our
  166. minimal required version RTL_MIN_Vx }
  167. Result := not (
  168. (v1 > VCRTL_MIN_V1) or ((v1 = VCRTL_MIN_V1) and
  169. ((v2 > VCRTL_MIN_V2) or ((v2 = VCRTL_MIN_V2) and
  170. ((v3 > VCRTL_MIN_V3) or ((v3 = VCRTL_MIN_V3) and
  171. (v4 >= VCRTL_MIN_V4)))))));
  172. end
  173. else
  174. Result := TRUE;
  175. end;