Skip to content

Building the msi package

Anjan Nath edited this page Jun 24, 2021 · 4 revisions

Requirements

  1. Windows box with make and git installed. (the msi can only be built on a windows machine since it uses wixtoolset. not tested on other platforms!)
  2. powerhshell core is installed (Makefile targets for msi makes use of pwsh)
  3. WixTool Set is installed
  4. The Hyperv bundle that needs to be in the msi

How to build

Following commands are tested in PowerShell, PowerShell Core and Cygwin

  • To build the msi run: make BUNDLE_DIR=<path_to_dir_containing_hyperv_bundle> out/windows-amd64/crc-windows-amd64.msi
  • To build the zip archive (release artifact) run: make BUNDLE_DIR=<path_to_dir_containing_hyperv_bundle> out/windows-amd64/crc-windows-installer.zip

For testing purposes the msi can be built without including the bundle using make MOCK_BUNDLE=true BUNDLE_DIR=./ out/windows-amd64/crc-windows-amd64.msi

Build process

The msi is built using the candle.exe and light.exe tools provided by the wixtoolset, the product.wxs.in file is the main wxs file that describe the msi product, among other things it mentions the files that needs to be put in C:\Program Files\CodeReady Containers, the LicenseAgreementDlg_HK.wxs and WixUI_HK.wxs files respectively describe the look of the license agreement dialog and the overall installer flow. These boilerplate files were first obtained by using mh-cbon/go-msi and later modifying them to our need.

We include crc-admin-helper, crc-tray, and crc_hyperv bundle in the msi, these files are converted to cab archives during the msi build process by light.exe. (Note: there's a limit to how big a cab file can be, therefore we split the hyperv bundle into chunks of 1GB using the code at split.go)

Finally after the msi is built, we package the cab files and msi together in a zip file, the Makefile target out/windows-amd64/crc-installer-windows.zip generates the final releasable artifact which can be found in the folder out/windows-amd64/.

Resources