From 9c48c520442b887978eb0c0f9c255e550431c6e6 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Wed, 24 Apr 2019 14:52:16 +0200 Subject: 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 --- installer/.editorconfig | 2 + installer/.gitignore | 7 +++ installer/build.bat | 63 +++++++++++++++++++++++ installer/installer.wixproj | 49 ------------------ installer/installer.wxs | 66 ------------------------ installer/wireguard.wxs | 121 ++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 193 insertions(+), 115 deletions(-) create mode 100644 installer/.editorconfig create mode 100644 installer/.gitignore create mode 100644 installer/build.bat delete mode 100644 installer/installer.wixproj delete mode 100644 installer/installer.wxs create mode 100644 installer/wireguard.wxs 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 @@ - - - - Debug - x86 - 3.10 - 6ccfa606-8048-4502-86ea-e88027abfb15 - 2.0 - installer - Package - - - bin\$(Configuration)\ - obj\$(Configuration)\ - Debug - - - bin\$(Configuration)\ - obj\$(Configuration)\ - - - - - - - $(WixExtDir)\WixDifxAppExtension.dll - WixDifxAppExtension - - - - - $(WixExtDir)\difxapp_x64.wixlib - difxapp_x64 - - - - - - - - - \ 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 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - NOT Installed - - - - - - - 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + NOT Installed + + + + + + -- cgit v1.2.3-59-g8ed1b