11#define B " Backrest"
2- #define TrayExe " backrest-windows-tray.exe"
32#define Website " https://github.com/garethgeorge/backrest/"
43; The following is needed to extract the version from the change log.
54; If the application executable had the version info, then could use built-in GetVersion* functions.
@@ -65,13 +64,12 @@ Name: "port9902"; Description: "9902"; GroupDescription: "{#PortDesc}"; Flags: e
6564; but doing it the same way in all cases for consistency.
6665Source : " LICENSE" ; DestDir : " {app} " ; Flags : ignoreversion ; BeforeInstall : StopBackrest
6766Source : " icon.ico" ; DestDir : " {app} " ; Flags : ignoreversion
68- Source : " {#TrayExe}" ; DestDir : " {app} " ; Flags : ignoreversion
6967Source : " backrest.exe" ; DestDir : " {app} " ; Flags : ignoreversion
7068
7169[Icons]
7270; For user install mode only.
73- Name : " {autostartup}\{#B} systray" ; Filename : " {app} \{#TrayExe} " ; Parameters : " {code:GetPortParam}" ; IconFilename: " {app} \icon.ico" ; Check : IsUserInstallMode
74- Name : " {group} \{#B} systray" ; Filename : " {app} \{#TrayExe} " ; Parameters : " {code:GetPortParam}" ; IconFilename: " {app} \icon.ico" ; Check : IsUserInstallMode
71+ Name : " {autostartup}\{#B} systray" ; Filename : " {app} \backrest.exe " ; Parameters : " --windows-tray {code:GetPortParam}" ; IconFilename: " {app} \icon.ico" ; Check : IsUserInstallMode
72+ Name : " {group} \{#B} systray" ; Filename : " {app} \backrest.exe " ; Parameters : " --windows-tray {code:GetPortParam}" ; IconFilename: " {app} \icon.ico" ; Check : IsUserInstallMode
7573; For both modes.
7674Name : " {group} \{#B}{code:GetIconSuffix}" ; Filename : " http://localhost:{code:GetPort}/" ; IconFilename: " {app} \icon.ico"
7775Name : " {group} \{#B} website" ; Filename : " {#Website}"
@@ -84,7 +82,7 @@ PrivilegesRequiredOverrideAllUsers=Install &system-wide with administrative priv
8482[Run]
8583; Use Task Scheduler to run Backrest elevated. The 30s delay is needed to avoid an issue with tray icon being broken.
8684; The double-quotes escape double-quotes inside the parameter. The backslash escapes double-quotes inside the -Command block.
87- Filename : " powershell.exe" ; Parameters : " -ExecutionPolicy Bypass -Command " " $t = New-ScheduledTaskTrigger -AtLogOn -User $env:USERNAME ; $t.Delay = 'PT30S'; $s = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries; $s.ExecutionTimeLimit = 'PT0S'; Register-ScheduledTask -Force -TaskName '{#B}' -RunLevel Highest -Trigger $t -Action $(New-ScheduledTaskAction -Execute \" " {app} \{#TrayExe} \" " -Argument '--bind-address 127.0.0.1:9897' -WorkingDirectory '{app} ') -Settings $s ; Start-ScheduledTask -TaskName '{#B}'" " " ; Flags : runascurrentuser logoutput runhidden ; Tasks: adminstartcurrent; Check : IsAdminInstallMode
85+ Filename : " powershell.exe" ; Parameters : " -ExecutionPolicy Bypass -Command " " $t = New-ScheduledTaskTrigger -AtLogOn -User $env:USERNAME ; $t.Delay = 'PT30S'; $s = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries; $s.ExecutionTimeLimit = 'PT0S'; Register-ScheduledTask -Force -TaskName '{#B}' -RunLevel Highest -Trigger $t -Action $(New-ScheduledTaskAction -Execute \" " {app} \backrest.exe \" " -Argument '--windows-tray --bind-address 127.0.0.1:9897' -WorkingDirectory '{app} ') -Settings $s ; Start-ScheduledTask -TaskName '{#B}'" " " ; Flags : runascurrentuser logoutput runhidden ; Tasks: adminstartcurrent; Check : IsAdminInstallMode
8886; System user task. No need for systray here, and running it without returning control is the only way to stop it gracefully later.
8987Filename : " powershell.exe" ; Parameters : " -ExecutionPolicy Bypass -Command " " $s = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries; $s.ExecutionTimeLimit = 'PT0S'; Register-ScheduledTask -Force -TaskName '{#B}' -RunLevel Highest -User System -Trigger $(New-ScheduledTaskTrigger -AtStartup) -Action $(New-ScheduledTaskAction -Execute \" " {app} \backrest.exe\" " -Argument '--bind-address 127.0.0.1:9897' -WorkingDirectory '{app} ') -Settings $s ; Start-ScheduledTask -TaskName '{#B}'" " " ; Flags : runascurrentuser logoutput runhidden ; Tasks: adminstartsystem; Check : IsAdminInstallMode
9088; PATH
@@ -94,7 +92,7 @@ Filename: "powershell.exe"; Parameters: "-ExecutionPolicy Bypass -Command ""$new
9492#define PathDelCmd " -ExecutionPolicy Bypass -Command " " " " $newp = '{app} '; $a = [Environment]::GetEnvironmentVariable('PATH', '{code:GetEnvTarget}') -split ';' ; if ($a -contains $newp) {{ echo 'Removing from PATH'; $path = ($a | Where-Object {{ $_ -ne $newp }) -join ';' ; [Environment]::SetEnvironmentVariable('PATH', $path, '{code:GetEnvTarget}') }" " " " "
9593Filename : " powershell.exe" ; Parameters : " {#PathDelCmd}" ; Flags : logoutput runhidden ; Tasks: not addtopath; Check : IsExistingInstallation
9694
97- Filename : " {app} \{#TrayExe} " ; Parameters : " {code:GetPortParam}" ; Description : " Start {#B} (runs in the system tray)" ; Flags : postinstall waituntilidle ; Check : IsUserInstallMode
95+ Filename : " {app} \backrest.exe " ; Parameters : " --windows-tray {code:GetPortParam}" ; Description : " Start {#B} (runs in the system tray)" ; Flags : postinstall waituntilidle ; Check : IsUserInstallMode
9896Filename : " http://localhost:{code:GetPort}/" ; Description : " Open {#B} user interface" ; Flags : postinstall shellexec
9997
10098[UninstallRun]
@@ -184,13 +182,13 @@ begin
184182 // Attempt to terminate Backrest gracefully for the current user, wait for a second (since taskkill returns immediately),
185183 // then check and kill forcefully if it's still running.
186184 if IsUserInstallMode then
187- ExecAndLogOutput(Cmd, ' /C "taskkill /FI "USERNAME eq %USERNAME%" /IM "backrest-windows-tray .exe" & ping -n 2 127.0.0.1 >nul & tasklist /FI "USERNAME eq %USERNAME%" | findstr /I /V "setup" | findstr "backrest" && (echo Forcing & taskkill /FI "USERNAME eq %USERNAME%" /IM "backrest-windows-tray.exe" /F & taskkill /FI "USERNAME eq %USERNAME%" /IM "backrest.exe" /F)" ' ,
185+ ExecAndLogOutput(Cmd, ' /C "taskkill /FI "USERNAME eq %USERNAME%" /IM "backrest.exe" & ping -n 2 127.0.0.1 >nul & tasklist /FI "USERNAME eq %USERNAME%" | findstr /I /V "setup" | findstr "backrest" && (echo Forcing & taskkill /FI "USERNAME eq %USERNAME%" /IM "backrest.exe" /F)" ' ,
188186 ' ' , SW_HIDE, ewWaitUntilTerminated, ResultCode, nil )
189187 // For admin installs stop through the task scheduler. For the SYSTEM or non-current user this is the only way to stop gracefully.
190188 // Ending the scheduled task makes a gracefull attempt, then force kills.
191189 else if IsAdminInstallMode then
192190 begin
193- ExecAndLogOutput(Cmd, ' /C schtasks /End /TN ' + AppName + ' || (taskkill /FI "USERNAME eq %USERNAME%" /IM "backrest-windows-tray.exe" /F & taskkill /FI "USERNAME eq %USERNAME%" /IM "backrest .exe" /F)' ,
191+ ExecAndLogOutput(Cmd, ' /C schtasks /End /TN ' + AppName + ' || (taskkill /FI "USERNAME eq %USERNAME%" /IM "backrest.exe" /F)' ,
194192 ' ' , SW_HIDE, ewWaitUntilTerminated, ResultCode, nil );
195193 // Remove the task when uninstalling.
196194 if IsUninstaller then
0 commit comments