1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2025-11-12 03:18:26 -06:00

Windows: first implementation of MSI installer for silent mode deployment (ACCEPTLICENSE=YES must be set in msiexec command line)

This commit is contained in:
Mounir IDRASSI
2021-03-22 07:59:32 +01:00
parent bda0880453
commit ee79ff0579
37 changed files with 8713 additions and 52 deletions

View File

@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
<!--
First-time install dialog sequence:
- WixUI_WelcomeDlg
- WixUI_LicenseAgreementDlg
- WixUI_InstallDirDlg
- WixUI_VerifyReadyDlg
- WixUI_DiskCostDlg
Maintenance dialog sequence:
- WixUI_MaintenanceWelcomeDlg
- WixUI_MaintenanceTypeDlg
- WixUI_InstallDirDlg
- WixUI_VerifyReadyDlg
Patch dialog sequence:
- WixUI_WelcomeDlg
- WixUI_VerifyReadyDlg
-->
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<UI Id="Custom_InstallDir">
<TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
<TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
<TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
<Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
<Property Id="WixUI_Mode" Value="InstallDir" />
<DialogRef Id="BrowseDlg" />
<DialogRef Id="DiskCostDlg" />
<DialogRef Id="ErrorDlg" />
<DialogRef Id="FatalError" />
<DialogRef Id="FilesInUse" />
<DialogRef Id="MsiRMFilesInUse" />
<DialogRef Id="PrepareDlg" />
<DialogRef Id="ProgressDlg" />
<DialogRef Id="ResumeDlg" />
<DialogRef Id="UserExit" />
<Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath" Order="3">1</Publish>
<Publish Dialog="BrowseDlg" Control="OK" Event="SpawnDialog" Value="InvalidDirDlg" Order="4"><![CDATA[NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
<Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="LicenseAgreementDlg">NOT Installed</Publish>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">Installed AND PATCH</Publish>
<Publish Dialog="LicenseAgreementDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
<!-- When user clicks on Next, it means they accepted license, therefore we execute the CA SetAcceptLicense so that ACCEPTLICENSE is set to YES -->
<Publish Dialog="LicenseAgreementDlg" Control="Next" Event="DoAction" Value="SetAcceptLicense">1</Publish>
<Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="InstallDirAndOptionalShortcutsDlg">LicenseAccepted = "1"</Publish>
<Publish Dialog="InstallDirAndOptionalShortcutsDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
<Publish Dialog="InstallDirAndOptionalShortcutsDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
<Publish Dialog="InstallDirAndOptionalShortcutsDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath" Order="2">NOT WIXUI_DONTVALIDATEPATH</Publish>
<Publish Dialog="InstallDirAndOptionalShortcutsDlg" Control="Next" Event="SpawnDialog" Value="InvalidDirDlg" Order="3"><![CDATA[NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
<Publish Dialog="InstallDirAndOptionalShortcutsDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="4">WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID="1"</Publish>
<Publish Dialog="InstallDirAndOptionalShortcutsDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
<Publish Dialog="InstallDirAndOptionalShortcutsDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="InstallDirAndOptionalShortcutsDlg" Order="1">NOT Installed</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed AND NOT PATCH</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2">Installed AND PATCH</Publish>
<Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish>
<Property Id="ARPNOMODIFY" Value="1" />
</UI>
<UIRef Id="WixUI_Common" />
</Fragment>
</Wix>

View File

@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<UI>
<Dialog Id="InstallDirAndOptionalShortcutsDlg" Width="370" Height="270" Title="!(loc.InstallDirDlg_Title)">
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)" />
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" />
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
<Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
</Control>
<Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.CustomInstallDirDlgDescription)" />
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.InstallDirDlgTitle)" />
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.InstallDirDlgBannerBitmap)" />
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
<Control Id="FolderLabel" Type="Text" X="20" Y="60" Width="290" Height="30" NoPrefix="yes" Text="!(loc.InstallDirDlgFolderLabel)" />
<Control Id="Folder" Type="PathEdit" X="20" Y="100" Width="320" Height="18" Property="WIXUI_INSTALLDIR" Indirect="yes" />
<Control Id="ChangeFolder" Type="PushButton" X="20" Y="120" Width="56" Height="17" Text="!(loc.InstallDirDlgChange)" />
<Control Id="InstallForAllUsersCheckbox" Type="CheckBox"
X="20" Y="140" Width="200" Height="17"
Property="ALLUSERS" CheckBoxValue="1"
Text="!(loc.InstallForAllUsersDesc)" />
<Control Id="InstallDesktopShortcutCheckbox" Type="CheckBox"
X="20" Y="160" Width="200" Height="17"
Property="INSTALLDESKTOPSHORTCUT" CheckBoxValue="1"
Text="!(loc.CreateDesktopShortcutDesc)" />
<Control Id="InstallStartMenuShortcutCheckbox" Type="CheckBox"
X="20" Y="180" Width="200" Height="17"
Property="INSTALLSTARTMENUSHORTCUT" CheckBoxValue="1"
Text="!(loc.CreateStartMenuShortcutDesc)" />
<Control Id="AssociateVCFileExtensionCheckBox" Type="CheckBox"
X="20" Y="200" Width="200" Height="17"
Property="REGISTERVCFILEEXT" CheckBoxValue="1"
Text="!(loc.AssociateVCFileExtensionDesc)" />
</Dialog>
</UI>
</Fragment>
</Wix>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<WixLocalization Culture="en-us" Codepage="1252" xmlns="http://schemas.microsoft.com/wix/2006/localization">
<String Id="Lang" Overridable="yes">1033</String>
<String Id="NoDowngrade" Overridable="yes">A newer version is already installed</String>
<String Id="MinOs" Overridable="yes">This 32-bit installer can only run on at least Windows Vista</String>
<String Id="OSBitness" Overridable="yes">This is a 32-bit installer that cannot be run under 64-bit Windows</String>
<String Id="OS64Bitness" Overridable="yes">This is a 64-bit installer that cannot be run under 32-bit Windows</String>
<String Id="CustomInstallDirDlgDescription" Overridable="yes">Choose which options to enable then click Next to proceed.</String>
<String Id="InstallForAllUsersDesc" Overridable="yes">Install for all users</String>
<String Id="CreateDesktopShortcutDesc" Overridable="yes">Add VeraCrypt icon to desktop</String>
<String Id="CreateStartMenuShortcutDesc" Overridable="yes">Add VeraCrypt to Start Menu</String>
<String Id="AssociateVCFileExtensionDesc" Overridable="yes">Associate the .hc file extension with VeraCrypt</String>
<String Id="CloseVCFirstDesc" Overridable="yes">Please close all open VeraCrypt windows first.</String>
<String Id="AcceptVCLicenseDesc" Overridable="yes">Please accept the license agreement by passing ACCEPTLICENSE=YES during installation.</String>
<String Id="VeraCryptDesc" Overridable="yes">VeraCrypt</String>
<String Id="VeraCryptExpanderDesc" Overridable="yes">VeraCrypt Expander</String>
<String Id="VeraCryptWebsiteDesc" Overridable="yes">VeraCrypt Website</String>
</WixLocalization>

View File

@@ -0,0 +1,178 @@
::------------------------------------
::Define search paths here for Wix ToolSet and SDK (and SignTool optionnally)
::------------------------------------
@set SEARCH_WIX_PATH=C:\Program Files (x86)\WiX Toolset v3.11\bin
@set SEARCH_VC_DIR_PLATFORMSDK_1=C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86
@set SEARCH_VC_DIR_PLATFORMSDK_2=C:\Program Files (x86)\Windows Kits\10\bin\x86
@set SEARCH_VC_DIR_PLATFORMSDK_3=C:\Program Files\Microsoft Platform SDK\bin
@set SEARCH_VC_DIR_PLATFORMSDK_4=C:\Program Files (x86)\Windows Kits\8.1\bin\x86
@set SEARCH_VC_DIR_PLATFORMSDK_5=C:\Program Files (x86)\Windows Kits\8.0\bin\x86
@set SEARCH_VC_DIR_PLATFORMSDK_6=C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\bin
::end of search paths
set MSI_BUILDPATH=%~dp0
cd %MSI_BUILDPATH%
::------------------------------------
:: Look for msitran.exe and msidb.exe
::------------------------------------
@echo [INFO] Define default value for VC_DIR_PLATFORMSDK if not defined yet
@echo [INFO] Input VC_DIR_PLATFORMSDK=%VC_DIR_PLATFORMSDK%
@set FILE_TO_FIND="msitran.exe" "msidb.exe"
@echo [INFO] Looking for files: %FILE_TO_FIND%
@set FILE_NOT_FOUND=
@for %%i in (%FILE_TO_FIND%) do @if not exist "%VC_DIR_PLATFORMSDK%\%%~i" set FILE_NOT_FOUND=%%~i
@if "%FILE_NOT_FOUND%"=="" goto found_mssdk
@echo Not found in "%VC_DIR_PLATFORMSDK%"
@set VC_DIR_PLATFORMSDK=%SEARCH_VC_DIR_PLATFORMSDK_1%
@set FILE_NOT_FOUND=
@for %%i in (%FILE_TO_FIND%) do @if not exist "%VC_DIR_PLATFORMSDK%\%%~i" set FILE_NOT_FOUND=%%~i
@if "%FILE_NOT_FOUND%"=="" goto found_mssdk
@echo Not found in "%VC_DIR_PLATFORMSDK%"
@set VC_DIR_PLATFORMSDK=%SEARCH_VC_DIR_PLATFORMSDK_2%
@set FILE_NOT_FOUND=
@for %%i in (%FILE_TO_FIND%) do @if not exist "%VC_DIR_PLATFORMSDK%\%%~i" set FILE_NOT_FOUND=%%~i
@if "%FILE_NOT_FOUND%"=="" goto found_mssdk
@echo Not found in "%VC_DIR_PLATFORMSDK%"
@set VC_DIR_PLATFORMSDK=%SEARCH_VC_DIR_PLATFORMSDK_3%
@set FILE_NOT_FOUND=
@for %%i in (%FILE_TO_FIND%) do @if not exist "%VC_DIR_PLATFORMSDK%\%%~i" set FILE_NOT_FOUND=%%~i
@if "%FILE_NOT_FOUND%"=="" goto found_mssdk
@echo Not found in "%VC_DIR_PLATFORMSDK%"
@rem paths for Windows 8 SDK are slightly different
@set FILE_TO_FIND="msitran.exe" "msidb.exe"
@set VC_DIR_PLATFORMSDK=%SEARCH_VC_DIR_PLATFORMSDK_4%
@set FILE_NOT_FOUND=
@for %%i in (%FILE_TO_FIND%) do @if not exist "%VC_DIR_PLATFORMSDK%\%%~i" set FILE_NOT_FOUND=%%~i
@if "%FILE_NOT_FOUND%"=="" goto found_mssdk
@echo Not found in "%VC_DIR_PLATFORMSDK%"
@set VC_DIR_PLATFORMSDK=%SEARCH_VC_DIR_PLATFORMSDK_5%
@set FILE_NOT_FOUND=
@for %%i in (%FILE_TO_FIND%) do @if not exist "%VC_DIR_PLATFORMSDK%\%%~i" set FILE_NOT_FOUND=%%~i
@if "%FILE_NOT_FOUND%"=="" goto found_mssdk
@echo Not found in "%VC_DIR_PLATFORMSDK%"
@set VC_DIR_PLATFORMSDK=%SEARCH_VC_DIR_PLATFORMSDK_6%
@set FILE_NOT_FOUND=
@for %%i in (%FILE_TO_FIND%) do @if not exist "%VC_DIR_PLATFORMSDK%\%%~i" set FILE_NOT_FOUND=%%~i
@if "%FILE_NOT_FOUND%"=="" goto found_mssdk
@echo Not found in "%VC_DIR_PLATFORMSDK%"
@echo [ERROR] MS Platform SDK 2008, Windows SDK v7.1, or Windows SDK 8.0/8.1/10 could not be found
@echo If the path is not any of the above,
@echo please define VC_DIR_PLATFORMSDK environment variable.
@exit /B 1
:found_mssdk
@echo Found in "%VC_DIR_PLATFORMSDK%"
::------------------------------------
:: Look for candle.exe (and light.exe obviously)
::------------------------------------
@echo [INFO] Check if WiX is installed
@echo [INFO] Default value for VC_DIR_WIX is set to %WIX%
@set VC_DIR_WIX=%WIX%
@set FILE_TO_FIND="candle.exe"
@echo [INFO] Looking for files: %FILE_TO_FIND%
@set FILE_NOT_FOUND=
@for %%i in (%FILE_TO_FIND%) do @if not exist "%VC_DIR_WIX%\%%~i" set FILE_NOT_FOUND=%%~i
@if "%FILE_NOT_FOUND%"=="" goto found_wix
@echo Not found in "%VC_DIR_WIX%"
@set VC_DIR_WIX=%SEARCH_WIX_PATH%
@set FILE_NOT_FOUND=
@for %%i in (%FILE_TO_FIND%) do @if not exist "%VC_DIR_WIX%\%%~i" set FILE_NOT_FOUND=%%~i
@if "%FILE_NOT_FOUND%"=="" goto found_wix
@echo Not found in "%VC_DIR_WIX%"
@echo [ERROR] WiX could not be found
@echo Please install Wix3
@exit /B 1
:found_wix
@echo Found in "%VC_DIR_WIX%"
::------------------------------------
:: Create a MSI installer for each language
:: We make use of -sice:ICE09 to silence ICE09 warnings generated because we install non-permanent elements to 'SystemFolder'
::------------------------------------
@echo [INFO] Creating msi 64-bit installers
@echo [INFO] Making the en-us version in %cd%\out\64\en-us\
"%VC_DIR_WIX%\candle.exe" -dLang=en -arch x64 -ext WixUIExtension -ext WiXUtilExtension Product64.wxs -out out\64\en-us\Product.wixobj
@if NOT "%ERRORLEVEL%" == "0" goto msi_failed
"%VC_DIR_WIX%\candle.exe" -dLang=en -arch x64 -ext WixUIExtension -ext WiXUtilExtension Custom_InstallDir.wxs -out out\64\en-us\Custom_InstallDir.wixobj
@if NOT "%ERRORLEVEL%" == "0" goto msi_failed
"%VC_DIR_WIX%\candle.exe" -dLang=en -arch x64 -ext WixUIExtension -ext WiXUtilExtension Custom_InstallDirDlg.wxs -out out\64\en-us\Custom_InstallDirDlg.wixobj
@if NOT "%ERRORLEVEL%" == "0" goto msi_failed
"%VC_DIR_WIX%\Light.exe" -ext WixUIExtension -ext WiXUtilExtension -cultures:en-us -loc Strings-en.wxl out\64\en-us\Product.wixobj out\64\en-us\Custom_InstallDirDlg.wixobj out\64\en-us\Custom_InstallDir.wixobj -out out\64\en-us\VeraCrypt_%1_Setup_en-us.msi -pdbout out\64\en-us\VeraCrypt_%1_Setup_en-us.wixpdb -sice:ICE09
@if NOT "%ERRORLEVEL%" == "0" goto msi_failed
::------------------------------------
:: Join the language specific MSIs together
::------------------------------------
@echo [INFO] Joining msi 64-bit installers into 1 64-bit installer
@set OUT_PATH=%cd%\out\64\
@echo [INFO] OUT_PATH=%OUT_PATH%
@set MSI_FILE_IN=VeraCrypt_%1_Setup
@set MSI_FILE_OUT=VeraCrypt_%1_Setup_x64
:: Check if all the MSI files were built
@set LANG=en-us
@IF NOT EXIST "%OUT_PATH%\%LANG%\%MSI_FILE_IN%_%LANG%.msi" goto NOT_%LANG%
:: Take all the MSI files and process
@set LANG=en-us
@copy /Y "%OUT_PATH%\%LANG%\%MSI_FILE_IN%_%LANG%.msi" "%OUT_PATH%\%MSI_FILE_OUT%.msi"
::------------------------------------
:: Add all available LCIDs
::------------------------------------
"%VC_DIR_PLATFORMSDK%\MsiInfo.Exe" "%OUT_PATH%\%MSI_FILE_OUT%.msi" /p x64;1033
@if NOT "%ERRORLEVEL%" == "0" goto comb_msi_failed
::------------------------------------
:: Copy to bin and remove out
::------------------------------------
mkdir bin
@copy /Y "%OUT_PATH%\%MSI_FILE_OUT%.msi" "%cd%\bin\%MSI_FILE_OUT%.msi"
@set LANG=en-us
@copy /Y "%OUT_PATH%\%LANG%\%MSI_FILE_IN%_%LANG%.msi" "%cd%\bin\%MSI_FILE_IN%_x64_%LANG%.msi"
@rmdir /S /Q "%cd%\out"
goto END
:msi_failed
@echo [ERR ] failed to create the MSI
@exit /B 1
:comb_msi_failed
@echo [ERR ] failed to combine the language specific MSI's
@exit /B 1
:NOT_en-us
@echo [ERR ] Missing file '%OUT_PATH%\%LANG%\%MSI_FILE_IN%_%LANG%.msi'
@exit /B 1
:NOT_lv-lv
@echo [ERR ] Missing file '%OUT_PATH%\%LANG%\%MSI_FILE_IN%_%LANG%.msi'
@exit /B 1
@echo [INFO] Done creating multi-lang msi installers
:END
@echo end