mirror of
https://github.com/netbirdio/netbird.git
synced 2026-10-07 22:19:08 +02:00
* [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
126 lines
6.7 KiB
XML
126 lines
6.7 KiB
XML
<Wix
|
|
xmlns="http://wixtoolset.org/schemas/v4/wxs"
|
|
xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
|
|
<Package Name="NetBird" Version="$(env.NETBIRD_VERSION)" Manufacturer="NetBird GmbH" Language="1033" UpgradeCode="6456ec4e-3ad6-4b9b-a2be-98e81cb21ccf"
|
|
InstallerVersion="500" Compressed="yes" Codepage="utf-8" >
|
|
|
|
|
|
<MediaTemplate EmbedCab="yes" />
|
|
|
|
<Feature Id="NetbirdFeature" Title="Netbird" Level="1">
|
|
<ComponentGroupRef Id="NetbirdFilesComponent" />
|
|
</Feature>
|
|
|
|
<MajorUpgrade AllowSameVersionUpgrades='yes' DowngradeErrorMessage="A newer version of [ProductName] is already installed. Setup will now exit."/>
|
|
|
|
<StandardDirectory Id="ProgramFiles64Folder">
|
|
<Directory Id="NetbirdInstallDir" Name="Netbird">
|
|
<Component Id="NetbirdFiles" Guid="db3165de-cc6e-4922-8396-9d892950e23e" Bitness="always64">
|
|
<File ProcessorArchitecture="$(var.ProcessorArchitecture)" Source=".\dist\netbird_windows_$(var.ArchSuffix)\netbird.exe" KeyPath="yes" />
|
|
<File ProcessorArchitecture="$(var.ProcessorArchitecture)" Source=".\dist\netbird_windows_$(var.ArchSuffix)\netbird-ui.exe">
|
|
<Shortcut Id="NetbirdDesktopShortcut" Directory="DesktopFolder" Name="NetBird" WorkingDirectory="NetbirdInstallDir" Icon="NetbirdIcon">
|
|
<ShortcutProperty Key="System.AppUserModel.ID" Value="NetBird" />
|
|
<ShortcutProperty Key="System.AppUserModel.ToastActivatorCLSID" Value="{0E1B4DE7-E148-432B-9814-544F941826EC}" />
|
|
</Shortcut>
|
|
<Shortcut Id="NetbirdStartMenuShortcut" Directory="StartMenuFolder" Name="NetBird" WorkingDirectory="NetbirdInstallDir" Icon="NetbirdIcon">
|
|
<ShortcutProperty Key="System.AppUserModel.ID" Value="NetBird" />
|
|
<ShortcutProperty Key="System.AppUserModel.ToastActivatorCLSID" Value="{0E1B4DE7-E148-432B-9814-544F941826EC}" />
|
|
</Shortcut>
|
|
</File>
|
|
<File ProcessorArchitecture="$(var.ProcessorArchitecture)" Source=".\dist\netbird_windows_$(var.ArchSuffix)\wintun.dll" />
|
|
<File Id="NetbirdToastIcon" Name="netbird.png" Source=".\client\ui\assets\netbird.png" />
|
|
|
|
<ServiceInstall
|
|
Id="NetBirdService"
|
|
Name="NetBird"
|
|
DisplayName="NetBird"
|
|
Description="Connect your devices into a secure WireGuard-based overlay network with SSO, MFA and granular access controls."
|
|
Start="auto" Type="ownProcess"
|
|
ErrorControl="normal"
|
|
Account="LocalSystem"
|
|
Vital="yes"
|
|
Interactive="no"
|
|
Arguments='service run config [CommonAppDataFolder]Netbird\config.json log-level info'
|
|
/>
|
|
<ServiceControl Id="NetBirdService" Name="NetBird" Start="install" Stop="both" Remove="uninstall" Wait="yes" />
|
|
|
|
<Environment Id="UpdatePath" Name="PATH" Value="[NetbirdInstallDir]" Part="last" Action="set" System="yes" />
|
|
|
|
</Component>
|
|
</Directory>
|
|
</StandardDirectory>
|
|
|
|
<!-- Per-user component: HKCU keypath (auto GUID via "*"), separate from
|
|
the per-machine NetbirdFiles component to satisfy ICE57. -->
|
|
<StandardDirectory Id="ProgramMenuFolder">
|
|
<Component Id="NetbirdAumidRegistry" Guid="*">
|
|
<RegistryKey Root="HKCU" Key="Software\Classes\AppUserModelId\NetBird" ForceDeleteOnUninstall="yes">
|
|
<RegistryValue Name="InstalledByMSI" Type="integer" Value="1" KeyPath="yes" />
|
|
<!-- Pre-seed the CLSID the Wails notifications service reads on
|
|
first startup (notifications_windows.go:getGUID looks for
|
|
the CustomActivator value under this key). Without this
|
|
the service generates a fresh per-install UUID, which
|
|
diverges from the ToastActivatorCLSID set on the Start
|
|
Menu / Desktop shortcuts above and the COM activator
|
|
never fires when a toast is clicked. -->
|
|
<RegistryValue Name="CustomActivator" Type="string" Value="{0E1B4DE7-E148-432B-9814-544F941826EC}" />
|
|
</RegistryKey>
|
|
</Component>
|
|
</StandardDirectory>
|
|
|
|
<ComponentGroup Id="NetbirdFilesComponent">
|
|
<ComponentRef Id="NetbirdFiles" />
|
|
<ComponentRef Id="NetbirdAumidRegistry" />
|
|
</ComponentGroup>
|
|
|
|
<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" />
|
|
|
|
<!-- 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.
|
|
Probe both the per-machine and per-user EdgeUpdate keys; if either
|
|
reports a non-empty `pv` value the runtime is already installed
|
|
and we skip the bootstrapper. -->
|
|
<Property Id="WEBVIEW2_VERSION_HKLM">
|
|
<RegistrySearch Id="WV2HKLM" Root="HKLM"
|
|
Key="SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}"
|
|
Name="pv" Type="raw" Bitness="always64" />
|
|
</Property>
|
|
<Property Id="WEBVIEW2_VERSION_HKCU">
|
|
<RegistrySearch Id="WV2HKCU" Root="HKCU"
|
|
Key="Software\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}"
|
|
Name="pv" Type="raw" />
|
|
</Property>
|
|
|
|
<!-- Embed the bootstrapper payload. Path is relative to the WiX
|
|
working directory; sign-pipelines stages it next to client/
|
|
via `wails3 generate webview2bootstrapper`. -->
|
|
<Binary Id="WebView2Bootstrapper" SourceFile=".\client\MicrosoftEdgeWebview2Setup.exe" />
|
|
|
|
<CustomAction Id="InstallWebView2"
|
|
BinaryRef="WebView2Bootstrapper"
|
|
ExeCommand="/silent /install"
|
|
Execute="deferred"
|
|
Impersonate="no"
|
|
Return="check" />
|
|
|
|
<InstallExecuteSequence>
|
|
<Custom Action="KillNetBirdUI" Before="InstallValidate" />
|
|
<Custom Action="InstallWebView2" Before="InstallFinalize"
|
|
Condition="NOT WEBVIEW2_VERSION_HKLM AND NOT WEBVIEW2_VERSION_HKCU AND NOT REMOVE" />
|
|
</InstallExecuteSequence>
|
|
|
|
<!-- Icons -->
|
|
<Icon Id="NetbirdIcon" SourceFile=".\client\ui\build\windows\icon.ico" />
|
|
<Property Id="ARPPRODUCTICON" Value="NetbirdIcon" />
|
|
|
|
</Package>
|
|
</Wix>
|