bambuddy.iss 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. ; Bambuddy Windows Installer — Inno Setup script
  2. ;
  3. ; Builds a self-contained installer that lays down:
  4. ; - embedded Python 3.13 + pre-installed venv
  5. ; - backend source + pre-built frontend bundle
  6. ; - NSSM + ffmpeg under bin/
  7. ; - a Windows service running as LocalSystem
  8. ;
  9. ; Build prerequisites: run installers/windows/build.py first to stage
  10. ; the build/staging/ tree, then compile this file with ISCC.exe.
  11. ;
  12. ; See installers/windows/README.md for the full pipeline.
  13. #define MyAppName "Bambuddy"
  14. #define MyAppPublisher "Martin Ziegler"
  15. #define MyAppURL "https://bambuddy.cool"
  16. #define MyAppExeName "bambuddy.exe"
  17. #define ServiceName "Bambuddy"
  18. #define DefaultPort "8000"
  19. ; Version is stamped by build.py into build\staging\version.iss as a
  20. ; #define directive. Falls back to a placeholder if you ran ISCC without
  21. ; running build.py first (don't ship that build).
  22. #ifexist "build\staging\version.iss"
  23. #include "build\staging\version.iss"
  24. #else
  25. #define MyAppVersion "0.0.0+dev"
  26. #endif
  27. [Setup]
  28. AppId={{8C9C9E1A-7C5A-4F2A-9F1B-BAMBUDDY00001}}
  29. AppName={#MyAppName}
  30. AppVersion={#MyAppVersion}
  31. AppPublisher={#MyAppPublisher}
  32. AppPublisherURL={#MyAppURL}
  33. AppSupportURL={#MyAppURL}
  34. AppUpdatesURL={#MyAppURL}
  35. DefaultDirName={autopf}\Bambuddy
  36. DefaultGroupName={#MyAppName}
  37. DisableProgramGroupPage=yes
  38. LicenseFile=..\..\LICENSE
  39. OutputDir=build\output
  40. OutputBaseFilename=bambuddy-{#MyAppVersion}-windows-x64-setup
  41. Compression=lzma
  42. SolidCompression=yes
  43. WizardStyle=modern
  44. ArchitecturesAllowed=x64compatible
  45. ArchitecturesInstallIn64BitMode=x64compatible
  46. ; Admin required: we register a Windows service and write to ProgramData
  47. PrivilegesRequired=admin
  48. PrivilegesRequiredOverridesAllowed=
  49. UninstallDisplayIcon={app}\bin\nssm.exe
  50. SetupIconFile=
  51. ; Don't allow installing to a network drive — service won't start cleanly
  52. DisableDirPage=no
  53. DisableReadyPage=no
  54. ChangesEnvironment=no
  55. CloseApplications=no
  56. [Languages]
  57. Name: "english"; MessagesFile: "compiler:Default.isl"
  58. Name: "german"; MessagesFile: "compiler:Languages\German.isl"
  59. [Tasks]
  60. Name: "desktopicon"; Description: "Create a desktop shortcut"; GroupDescription: "Additional shortcuts:"; Flags: unchecked
  61. Name: "firewallrule"; Description: "Add Windows Firewall rule for Bambuddy (port {#DefaultPort})"; GroupDescription: "Network:"
  62. [Files]
  63. ; Embedded Python (entire tree)
  64. Source: "build\staging\python\*"; DestDir: "{app}\python"; Flags: recursesubdirs ignoreversion
  65. ; Backend + frontend
  66. Source: "build\staging\app\*"; DestDir: "{app}\app"; Flags: recursesubdirs ignoreversion
  67. ; NSSM, ffmpeg, ffprobe
  68. Source: "build\staging\bin\*"; DestDir: "{app}\bin"; Flags: recursesubdirs ignoreversion
  69. ; Service install/uninstall scripts
  70. Source: "build\staging\service\*"; DestDir: "{app}\service"; Flags: recursesubdirs ignoreversion
  71. ; Version stamp
  72. Source: "build\staging\VERSION"; DestDir: "{app}"; Flags: ignoreversion
  73. [Dirs]
  74. ; ProgramData layout — created with permissions LocalSystem can write to
  75. Name: "{commonappdata}\Bambuddy"; Permissions: users-modify
  76. Name: "{commonappdata}\Bambuddy\data"; Permissions: users-modify
  77. Name: "{commonappdata}\Bambuddy\logs"; Permissions: users-modify
  78. [Icons]
  79. Name: "{group}\Open Bambuddy Dashboard"; Filename: "http://localhost:{#DefaultPort}"; IconFilename: "{app}\bin\nssm.exe"
  80. Name: "{group}\Bambuddy Logs"; Filename: "{commonappdata}\Bambuddy\logs"
  81. Name: "{group}\Uninstall Bambuddy"; Filename: "{uninstallexe}"
  82. Name: "{commondesktop}\Bambuddy"; Filename: "http://localhost:{#DefaultPort}"; IconFilename: "{app}\bin\nssm.exe"; Tasks: desktopicon
  83. [Run]
  84. ; Register and start the Windows service
  85. Filename: "{app}\service\install-service.bat"; Parameters: """{app}"" ""{commonappdata}\Bambuddy"" {#DefaultPort}"; Flags: runhidden waituntilterminated; StatusMsg: "Registering Bambuddy service..."
  86. ; Open Windows Firewall on the dashboard port. We do this only if the
  87. ; user opted in via the firewallrule task — some environments manage
  88. ; firewall centrally and prefer to handle this themselves.
  89. Filename: "netsh.exe"; Parameters: "advfirewall firewall add rule name=""Bambuddy Dashboard"" dir=in action=allow protocol=TCP localport={#DefaultPort}"; Flags: runhidden waituntilterminated; Tasks: firewallrule; StatusMsg: "Adding firewall rule..."
  90. ; Open the dashboard in the user's default browser at the end of install
  91. Filename: "http://localhost:{#DefaultPort}"; Flags: shellexec postinstall nowait skipifsilent; Description: "Open Bambuddy Dashboard"
  92. [UninstallRun]
  93. ; Stop + deregister the service before file removal
  94. Filename: "{app}\service\uninstall-service.bat"; Parameters: """{app}"""; Flags: runhidden waituntilterminated
  95. ; Remove the firewall rule (silently — if it doesn't exist, netsh just complains)
  96. Filename: "netsh.exe"; Parameters: "advfirewall firewall delete rule name=""Bambuddy Dashboard"""; Flags: runhidden waituntilterminated
  97. [UninstallDelete]
  98. ; Remove install dir contents; leave ProgramData\Bambuddy alone so the
  99. ; user keeps their database + archives. Re-installing on top picks them
  100. ; back up automatically.
  101. Type: filesandordirs; Name: "{app}"
  102. [Code]
  103. // Pre-install check: refuse to install if port 8000 is already in use by
  104. // something other than a previous Bambuddy install. This catches the
  105. // "I have something else on 8000" case early instead of after install.
  106. function InitializeSetup(): Boolean;
  107. begin
  108. Result := True;
  109. // TODO: optional port-conflict check. Inno Setup doesn't have a
  110. // native socket API; would need a tiny helper exe or a netstat parse.
  111. // Defer to v1.1 — for v1, accept that conflicts surface at first
  112. // service start and the user reads the log.
  113. end;