diff options
author | Simon Rozman <simon@rozman.si> | 2019-04-24 14:52:16 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-04-24 15:39:20 +0200 |
commit | 9c48c520442b887978eb0c0f9c255e550431c6e6 (patch) | |
tree | 3f593d845cce3001b6e757f3f429f51bf32fadfe /installer/wireguard.wxs | |
parent | ui: reduce icon overlay size (diff) | |
download | wireguard-windows-9c48c520442b887978eb0c0f9c255e550431c6e6.tar.xz wireguard-windows-9c48c520442b887978eb0c0f9c255e550431c6e6.zip |
installer: redesign
- Switch from installer.wixproj to build.bat file eliminating MSBuild
(Visual Studio) from the list of requirements and adding support for
x86 packaging.
- Reorganize .wxs in a bit more human-friendly way. Maybe.
- Switch to Wintun MSMs - MSM files have to be manually injected in
.deps folder until officially available.
- Start menu shortcut implemented by the book.
Signed-off-by: Simon Rozman <simon@rozman.si>
Diffstat (limited to '')
-rw-r--r-- | installer/wireguard.wxs | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/installer/wireguard.wxs b/installer/wireguard.wxs new file mode 100644 index 00000000..96754ebf --- /dev/null +++ b/installer/wireguard.wxs @@ -0,0 +1,121 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + SPDX-License-Identifier: GPL-2.0 + + Copyright (C) 2019 WireGuard LLC. All Rights Reserved. +--> +<?if $(var.Platform) = x86?> + <?define PlatformProgramFilesFolder = "ProgramFilesFolder"?> +<?else?> + <?define PlatformProgramFilesFolder = "ProgramFiles64Folder"?> +<?endif?> +<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> + <Product + Id="*" + Name="WireGuard" + Language="1033" + Version="$(var.WIREGUARD_VERSION)" + Manufacturer="WireGuard LLC" + UpgradeCode="5e5a1da5-ba36-404d-92ec-41050d1c799c"> + <Package + InstallerVersion="200" + Compressed="yes" + InstallScope="perMachine" + Description="WireGuard: Fast, Modern, Secure VPN Tunnel" + ReadOnly="yes"/> + + <MediaTemplate EmbedCab="yes" CompressionLevel="high"/> + + <Icon Id="icon.ico" SourceFile="..\ui\icon\icon.ico"/> + + <Property Id="ARPPRODUCTICON" Value="icon.ico"/> + <Property Id="ARPURLINFOABOUT" Value="https://www.wireguard.com/"/> + <Property Id="DISABLEADVTSHORTCUTS" Value="yes"/> + + <!-- + Upgrading + --> + <MajorUpgrade + AllowDowngrades="no" DowngradeErrorMessage="A newer version of [ProductName] is already installed." + Schedule="afterInstallExecute"/> + <Property Id="INSTALLFOLDERPREV"> + <ComponentSearch Id="WireGuardExecutable" Guid="c3508d23-3362-47ce-9220-321bdb1a1acc"/> + </Property> + <SetProperty + After="AppSearch" + Action="SetInstallFolderPrev" + Id="INSTALLFOLDER" + Value="[INSTALLFOLDERPREV]" + Sequence="first"><![CDATA[INSTALLFOLDERPREV AND NOT Installed]]></SetProperty> + <SetProperty + After="SetInstallFolderPrev" + Action="SetInstallFolderParam" + Id="INSTALLFOLDER" + Value="[INSTALLDIR]" + Sequence="first"><![CDATA[INSTALLDIR AND NOT Installed]]></SetProperty> + + <!-- + Folders + --> + <Directory Id="TARGETDIR" Name="SourceDir"> + <Directory Id="$(var.PlatformProgramFilesFolder)"> + <Directory Id="INSTALLFOLDER" Name="WireGuard"/> + </Directory> + <Directory Id="ProgramMenuFolder"/> + </Directory> + + <!-- + Components + --> + <ComponentGroup Id="WireGuardComponents"> + <Component Directory="INSTALLFOLDER" Id="WireGuardExecutable" Guid="c3508d23-3362-47ce-9220-321bdb1a1acc"> + <File Source="..\wireguard.exe" KeyPath="yes"/> + <ServiceControl Id="RemoveWireGuardManagerService" Name="WireGuardManager" Remove="both" Stop="both"></ServiceControl> + <ServiceControl Id="RemoveWireGuardTunnelServices" Name="WireGuardTunnel$test" Remove="both" Stop="both"></ServiceControl> + <!-- TODO: "test" is just a temporary hack. We need to enumerate all services that are "WireGuardTunnel$*" and remove those. --> + </Component> + + <Component Directory="INSTALLFOLDER" Id="WireGuardStartMenuShortcut"> + <Shortcut + Id="WireGuardStartMenuShortcut" + Directory="ProgramMenuFolder" + Name="WireGuard" + Description="WireGuard: Fast, Modern, Secure VPN Tunnel" + Target="[INSTALLFOLDER]wireguard.exe" + WorkingDirectory="INSTALLFOLDER" + Icon="icon.ico"/> + <RemoveFolder Id="WireGuardStartMenuShortcut" Directory="ProgramMenuFolder" On="uninstall"/> + <RegistryValue Root="HKCU" Key="SOFTWARE\WireGuard" Name="StartMenuShortcut" Type="integer" Value="1" KeyPath="yes"/> + </Component> + </ComponentGroup> + + <!-- + Merge modules + --> + <DirectoryRef Id="INSTALLFOLDER"> + <Merge Id="WintunMergeModule" Language="0" DiskId="1" SourceFile=".deps\wintun-$(var.Platform).msm"/> + </DirectoryRef> + + <!-- + Features + --> + <Feature Id="WireGuardFeature" Title="WireGuard" Level="1" ConfigurableDirectory="INSTALLFOLDER"> + <ComponentGroupRef Id="WireGuardComponents"/> + </Feature> + <Feature Id="WintunFeature" Title="Wintun" Level="1"> + <MergeRef Id="WintunMergeModule"/> + </Feature> + + <!-- + Launch wireguard.exe after setup complete + --> + <CustomAction Id="LaunchApplication" HideTarget="yes" Impersonate="no" Execute="deferred" FileKey="wireguard.exe" ExeCommand="" Return="asyncNoWait"/> + <InstallExecuteSequence> + <!-- TODO: this should not launch when msiexec is called with whatever flag means it shouldn't launch. --> + <Custom Action="LaunchApplication" After="PublishProduct">NOT Installed</Custom> + </InstallExecuteSequence> + + <!-- TODO: On uninstall remove system32\config\wireguard. --> + <!-- TODO: On install and uninstall, kill services. --> + </Product> +</Wix> |