diff options
Diffstat (limited to 'installer/wireguard.wxs')
-rw-r--r-- | installer/wireguard.wxs | 83 |
1 files changed, 47 insertions, 36 deletions
diff --git a/installer/wireguard.wxs b/installer/wireguard.wxs index 5bbb1ebb..ab90d3cd 100644 --- a/installer/wireguard.wxs +++ b/installer/wireguard.wxs @@ -2,18 +2,22 @@ <!-- SPDX-License-Identifier: GPL-2.0 - Copyright (C) 2019 WireGuard LLC. All Rights Reserved. + Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. --> -<?if $(var.WIREGUARD_PLATFORM) = "x86"?> - <?define PlatformProgramFilesFolder = "ProgramFilesFolder"?> -<?else?> +<?if $(var.WIREGUARD_PLATFORM) = "amd64" Or $(var.WIREGUARD_PLATFORM) = "arm64"?> <?define PlatformProgramFilesFolder = "ProgramFiles64Folder"?> +<?else?> + <?define PlatformProgramFilesFolder = "ProgramFilesFolder"?> <?endif?> <?if $(var.WIREGUARD_PLATFORM) = "amd64"?> <?define UpgradeCode = "5e5a1da5-ba36-404d-92ec-41050d1c799c"?> <?elseif $(var.WIREGUARD_PLATFORM) = "x86"?> <?define UpgradeCode = "62754a0a-fee9-4412-b739-e8da2e7c9405"?> +<?elseif $(var.WIREGUARD_PLATFORM) = "arm"?> + <?define UpgradeCode = "f90bca59-9627-431d-92b4-a5c2d9a529ff"?> +<?elseif $(var.WIREGUARD_PLATFORM) = "arm64"?> + <?define UpgradeCode = "7ff76099-8940-4d3e-99b9-50a3b3ca1ee9"?> <?else?> <?error Unknown platform ?> <?endif?> @@ -27,7 +31,7 @@ Manufacturer="WireGuard LLC" UpgradeCode="$(var.UpgradeCode)"> <Package - InstallerVersion="400" + InstallerVersion="500" Compressed="yes" InstallScope="perMachine" Description="WireGuard: Fast, Modern, Secure VPN Tunnel" @@ -53,7 +57,8 @@ AllowDowngrades="no" AllowSameVersionUpgrades="yes" DowngradeErrorMessage="A newer version of [ProductName] is already installed." - Schedule="afterInstallExecute" /> + Schedule="afterInstallExecute" + IgnoreRemoveFailure="yes" /> <!-- Folders @@ -63,10 +68,6 @@ <Directory Id="WireGuardFolder" Name="WireGuard" /> </Directory> <Directory Id="ProgramMenuFolder" /> - <Directory Id="SystemFolder" /> - <?if $(var.WIREGUARD_PLATFORM) != "x86"?> - <Directory Id="System64Folder" /> - <?endif?> </Directory> <!-- @@ -79,32 +80,26 @@ </File> <ServiceControl Id="DummyService.3AA0C492_29F4_4342_B608_DB95B2DECB13" Name="DummyService.3AA0C492_29F4_4342_B608_DB95B2DECB13" /><!-- A dummy to make WiX create ServiceControl table for us. --> </Component> - <Component Directory="SystemFolder" Win64="no" Id="Wg32Executable" Guid="5ca31841-97d8-4614-a318-f1e268135ba7"> - <File Source="..\x86\wg.exe" Id="Wg32Executable" /> - </Component> - <?if $(var.WIREGUARD_PLATFORM) != "x86"?> - <Component Directory="System64Folder" Win64="yes" Id="Wg64Executable" Guid="d9b494ec-0959-442c-89ad-6aa175acfd03"> - <File Source="..\$(var.WIREGUARD_PLATFORM)\wg.exe" Id="Wg64Executable" /> + <Component Directory="WireGuardFolder" Id="WgExecutable" Guid="540cf446-fcc3-4452-b9fb-eb4c02780251"> + <File Source="..\$(var.WIREGUARD_PLATFORM)\wg.exe" KeyPath="yes" /> + <Environment Id="PATH" Name="PATH" System="yes" Action="set" Part="last" Permanent="no" Value="[WireGuardFolder]" /> </Component> - <?endif?> </ComponentGroup> <!-- - Merge modules - --> - <DirectoryRef Id="WireGuardFolder"> - <Merge Id="WintunMergeModule" Language="0" DiskId="1" SourceFile=".deps\wintun-$(var.WIREGUARD_PLATFORM).msm" /> - </DirectoryRef> - - <!-- Features --> <Feature Id="WireGuardFeature" Title="WireGuard" Level="1"> <ComponentGroupRef Id="WireGuardComponents" /> </Feature> - <Feature Id="WintunFeature" Title="Wintun" Level="1"> - <MergeRef Id="WintunMergeModule" /> - </Feature> + + <!-- + Abort early if running under Wow64 + --> + <CustomAction Id="CheckWow64" BinaryKey="customactions.dll" DllEntry="CheckWow64" /> + <InstallExecuteSequence> + <Custom Action="CheckWow64" After="FindRelatedProducts">NOT REMOVE</Custom> + </InstallExecuteSequence> <!-- Evaluate WireGuard services and populate ServiceControl table @@ -115,11 +110,19 @@ </InstallExecuteSequence> <!-- - Clear out our config folder on uninstall + Launch wireguard.exe on product reconfiguration (starting same MSI again) --> - <CustomAction Id="RemoveConfigFolder" BinaryKey="customactions.dll" DllEntry="RemoveConfigFolder" Execute="deferred" Impersonate="no" /> + <CustomAction Id="LaunchApplicationAndAbort" BinaryKey="customactions.dll" DllEntry="LaunchApplicationAndAbort" /> + <InstallExecuteSequence> + <Custom Action="LaunchApplicationAndAbort" After="CostFinalize">ProductState=5 AND NOT REMOVE AND NOT DO_NOT_LAUNCH</Custom> + </InstallExecuteSequence> + + <!-- + Evaluate WireGuard components + --> + <CustomAction Id="EvaluateWireGuardComponents" BinaryKey="customactions.dll" DllEntry="EvaluateWireGuardComponents" /> <InstallExecuteSequence> - <Custom Action="RemoveConfigFolder" After="DeleteServices">(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")</Custom> + <Custom Action="EvaluateWireGuardComponents" After="ProcessComponents" /> </InstallExecuteSequence> <!-- @@ -131,19 +134,27 @@ </InstallExecuteSequence> <!-- - Launch wireguard.exe after setup complete + Clear out our config folder on uninstall --> - <CustomAction Id="LaunchApplication" HideTarget="yes" Impersonate="no" Execute="deferred" FileKey="wireguard.exe" ExeCommand="" Return="asyncNoWait" /> + <CustomAction Id="RemoveConfigFolder" BinaryKey="customactions.dll" DllEntry="RemoveConfigFolder" Execute="deferred" Impersonate="no" /> <InstallExecuteSequence> - <Custom Action="LaunchApplication" Before="InstallFinalize">(&WireGuardFeature = 3) AND NOT DO_NOT_LAUNCH</Custom> + <Custom Action="RemoveConfigFolder" After="DeleteServices" /> </InstallExecuteSequence> <!-- - Launch wireguard.exe on product reconfiguration (starting same MSI again) + Clear out our adapters on uninstall --> - <CustomAction Id="LaunchApplicationAsOrdinaryUser" HideTarget="yes" FileKey="wireguard.exe" ExeCommand="" Return="asyncNoWait" /> + <CustomAction Id="RemoveAdapters" BinaryKey="customactions.dll" DllEntry="RemoveAdapters" Execute="deferred" Impersonate="no" /> <InstallExecuteSequence> - <Custom Action="LaunchApplicationAsOrdinaryUser" After="InstallFinalize">(&WireGuardFeature = -1) AND (!WireGuardFeature = 3) AND NOT DO_NOT_LAUNCH</Custom> + <Custom Action="RemoveAdapters" Before="RemoveFiles" /> + </InstallExecuteSequence> + + <!-- + Launch wireguard.exe after setup complete + --> + <CustomAction Id="LaunchApplication" HideTarget="yes" Impersonate="no" Execute="deferred" FileKey="wireguard.exe" ExeCommand="" Return="asyncNoWait" /> + <InstallExecuteSequence> + <Custom Action="LaunchApplication" Before="InstallFinalize">(&WireGuardFeature = 3) AND NOT DO_NOT_LAUNCH</Custom> </InstallExecuteSequence> </Product> </Wix> |