ollama.iss 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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=x64 arm64
  29. ArchitecturesInstallIn64BitMode=x64 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. ; https://jrsoftware.org/ishelp/index.php?topic=setup_wizardimagefile
  48. WizardSmallImageFile=.\assets\setup.bmp
  49. ; TODO verifty actual min windows version...
  50. ; OG Win 10
  51. MinVersion=10.0.10240
  52. ; First release that supports WinRT UI Composition for win32 apps
  53. ; MinVersion=10.0.17134
  54. ; First release with XAML Islands - possible UI path forward
  55. ; MinVersion=10.0.18362
  56. ; quiet...
  57. DisableDirPage=yes
  58. DisableFinishedPage=yes
  59. DisableReadyMemo=yes
  60. DisableReadyPage=yes
  61. DisableStartupPrompt=yes
  62. DisableWelcomePage=yes
  63. ; TODO - percentage can't be set less than 100, so how to make it shorter?
  64. ; WizardSizePercent=100,80
  65. #if GetEnv("KEY_CONTAINER")
  66. SignTool=MySignTool
  67. SignedUninstaller=yes
  68. #endif
  69. SetupMutex=OllamaSetupMutex
  70. [Languages]
  71. Name: "english"; MessagesFile: "compiler:Default.isl"
  72. [LangOptions]
  73. DialogFontSize=12
  74. [Files]
  75. Source: ".\app.exe"; DestDir: "{app}"; DestName: "{#MyAppExeName}" ; Flags: ignoreversion 64bit
  76. Source: "..\ollama.exe"; DestDir: "{app}"; Flags: ignoreversion 64bit
  77. Source: "..\dist\windows-{#ARCH}\ollama_runners\*"; DestDir: "{app}\ollama_runners"; Flags: ignoreversion 64bit recursesubdirs
  78. Source: "..\dist\ollama_welcome.ps1"; DestDir: "{app}"; Flags: ignoreversion
  79. Source: ".\assets\app.ico"; DestDir: "{app}"; Flags: ignoreversion
  80. #if DirExists("..\dist\windows-amd64\cuda")
  81. Source: "..\dist\windows-amd64\cuda\*"; DestDir: "{app}\cuda\"; Flags: ignoreversion recursesubdirs
  82. #endif
  83. #if DirExists("..\dist\windows-amd64\oneapi")
  84. Source: "..\dist\windows-amd64\oneapi\*"; DestDir: "{app}\oneapi\"; Flags: ignoreversion recursesubdirs
  85. #endif
  86. #if DirExists("..\dist\windows-amd64\rocm")
  87. Source: "..\dist\windows-amd64\rocm\*"; DestDir: "{app}\rocm\"; Flags: ignoreversion recursesubdirs
  88. #endif
  89. [Icons]
  90. Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\app.ico"
  91. Name: "{userstartup}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\app.ico"
  92. Name: "{userprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\app.ico"
  93. [Run]
  94. Filename: "{cmd}"; Parameters: "/C set PATH={app};%PATH% & ""{app}\{#MyAppExeName}"""; Flags: postinstall nowait runhidden
  95. [UninstallRun]
  96. ; Filename: "{cmd}"; Parameters: "/C ""taskkill /im ''{#MyAppExeName}'' /f /t"; Flags: runhidden
  97. ; Filename: "{cmd}"; Parameters: "/C ""taskkill /im ollama.exe /f /t"; Flags: runhidden
  98. Filename: "taskkill"; Parameters: "/im ""{#MyAppExeName}"" /f /t"; Flags: runhidden
  99. Filename: "taskkill"; Parameters: "/im ""ollama.exe"" /f /t"; Flags: runhidden
  100. ; HACK! need to give the server and app enough time to exit
  101. ; TODO - convert this to a Pascal code script so it waits until they're no longer running, then completes
  102. Filename: "{cmd}"; Parameters: "/c timeout 5"; Flags: runhidden
  103. [UninstallDelete]
  104. Type: filesandordirs; Name: "{%TEMP}\ollama*"
  105. Type: filesandordirs; Name: "{%LOCALAPPDATA}\Ollama"
  106. Type: filesandordirs; Name: "{%LOCALAPPDATA}\Programs\Ollama"
  107. Type: filesandordirs; Name: "{%USERPROFILE}\.ollama\models"
  108. Type: filesandordirs; Name: "{%USERPROFILE}\.ollama\history"
  109. ; NOTE: if the user has a custom OLLAMA_MODELS it will be preserved
  110. [Messages]
  111. WizardReady=Ollama Windows Preview
  112. ReadyLabel1=%nLet's get you up and running with your own large language models.
  113. 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.
  114. ;FinishedHeadingLabel=Run your first model
  115. ;FinishedLabel=%nRun this command in a PowerShell or cmd terminal.%n%n%n ollama run llama3
  116. ;ClickFinish=%n
  117. [Registry]
  118. Root: HKCU; Subkey: "Environment"; \
  119. ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{app}"; \
  120. Check: NeedsAddPath('{app}')
  121. [Code]
  122. function NeedsAddPath(Param: string): boolean;
  123. var
  124. OrigPath: string;
  125. begin
  126. if not RegQueryStringValue(HKEY_CURRENT_USER,
  127. 'Environment',
  128. 'Path', OrigPath)
  129. then begin
  130. Result := True;
  131. exit;
  132. end;
  133. { look for the path with leading and trailing semicolon }
  134. { Pos() returns 0 if not found }
  135. Result := Pos(';' + ExpandConstant(Param) + ';', ';' + OrigPath + ';') = 0;
  136. end;