mirror of
https://github.com/netbirdio/netbird.git
synced 2026-10-07 05:59:06 +02:00
[client] Close the UI before InstallValidate in the MSI (#7395)
* [client] Close the UI before InstallValidate in the MSI The WiX CloseApplication action runs deferred, right before InstallFiles. By then InstallValidate has already asked Restart Manager about the files in use. When msiexec runs as LocalSystem (third-party deployment tools, scheduled tasks) and netbird-ui.exe runs in the interactive user's session, Restart Manager reports a session mismatch, so the installer schedules the UI binary for replacement on the next reboot and returns 3010. Killing the UI afterwards is too late, the file stays on the old version until a real reboot happens. Replace the CloseApplication with an immediate WixQuietExec custom action running taskkill /F /IM netbird-ui.exe, scheduled before InstallValidate. The file is no longer held open when the in-use check runs, InstallFiles overwrites it directly and no reboot is scheduled. Return is ignored because taskkill exits non-zero when no UI is running. The action also runs on uninstall so removal does not require a reboot either. * Keep the deferred UI close as a fallback for the immediate taskkill The immediate taskkill runs with the token of whoever launched msiexec. A non-SYSTEM install cannot terminate a UI running in another user's session, so keep the deferred CloseApplication, which runs as LocalSystem, to stop it before InstallFiles. When taskkill already succeeded it finds no process. * Document why the UI kill runs before InstallValidate
This commit is contained in:
@@ -76,6 +76,14 @@
|
|||||||
<util:CloseApplication Id="CloseNetBird" CloseMessage="no" Target="netbird.exe" RebootPrompt="no" />
|
<util:CloseApplication Id="CloseNetBird" CloseMessage="no" Target="netbird.exe" RebootPrompt="no" />
|
||||||
<util:CloseApplication Id="CloseNetBirdUI" CloseMessage="no" Target="netbird-ui.exe" RebootPrompt="no" TerminateProcess="0" />
|
<util:CloseApplication Id="CloseNetBirdUI" CloseMessage="no" Target="netbird-ui.exe" RebootPrompt="no" TerminateProcess="0" />
|
||||||
|
|
||||||
|
<!-- Kill the UI before InstallValidate, otherwise its Restart Manager
|
||||||
|
check sees netbird-ui.exe in use and schedules the replacement for
|
||||||
|
the next reboot (3010). Keep it immediate and before InstallValidate.
|
||||||
|
CloseNetBirdUI above stays as a deferred LocalSystem fallback for UIs
|
||||||
|
in other sessions that this action cannot terminate. -->
|
||||||
|
<SetProperty Id="WixQuietExecCmdLine" Value=""[System64Folder]taskkill.exe" /F /IM netbird-ui.exe" Before="KillNetBirdUI" Sequence="execute" />
|
||||||
|
<CustomAction Id="KillNetBirdUI" BinaryRef="Wix4UtilCA_$(sys.BUILDARCHSHORT)" DllEntry="WixQuietExec" Execute="immediate" Return="ignore" />
|
||||||
|
|
||||||
<!-- WebView2 evergreen runtime detection.
|
<!-- WebView2 evergreen runtime detection.
|
||||||
Probe both the per-machine and per-user EdgeUpdate keys; if either
|
Probe both the per-machine and per-user EdgeUpdate keys; if either
|
||||||
reports a non-empty `pv` value the runtime is already installed
|
reports a non-empty `pv` value the runtime is already installed
|
||||||
@@ -104,6 +112,7 @@
|
|||||||
Return="check" />
|
Return="check" />
|
||||||
|
|
||||||
<InstallExecuteSequence>
|
<InstallExecuteSequence>
|
||||||
|
<Custom Action="KillNetBirdUI" Before="InstallValidate" />
|
||||||
<Custom Action="InstallWebView2" Before="InstallFinalize"
|
<Custom Action="InstallWebView2" Before="InstallFinalize"
|
||||||
Condition="NOT WEBVIEW2_VERSION_HKLM AND NOT WEBVIEW2_VERSION_HKCU AND NOT REMOVE" />
|
Condition="NOT WEBVIEW2_VERSION_HKLM AND NOT WEBVIEW2_VERSION_HKCU AND NOT REMOVE" />
|
||||||
</InstallExecuteSequence>
|
</InstallExecuteSequence>
|
||||||
|
|||||||
Reference in New Issue
Block a user