; punktfunk host installer (Inno Setup 6). ; ; Produces a signed setup.exe that lays the host into Program Files, optionally installs the bundled ; SudoVDA virtual-display driver, and DELEGATES service registration to `punktfunk-host service ; install`. The real, idempotent install logic (SCM registration, firewall rules, default host.env, ; the SYSTEM→interactive-session CreateProcessAsUserW supervisor for secure-desktop capture) lives in ; crates/punktfunk-host/src/service.rs — this script does NOT duplicate it. That SYSTEM service model ; is exactly why MSIX is unusable here and we ship a classic elevated installer instead. ; ; Built by pack-host-installer.ps1, e.g.: ; ISCC.exe /DMyAppVersion=0.2.123 /DBinDir=C:\t\release /DStageDir=C:\t\out\stage \ ; /DOutputDir=C:\t\out packaging\windows\punktfunk-host.iss ; Omit /DStageDir to build an installer WITHOUT the bundled driver (driver becomes a prerequisite). #ifndef MyAppVersion #define MyAppVersion "0.0.0" #endif #ifndef BinDir #define BinDir "." #endif #ifndef OutputDir #define OutputDir "." #endif ; StageDir (the staged SudoVDA payload + nefconc.exe + install-sudovda.ps1) is optional. #ifdef StageDir #define WithDriver #endif [Setup] AppId={{7C9E6A52-1F4B-4E8D-A3C7-2B5D8F1E0A93} AppName=punktfunk host AppVersion={#MyAppVersion} AppPublisher=unom AppPublisherURL=https://git.unom.io/unom/punktfunk DefaultDirName={autopf}\punktfunk DefaultGroupName=punktfunk DisableProgramGroupPage=yes UsePreviousAppDir=yes PrivilegesRequired=admin MinVersion=10.0 ArchitecturesAllowed=x64 ArchitecturesInstallIn64BitMode=x64 OutputDir={#OutputDir} OutputBaseFilename=punktfunk-host-setup-{#MyAppVersion} Compression=lzma2/max SolidCompression=yes WizardStyle=modern UninstallDisplayName=punktfunk host {#MyAppVersion} UninstallDisplayIcon={app}\punktfunk-host.exe [Tasks] #ifdef WithDriver Name: "installdriver"; Description: "Install the SudoVDA virtual display driver (required for native-resolution streaming)" #endif Name: "startservice"; Description: "Start the punktfunk host service now (also starts on every boot)" [Files] Source: "{#BinDir}\punktfunk-host.exe"; DestDir: "{app}"; Flags: ignoreversion Source: "{#SourcePath}..\..\scripts\windows\host.env.example"; DestDir: "{app}"; Flags: ignoreversion Source: "{#SourcePath}README.md"; DestDir: "{app}"; DestName: "README.txt"; Flags: ignoreversion #ifdef WithDriver ; The driver payload + nefconc.exe + install-sudovda.ps1, extracted to {tmp} and removed after install. Source: "{#StageDir}\*"; DestDir: "{tmp}\sudovda"; Flags: deleteafterinstall recursesubdirs createallsubdirs; Tasks: installdriver #endif [Run] #ifdef WithDriver Filename: "powershell.exe"; \ Parameters: "-NoProfile -ExecutionPolicy Bypass -File ""{tmp}\sudovda\install-sudovda.ps1"" -Dir ""{tmp}\sudovda"""; \ StatusMsg: "Installing the SudoVDA virtual display driver..."; \ Flags: runhidden waituntilterminated; Tasks: installdriver #endif ; Register (or re-point, on upgrade — idempotent) the SYSTEM service from its FINAL {app} location: ; service install records current_exe() as the SCM binPath, so it must run from {app}, not {tmp}. Filename: "{app}\punktfunk-host.exe"; Parameters: "service install"; WorkingDir: "{app}"; \ StatusMsg: "Registering the punktfunk host service..."; Flags: runhidden waituntilterminated Filename: "{app}\punktfunk-host.exe"; Parameters: "service start"; WorkingDir: "{app}"; \ StatusMsg: "Starting the punktfunk host service..."; Flags: runhidden waituntilterminated; Tasks: startservice [UninstallRun] Filename: "{app}\punktfunk-host.exe"; Parameters: "service uninstall"; Flags: runhidden waituntilterminated; RunOnceId: "PunktfunkHostServiceUninstall" [Code] { On upgrade the running service locks punktfunk-host.exe (and the supervisor would respawn it from the OLD binary), so stop it and WAIT for STOPPED before files are copied. Best-effort; a fresh install is a no-op (the service doesn't exist yet). } procedure StopHostServiceAndWait; var ResultCode: Integer; begin Exec('powershell.exe', '-NoProfile -ExecutionPolicy Bypass -Command "' + '$ErrorActionPreference=''SilentlyContinue''; ' + '$s=Get-Service -Name ''PunktfunkHost''; ' + 'if($s -and $s.Status -ne ''Stopped''){Stop-Service -Name ''PunktfunkHost'' -Force; ' + 'try{$s.WaitForStatus(''Stopped'',[TimeSpan]::FromSeconds(30))}catch{}}"', '', SW_HIDE, ewWaitUntilTerminated, ResultCode); end; procedure CurStepChanged(CurStep: TSetupStep); begin if CurStep = ssInstall then StopHostServiceAndWait; end;