sftpgo.iss 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. #define MyAppName "SFTPGo"
  2. #if GetEnv("SFTPGO_ISS_VERSION") != ""
  3. #define MyAppVersion GetEnv("SFTPGO_ISS_VERSION")
  4. #else
  5. #define MyAppVersion GetEnv("SFTPGO_ISS_DEV_VERSION")
  6. #endif
  7. #if GetEnv("SFTPGO_ISS_ARCH") != ""
  8. #define MyAppArch GetEnv("SFTPGO_ISS_ARCH")
  9. #define MySetupName "sftpgo_windows_" + MyAppArch
  10. #if MyAppArch == "x86"
  11. #define MyAppArch64 ""
  12. #else
  13. #define MyAppArch64 GetEnv("SFTPGO_ISS_ARCH")
  14. #endif
  15. #else
  16. #define MyAppArch "x64"
  17. #define MyAppArch64 "x64"
  18. #define MySetupName "sftpgo_windows_x86_64"
  19. #endif
  20. #define MyAppURL "https://sftpgo.com"
  21. #define MyVersionInfo StringChange(MyAppVersion,"v","")
  22. #define DocURL "https://docs.sftpgo.com"
  23. #define MyAppExeName "sftpgo.exe"
  24. #define MyAppDir "..\output"
  25. #define MyOutputDir ".."
  26. [Setup]
  27. AppId={{1FB9D57F-00DD-4B1B-8798-1138E5CE995D}
  28. AppName={#MyAppName}
  29. AppVersion={#MyAppVersion}
  30. AppVerName={#MyAppName} {#MyAppVersion}
  31. AppPublisher=Nicola Murino
  32. AppPublisherURL={#MyAppURL}
  33. AppSupportURL={#MyAppURL}
  34. AppUpdatesURL={#MyAppURL}
  35. AppCopyright=AGPL-3.0
  36. DefaultDirName={autopf}\{#MyAppName}
  37. DefaultGroupName={#MyAppName}
  38. LicenseFile=LICENSE_with_NOTICE.txt
  39. OutputDir={#MyOutputDir}
  40. OutputBaseFilename={#MySetupName}
  41. SetupIconFile=icon.ico
  42. SolidCompression=yes
  43. UninstallDisplayIcon={app}\sftpgo.exe
  44. WizardStyle=modern
  45. ArchitecturesInstallIn64BitMode={#MyAppArch64}
  46. PrivilegesRequired=admin
  47. ArchitecturesAllowed={#MyAppArch}
  48. MinVersion=10.0.14393
  49. VersionInfoVersion={#MyVersionInfo}
  50. VersionInfoCopyright=AGPL-3.0 with additional terms
  51. SignTool=signtool
  52. SignedUninstaller=yes
  53. [Languages]
  54. Name: "english"; MessagesFile: "compiler:Default.isl"
  55. [Files]
  56. Source: "{#MyAppDir}\sftpgo.exe"; DestDir: "{app}"; Flags: ignoreversion signonce
  57. Source: "{#MyAppDir}\sftpgo.db"; DestDir: "{commonappdata}\{#MyAppName}"; Flags: onlyifdoesntexist uninsneveruninstall
  58. Source: "{#MyAppDir}\LICENSE.txt"; DestDir: "{app}"; Flags: ignoreversion
  59. Source: "{#MyAppDir}\NOTICE.txt"; DestDir: "{app}"; Flags: ignoreversion
  60. Source: "{#MyAppDir}\sftpgo.json"; DestDir: "{commonappdata}\{#MyAppName}"; Flags: onlyifdoesntexist uninsneveruninstall
  61. Source: "{#MyAppDir}\sftpgo.json"; DestDir: "{commonappdata}\{#MyAppName}"; DestName: "sftpgo_default.json"; Flags: ignoreversion
  62. Source: "{#MyAppDir}\templates\*"; DestDir: "{commonappdata}\{#MyAppName}\templates"; Flags: ignoreversion recursesubdirs createallsubdirs
  63. Source: "{#MyAppDir}\static\*"; DestDir: "{commonappdata}\{#MyAppName}\static"; Flags: ignoreversion recursesubdirs createallsubdirs
  64. Source: "{#MyAppDir}\openapi\*"; DestDir: "{commonappdata}\{#MyAppName}\openapi"; Flags: ignoreversion recursesubdirs createallsubdirs
  65. Source: "README.txt"; DestDir: "{app}"; Flags: ignoreversion isreadme
  66. [Dirs]
  67. Name: "{commonappdata}\{#MyAppName}\logs"; Permissions: everyone-full
  68. Name: "{commonappdata}\{#MyAppName}\backups"; Permissions: everyone-full
  69. Name: "{commonappdata}\{#MyAppName}\env.d"; Permissions: everyone-full
  70. Name: "{commonappdata}\{#MyAppName}\certs"; Permissions: everyone-full
  71. [Icons]
  72. Name: "{group}\Web Admin"; Filename: "http://localhost:8080/web/admin";
  73. Name: "{group}\Web Client"; Filename: "http://localhost:8080/web/client";
  74. Name: "{group}\OpenAPI"; Filename: "http://localhost:8080/openapi";
  75. Name: "{group}\Service Control"; WorkingDir: "{app}"; Filename: "powershell.exe"; Parameters: "-Command ""Start-Process cmd \""/k cd {app} & {#MyAppExeName} service --help\"" -Verb RunAs"; Comment: "Manage SFTPGo Service"
  76. Name: "{group}\Documentation"; Filename: "{#DocURL}";
  77. Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
  78. [Run]
  79. Filename: "netsh"; Parameters: "advfirewall firewall delete rule name=""SFTPGo Service"""; Flags: runhidden
  80. Filename: "netsh"; Parameters: "advfirewall firewall add rule name=""SFTPGo Service"" dir=in action=allow program=""{app}\{#MyAppExeName}"""; Flags: runhidden
  81. Filename: "{app}\{#MyAppExeName}"; Parameters: "service stop"; Flags: runhidden
  82. Filename: "{app}\{#MyAppExeName}"; Parameters: "service uninstall"; Flags: runhidden
  83. Filename: "{app}\{#MyAppExeName}"; Parameters: "service install -c ""{commonappdata}\{#MyAppName}"" -l ""logs\sftpgo.log"""; Description: "Install SFTPGo Windows Service"; Flags: runhidden
  84. Filename: "{app}\{#MyAppExeName}"; Parameters: "service start"; Description: "Start SFTPGo Windows Service"; Flags: runhidden
  85. [UninstallRun]
  86. Filename: "{app}\{#MyAppExeName}"; Parameters: "service stop"; Flags: runhidden; RunOnceId: "Stop SFTPGo service"
  87. Filename: "{app}\{#MyAppExeName}"; Parameters: "service uninstall"; Flags: runhidden; RunOnceId: "Uninstall SFTPGo service"
  88. Filename: "netsh"; Parameters: "advfirewall firewall delete rule name=""SFTPGo Service"""; Flags: runhidden; RunOnceId: "Remove SFTPGo firewall rule"
  89. [Messages]
  90. FinishedLabel=Setup has finished installing SFTPGo on your computer. SFTPGo should already be running as a Windows service, it uses TCP port 8080 for HTTP service and TCP port 2022 for SFTP service by default, make sure the configured ports are not used by other services or edit the configuration according to your needs.
  91. [Code]
  92. function PrepareToInstall(var NeedsRestart: Boolean): String;
  93. var
  94. Code: Integer;
  95. begin
  96. if (FileExists(ExpandConstant('{app}\{#MyAppExeName}'))) then
  97. begin
  98. Exec(ExpandConstant('{app}\{#MyAppExeName}'), 'service stop', '', SW_HIDE, ewWaitUntilTerminated, Code);
  99. end
  100. end;