aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--installer/.editorconfig2
-rw-r--r--installer/.gitignore7
-rw-r--r--installer/build.bat63
-rw-r--r--installer/installer.wixproj49
-rw-r--r--installer/installer.wxs66
-rw-r--r--installer/wireguard.wxs121
6 files changed, 193 insertions, 115 deletions
diff --git a/installer/.editorconfig b/installer/.editorconfig
new file mode 100644
index 00000000..f7db312d
--- /dev/null
+++ b/installer/.editorconfig
@@ -0,0 +1,2 @@
+[*.{bat,wxs}]
+indent_style = tab
diff --git a/installer/.gitignore b/installer/.gitignore
new file mode 100644
index 00000000..2933d030
--- /dev/null
+++ b/installer/.gitignore
@@ -0,0 +1,7 @@
+# Dependencies
+/.deps
+
+# Build Output
+/dist
+/x86
+/amd64
diff --git a/installer/build.bat b/installer/build.bat
new file mode 100644
index 00000000..36760291
--- /dev/null
+++ b/installer/build.bat
@@ -0,0 +1,63 @@
+@echo off
+rem SPDX-License-Identifier: GPL-2.0
+rem (C) 2019 WireGuard LLC. All Rights Reserved.
+
+set WIREGUARD_VERSION=0.1
+
+set STARTDIR=%cd%
+set OLDWIX=%WIX%
+set WIX_CANDLE_FLAGS=-nologo -dWIREGUARD_VERSION="%WIREGUARD_VERSION%"
+set WIX_LIGHT_FLAGS=-nologo -spdb
+
+if exist .deps\prepared goto :build
+:installdeps
+ rmdir /s /q .deps 2> NUL
+ mkdir .deps || goto :error
+ cd .deps || goto :error
+ echo [+] Downloading wix-binaries
+ curl -#fLo wix-binaries.zip http://wixtoolset.org/downloads/v3.14.0.2812/wix314-binaries.zip || goto :error
+ echo [+] Verifying wix-binaries
+ for /f %%a in ('CertUtil -hashfile wix-binaries.zip SHA256 ^| findstr /r "^[0-9a-f]*$"') do if not "%%a"=="923892298f37514622c58cbbd9c2cadf2822d9bb53df8ee83aaeb05280777611" goto :error
+ rem echo [+] Downloading wintun-x86
+ rem curl -#fo wintun-x86.msm https://www.wintun.net/builds/wintun-x86-0.1.msm || goto :error
+ rem echo [+] Verifying wintun-x86
+ rem for /f %%a in ('CertUtil -hashfile wintun-x86.msm SHA256 ^| findstr /r "^[0-9a-f]*$"') do if not "%%a"=="5390762183e181804b28eb13815b6210f85a1280057b815f749b06768215f817" goto :error
+ rem echo [+] Downloading wintun-amd64
+ rem curl -#fo wintun-amd64.msm https://www.wintun.net/builds/wintun-amd64-0.1.msm || goto :error
+ rem echo [+] Verifying wintun-amd64
+ rem for /f %%a in ('CertUtil -hashfile wintun-amd64.msm SHA256 ^| findstr /r "^[0-9a-f]*$"') do if not "%%a"=="5390762183e181804b28eb13815b6210f85a1280057b815f749b06768215f817" goto :error
+ echo [+] Extracting wix-binaries
+ mkdir wix\bin || goto :error
+ tar -xf wix-binaries.zip -C wix\bin || goto :error
+ echo [+] Cleaning up
+ del wix-binaries.zip || goto :error
+ copy /y NUL prepared > NUL || goto :error
+ cd .. || goto :error
+
+:build
+ set WIX=%STARTDIR%\.deps\wix\
+ call :msi x86 x86 || goto :error
+ call :msi amd64 x64 || goto :error
+ if "%SigningCertificate%"=="" goto :build_sfx
+ if "%TimeStampServer%"=="" goto :build_sfx
+ echo [+] Signing
+ signtool.exe sign /sha1 "%SigningCertificate%" /fd sha256 /tr "%TimeStampServer%" /td sha256 /d "WireGuard Setup" "dist\wireguard-*-%WIREGUARD_VERSION%.msi" || goto :error
+
+:build_sfx
+ rem TODO: Build SFX bundle with all MSIs.
+
+:out
+ set WIX=%OLDWIX%
+ cd %STARTDIR%
+ exit /b %errorlevel%
+
+:error
+ echo [-] Failed with error #%errorlevel%.
+ goto :out
+
+:msi
+ echo [+] Compiling %1
+ "%WIX%bin\candle.exe" %WIX_CANDLE_FLAGS% -dPlatform="%1" -out "%1\wireguard.wixobj" -arch %2 wireguard.wxs || exit /b %errorlevel%
+ echo [+] Linking %1
+ "%WIX%bin\light.exe" %WIX_LIGHT_FLAGS% -out "dist\wireguard-%1-%WIREGUARD_VERSION%.msi" "%1\wireguard.wixobj" || exit /b %errorlevel%
+ goto :eof
diff --git a/installer/installer.wixproj b/installer/installer.wixproj
deleted file mode 100644
index 3c0409ab..00000000
--- a/installer/installer.wixproj
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" InitialTargets="EnsureWixToolsetInstalled" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
- <ProductVersion>3.10</ProductVersion>
- <ProjectGuid>6ccfa606-8048-4502-86ea-e88027abfb15</ProjectGuid>
- <SchemaVersion>2.0</SchemaVersion>
- <OutputName>installer</OutputName>
- <OutputType>Package</OutputType>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
- <OutputPath>bin\$(Configuration)\</OutputPath>
- <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
- <DefineConstants>Debug</DefineConstants>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
- <OutputPath>bin\$(Configuration)\</OutputPath>
- <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
- </PropertyGroup>
- <ItemGroup>
- <Compile Include="installer.wxs" />
- </ItemGroup>
- <ItemGroup>
- <WixExtension Include="WixDifxAppExtension">
- <HintPath>$(WixExtDir)\WixDifxAppExtension.dll</HintPath>
- <Name>WixDifxAppExtension</Name>
- </WixExtension>
- </ItemGroup>
- <ItemGroup>
- <WixLibrary Include="difxapp_x64">
- <HintPath>$(WixExtDir)\difxapp_x64.wixlib</HintPath>
- <Name>difxapp_x64</Name>
- </WixLibrary>
- </ItemGroup>
- <Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " />
- <Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets') " />
- <Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' ">
- <Error Text="The WiX Toolset v3.11 (or newer) build tools must be installed to build this project. To download the WiX Toolset, see http://wixtoolset.org/releases/" />
- </Target>
- <!--
- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Wix.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
-</Project> \ No newline at end of file
diff --git a/installer/installer.wxs b/installer/installer.wxs
deleted file mode 100644
index b2f22034..00000000
--- a/installer/installer.wxs
+++ /dev/null
@@ -1,66 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:difx='http://schemas.microsoft.com/wix/DifxAppExtension'>
- <Product Id="*" Name="WireGuard" Language="1033" Version="0.0.0.1" Manufacturer="WireGuard LLC" UpgradeCode="5e5a1da5-ba36-404d-92ec-41050d1c799c">
- <!-- TODO: uninstall before installing -->
- <Package InstallerVersion="200" Compressed="yes" Platform="x64" InstallScope="perMachine" Description="WireGuard: Fast, Modern, Secure VPN Tunnel" ReadOnly="yes" />
-
- <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." AllowDowngrades="no" IgnoreRemoveFailure="no" AllowSameVersionUpgrades="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="ARPNOREPAIR" Value="yes" />
- <Property Id="ARPNOMODIFY" Value="yes" />
- <Property Id="DISABLEADVTSHORTCUTS" Value="yes" />
-
- <Feature Id="WireGuardFeature" Title="WireGuard" Level="1">
- <ComponentGroupRef Id="WireGuardComponents" />
- </Feature>
- <Feature Id="WintunFeature" Title="Wintun" Level="1">
- <ComponentGroupRef Id="WintunComponents" />
- </Feature>
- </Product>
-
- <Fragment>
- <Directory Id="TARGETDIR" Name="SourceDir">
- <Directory Id="ProgramFiles64Folder">
- <Directory Id="INSTALLFOLDER" Name="WireGuard" />
- </Directory>
- <Directory Id="ProgramMenuFolder" Name="ProgramMenuFolder" />
- </Directory>
- </Fragment>
-
- <Fragment>
- <ComponentGroup Id="WireGuardComponents">
- <Component Directory="INSTALLFOLDER" Id="WireGuardExecutable" Win64="yes">
- <File Source="..\wireguard.exe" KeyPath="yes">
- <Shortcut Id="WireGuardStartMenuShortcut" Directory="ProgramMenuFolder" Name="WireGuard" Description="WireGuard: Fast, Modern, Secure VPN Tunnel" WorkingDirectory="INSTALLFOLDER" Advertise="yes" />
- </File>
- <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>
- </ComponentGroup>
-
- <ComponentGroup Id="WintunComponents">
- <Component Directory="INSTALLFOLDER" Id="WintunComponent" Guid="f84ff766-d154-44a3-9c50-371503f46ce6" Win64="yes" Shared="yes" SharedDllRefCount="yes">
- <!-- TODO: make sure we're installing the latest one. -->
- <difx:Driver DeleteFiles="yes" ForceInstall="yes" Legacy="yes" PlugAndPlayPrompt="no" AddRemovePrograms="no" /> <!-- TODO: Remove legacy once we start signing drivers. -->
- <!-- TODO: These should not end up staying in programfiles after the driver is installed. -->
- <File Source="..\wintun\x64\Release\wintun\wintun.inf" />
- <File Source="..\wintun\x64\Release\wintun\wintun.cat" />
- <File Source="..\wintun\x64\Release\wintun\wintun.sys" />
- </Component>
- </ComponentGroup>
-
- <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>
- <CustomAction Id="LaunchApplication" HideTarget="yes" Impersonate="no" Execute="deferred" FileKey="wireguard.exe" ExeCommand="" Return="asyncNoWait" />
-
- <!-- TODO: On uninstall remove system32\config\wireguard. -->
- <!-- TODO: On install and uninstall, kill services. -->
- </Fragment>
-</Wix>
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>