Fix windows installer orbit delete pending (#15301)

Relates to #14958 

If some of the following don't apply, delete the relevant line.

<!-- Note that API documentation changes are now addressed by the
product design team. -->

- [X] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [ ] Manual QA for all new/changed functionality
  - For Orbit and Fleet Desktop changes:
- [X] Manual QA must be performed in the three main OSs, macOS, Windows
and Linux.
- [ ] Auto-update manual QA, from released version of component to new
version (see [tools/tuf/test](../tools/tuf/test/README.md)).
This commit is contained in:
Marcos Oviedo 2023-11-23 12:29:40 -03:00 committed by GitHub
parent 7fdf97660d
commit 097114e8f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 1 deletions

View file

@ -0,0 +1 @@
* Fixes delete pending issue on orbit.exe during installation

View file

@ -159,10 +159,36 @@ var windowsWixTemplate = template.Must(template.New("").Option("missingkey=error
Return="check"
Impersonate="no" />
<SetProperty Id="CA_WaitOrbit"
Before ="CA_WaitOrbit"
Sequence="execute"
Value='&quot;[POWERSHELLEXE]&quot; -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass Wait-Process -Name orbit -Timeout 30 -ErrorAction SilentlyContinue' />
<CustomAction Id="CA_WaitOrbit"
BinaryKey="WixCA"
DllEntry="WixQuietExec64"
Execute="deferred"
Return="ignore"
Impersonate="no" />
<SetProperty Id="CA_RemoveRebootPending"
Before ="CA_RemoveRebootPending"
Sequence="execute"
Value='&quot;[POWERSHELLEXE]&quot; -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass Remove-Item -Path "$Env:Programfiles\orbit\bin" -Recurse -Force' />
<CustomAction Id="CA_RemoveRebootPending"
BinaryKey="WixCA"
DllEntry="WixQuietExec64"
Execute="deferred"
Return="ignore"
Impersonate="no" />
<InstallExecuteSequence>
<Custom Action='CA_RemoveOrbit' Before='RemoveFiles'>(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")</Custom> <!-- Only happens during uninstall -->
<Custom Action='CA_UninstallOsquery' After='InstallFiles'>NOT Installed AND NOT WIX_UPGRADE_DETECTED</Custom> <!-- Only happens during first install -->
<Custom Action='CA_UpdateSecret' Before='InstallServices'>NOT Installed</Custom> <!-- It happens just before service creation -->
<Custom Action='CA_UpdateSecret' Before='InstallServices'>NOT Installed</Custom> <!-- It happens just before service creation -->
<Custom Action="CA_WaitOrbit" Before="CA_RemoveRebootPending"/>
<Custom Action="CA_RemoveRebootPending" Before='InstallFiles'>NOT Installed</Custom> <!-- It removes reboot pending Orbit files -->
</InstallExecuteSequence>
<Feature Id="Orbit" Title="Fleet osquery" Level="1" Display="hidden">