From 504375477cd2b08f56c0f3e2f744c4705b685aab Mon Sep 17 00:00:00 2001 From: Mario Loriedo Date: Thu, 27 Jun 2024 15:02:48 +0200 Subject: [PATCH 1/2] WiX bundle update to support v5 --- .gitignore | 6 +- build_windows.md | 43 +++-- contrib/win-installer/Package.en-us.wxl | 8 - contrib/win-installer/build-burn.bat | 7 - contrib/win-installer/build.ps1 | 14 +- contrib/win-installer/burn.wxs | 37 ++++ contrib/win-installer/podman-setup.wixproj | 12 ++ contrib/win-installer/podman-theme.wxl | 20 ++- contrib/win-installer/podman-theme.xml | 194 ++++++++++++--------- contrib/win-installer/podman.wixproj | 8 +- contrib/win-installer/podman.wxs | 2 +- contrib/win-installer/process-release.ps1 | 6 +- 12 files changed, 223 insertions(+), 134 deletions(-) delete mode 100644 contrib/win-installer/Package.en-us.wxl delete mode 100644 contrib/win-installer/build-burn.bat create mode 100644 contrib/win-installer/burn.wxs create mode 100644 contrib/win-installer/podman-setup.wixproj diff --git a/.gitignore b/.gitignore index 7ea6620913d0..9b96a7d032f2 100644 --- a/.gitignore +++ b/.gitignore @@ -35,6 +35,7 @@ release.txt /test/copyimg/copyimg /test/goecho/goecho /test/version/version +/test/version/version.exe /test/testvol/testvol /test/tools/build /test/e2e/ginkgo-node-* @@ -45,12 +46,13 @@ result /*runner_stats.log .generate-bindings contrib/win-installer/artifacts/ +contrib/win-installer/current/ contrib/win-installer/docs/ +contrib/win-installer/en-US/ contrib/win-installer/fetch/ -contrib/win-installer/podman.msi contrib/win-installer/podman-*setup.exe contrib/win-installer/engine.exe +contrib/win-installer/obj/ contrib/win-installer/shasums -contrib/win-installer/pages.wxs contrib/win-installer/*.wixobj contrib/win-installer/*.wixpdb diff --git a/build_windows.md b/build_windows.md index 5a93faca7b13..820fb47b5513 100644 --- a/build_windows.md +++ b/build_windows.md @@ -10,7 +10,7 @@ Windows. - [OS requirements](#os-requirements) - [Git and go](#git-and-go) - [Pandoc](#pandoc) - - [WiX Toolset v3](#wix-toolset-v3) + - [.NET SDK](#.net-sdk) - [Virtualization Provider](#virtualization-provider) - [WSL](#wsl) - [Hyper-V](#hyper-v) @@ -70,14 +70,22 @@ Pandoc can be installed from https://pandoc.org/installing.html. When performing the Pandoc installation one, has to choose the option "Install for all users" (to put the binaries into "Program Files" directory). -### WiX Toolset v3 +### .NET SDK -[WiX Toolset](https://wixtoolset.org) **v3** is used to develop and build the -Podman Windows installer. It's not required for the Podman Windows client. -Version 3 of the WiX Toolset can be obtained from -https://wixtoolset.org/docs/wix3/. Installing it into a clean VM might require -an additional installation of .NET Framework 3.5 in advance -([instructions for adding .NET Framework 3.5 via enabling the Windows feature](https://learn.microsoft.com/en-us/dotnet/framework/install/dotnet-35-windows#enable-the-net-framework-35-in-control-panel)) +[.NET SDK](https://learn.microsoft.com/en-us/dotnet/core/sdk), version 6 or +later, is required to develop and build the Podman Windows installer. It's not +required for the Podman Windows client. + +```pwsh +winget install -e Microsoft.DotNet.SDK.8 +``` + +[WiX Toolset](https://wixtoolset.org) **v5**, distributed as a .NET SDK tool, is +used too and can be installed using `dotnet install`: + +```pwsh +dotnet tool install --global wix +``` ### Virtualization Provider @@ -304,9 +312,9 @@ The `installer` target of `winmake.ps1` runs the script - `build-hooks.bat`: builds `podman-wslkerninst.exe` (WSL kernel installer) and `podman-msihooks.dll` (helper that checks if WSL and Hyper-V are installed). -- `build-msi.bat`: builds `podman.msi` from the WiX source files `podman.wxs`, +- `dotnet build podman.wixproj`: builds `podman.msi` from the WiX source files `podman.wxs`, `pages.wxs`, `podman-ui.wxs` and `welcome-install-dlg.wxs`. -- `build-burn.bat`: builds `podman-setup.exe` file from +- `dotnet build podman-setup.wixproj`: builds `podman-setup.exe` file from [WiX Burn bundle](https://wixtoolset.org/docs/tools/burn/) `burn.wxs`. ### Test the Windows installer @@ -340,21 +348,20 @@ Podman is released (it's included in the `podman-setup.exe` bundle), it can be faster to build and test that rather than the full bundle during the development phase. -Run the script `contrib\win-installer\build-msi.bat` to build the standalone -`podman.msi` file: +Run the command `dotnet build` to build the standalone `podman.msi` file: ```pwsh Push-Location .\contrib\win-installer\ -.\build-msi.bat 9.9.9 +dotnet build podman.wixproj /property:DefineConstants="VERSION=9.9.9" -o . Pop-Location ``` -It creates the file `.\contrib\win-installer\podman.msi`. Test it using the +It creates the file `.\contrib\win-installer\en-US\podman.msi`. Test it using the [Microsoft Standard Installer](https://learn.microsoft.com/en-us/windows/win32/msi/standard-installer-command-line-options) command line tool: ```pwsh -msiexec /package contrib\win-installer\podman.msi /l*v podman-msi.log +msiexec /package contrib\win-installer\en-US\podman.msi /l*v podman-msi.log ``` To run it in quiet, non-interactive mode, open the terminal **as an @@ -364,7 +371,7 @@ of the installation, `0` otherwise) and `WITH_HYPERV` (`1` to install Hyper-V as part of the installation, `0` otherwise): ```pwsh -msiexec /package contrib\win-installer\podman.msi /l*v podman-msi.log /quiet MACHINE_PROVIDER=wsl WITH_WSL=0 WITH_HYPERV=0 +msiexec /package contrib\win-installer\en-US\podman.msi /l*v podman-msi.log /quiet MACHINE_PROVIDER=wsl WITH_WSL=0 WITH_HYPERV=0 ``` :information_source: `podman.msi` GUI dialogs, defined in the file @@ -390,12 +397,12 @@ Test-Path -Path "$ENV:PROGRAMFILES\RedHat\Podman\podman.exe" # Check the generation of the podman configuration file Test-Path -Path "$ENV:PROGRAMDATA\containers\containers.conf.d\99-podman-machine-provider.conf" # Check that the installer configured the right provider -Get-Content '$ENV:PROGRAMDATA\containers\containers.conf.d\99-podman-machine-provider.conf' | Select -Skip 1 | ConvertFrom-StringData | % { $_.provider } +Get-Content "$ENV:PROGRAMDATA\containers\containers.conf.d\99-podman-machine-provider.conf" | Select -Skip 1 | ConvertFrom-StringData | % { $_.provider } # Check the creation of the registry key Test-Path -Path "HKLM:\SOFTWARE\Red Hat\Podman" Get-ItemProperty "HKLM:\SOFTWARE\Red Hat\Podman" InstallDir # Check the podman.exe is in the $PATH -$env:PATH | Select-String -Pattern "$ENV:PROGRAMFILES\RedHat\Podman" +$env:PATH | Select-String -Pattern "Podman" ``` :information_source: Podman CI uses script diff --git a/contrib/win-installer/Package.en-us.wxl b/contrib/win-installer/Package.en-us.wxl deleted file mode 100644 index decaa7c1daf5..000000000000 --- a/contrib/win-installer/Package.en-us.wxl +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - diff --git a/contrib/win-installer/build-burn.bat b/contrib/win-installer/build-burn.bat deleted file mode 100644 index 637a4e74444f..000000000000 --- a/contrib/win-installer/build-burn.bat +++ /dev/null @@ -1,7 +0,0 @@ -@if "%1" == "" ( - @echo "usage: build-burn.bat " - @exit /b 1 -) - -candle -ext WixUIExtension -ext WixUtilExtension -ext WixBalExtension -arch x64 -dManSource="docs" -dVERSION="%1" burn.wxs || exit /b 1 -light -ext WixUIExtension -ext WixUtilExtension -ext WixBalExtension .\burn.wixobj -out podman-setup.exe || exit /b 1 diff --git a/contrib/win-installer/build.ps1 b/contrib/win-installer/build.ps1 index 34c7b8b06b64..089bdc4c5de1 100644 --- a/contrib/win-installer/build.ps1 +++ b/contrib/win-installer/build.ps1 @@ -151,16 +151,18 @@ if ($gvExists) { # } else { # $env:IncludePolicyJSON = "Skip" # } -& 'C:\Program Files\dotnet\dotnet.exe' build podman.wixproj --property:VERSION=$ENV:INSTVER -o .; ExitOnError -Move-Item -Path .\en-US\podman.msi -Destination .\podman.msi -SignItem @("podman.msi") +if (Test-Path ./obj) { + Remove-Item ./obj -Recurse -Force -Confirm:$false +} +& 'C:\Program Files\dotnet\dotnet.exe' build podman.wixproj /property:DefineConstants="VERSION=$ENV:INSTVER" -o .; ExitOnError +SignItem @("en-US\podman.msi") -.\build-burn.bat $ENV:INSTVER; ExitOnError -insignia -ib podman-setup.exe -o engine.exe; ExitOnError +dotnet build podman-setup.wixproj /property:DefineConstants="VERSION=$ENV:INSTVER" -o .; ExitOnError +wix burn detach podman-setup.exe -engine engine.exe; ExitOnError SignItem @("engine.exe") $file = "podman-$version$suffix-setup.exe" -insignia -ab engine.exe podman-setup.exe -o $file; ExitOnError +wix burn reattach -engine engine.exe podman-setup.exe -o $file; ExitOnError SignItem @("$file") if (Test-Path -Path shasums) { diff --git a/contrib/win-installer/burn.wxs b/contrib/win-installer/burn.wxs new file mode 100644 index 000000000000..c57b7da885f9 --- /dev/null +++ b/contrib/win-installer/burn.wxs @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/contrib/win-installer/podman-setup.wixproj b/contrib/win-installer/podman-setup.wixproj new file mode 100644 index 000000000000..ed35c3385636 --- /dev/null +++ b/contrib/win-installer/podman-setup.wixproj @@ -0,0 +1,12 @@ + + + x64 + false + Bundle + + + + + + + diff --git a/contrib/win-installer/podman-theme.wxl b/contrib/win-installer/podman-theme.wxl index 5b958d803979..29fff880ed65 100644 --- a/contrib/win-installer/podman-theme.wxl +++ b/contrib/win-installer/podman-theme.wxl @@ -1,3 +1,4 @@ + @@ -5,14 +6,25 @@ - + - + - + @@ -42,7 +54,7 @@ - + diff --git a/contrib/win-installer/podman-theme.xml b/contrib/win-installer/podman-theme.xml index 1ffbb5f04048..db5d831453cb 100644 --- a/contrib/win-installer/podman-theme.xml +++ b/contrib/win-installer/podman-theme.xml @@ -1,8 +1,8 @@ + - #(loc.Title) Setup Segoe UI Segoe UI Segoe UI @@ -12,85 +12,121 @@ Segoe UI Segoe UI - - - - #(loc.HelpHeader) - #(loc.HelpText) - - - - - #(loc.InstallHeader) - #(loc.InstallMessage) + + + + + + + + + + + + + #(loc.InstallLicenseLinkText) + + Install WSL if not present + + + + + + + + + + + + - #(loc.InstallLicenseLinkText) - #(loc.InstallVersion) - Install WSL if not present - - - - - - - #(loc.OptionsHeader) - #(loc.OptionsLocationLabel) - - + + + + + + - - - - - - #(loc.FilesInUseHeader) - #(loc.FilesInUseLabel) - + + - - - - - - - - - #(loc.ProgressHeader) - #(loc.ProgressLabel) - #(loc.OverallProgressPackageText) - - - - - #(loc.Title) - - #(loc.ModifyHeader) - - - - - - #(loc.Title) - - #(loc.SuccessHeader) - #(loc.SuccessInstallHeader) - #(loc.SuccessRepairHeader) - #(loc.SuccessUninstallHeader) - - #(loc.SuccessRestartText) - - - - - - #(loc.FailureHeader) - #(loc.FailureInstallHeader) - #(loc.FailureUninstallHeader) - #(loc.FailureRepairHeader) - #(loc.FailureHyperlinkLogText) - - #(loc.FailureRestartText) - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #(loc.FailureHyperlinkLogText) + + + + + + diff --git a/contrib/win-installer/podman.wixproj b/contrib/win-installer/podman.wixproj index a36581e3e3a3..7bccb56ffb5e 100644 --- a/contrib/win-installer/podman.wixproj +++ b/contrib/win-installer/podman.wixproj @@ -1,7 +1,7 @@ - VERSION=$(VERSION) x64 + false @@ -10,16 +10,12 @@ true + - - - - - diff --git a/contrib/win-installer/podman.wxs b/contrib/win-installer/podman.wxs index a606f2faa075..065797891916 100644 --- a/contrib/win-installer/podman.wxs +++ b/contrib/win-installer/podman.wxs @@ -12,7 +12,7 @@ - + diff --git a/contrib/win-installer/process-release.ps1 b/contrib/win-installer/process-release.ps1 index 230ad7a43b90..539283163258 100644 --- a/contrib/win-installer/process-release.ps1 +++ b/contrib/win-installer/process-release.ps1 @@ -111,11 +111,11 @@ try { } Write-Host "Old release, zip does not include win-sshproxy.exe, fetching via msi" DownloadOrSkip "$base_url/releases/download/$version/podman-$version.msi" "podman.msi" - dark -x expand ./podman.msi + wix msi decompile -x expand ./podman.msi if (!$?) { - throw "Dark command failed" + throw "wix msi decompile command failed" } - $loc = Get-ChildItem -Recurse -Path expand -Name 4A2AD125-34E7-4BD8-BE28-B2A9A5EDBEB5 + $loc = Get-ChildItem -Recurse -Path expand -Name WinSshProxyExecutableFile if (!$loc) { throw "Could not obtain win-sshproxy.exe" } From a915b097b4531905bd4d59f4a2018ce29532cd10 Mon Sep 17 00:00:00 2001 From: Mario Loriedo Date: Thu, 27 Jun 2024 15:31:39 +0200 Subject: [PATCH 2/2] Fixup Signed-off-by: Mario Loriedo --- build_windows.md | 2 +- contrib/win-installer/burn.wxs | 2 +- contrib/win-installer/podman-setup.wixproj | 2 +- contrib/win-installer/podman-theme.wxl | 2 +- contrib/win-installer/podman-theme.xml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build_windows.md b/build_windows.md index 820fb47b5513..e523e62ffce6 100644 --- a/build_windows.md +++ b/build_windows.md @@ -10,7 +10,7 @@ Windows. - [OS requirements](#os-requirements) - [Git and go](#git-and-go) - [Pandoc](#pandoc) - - [.NET SDK](#.net-sdk) + - [.NET SDK](#net-sdk) - [Virtualization Provider](#virtualization-provider) - [WSL](#wsl) - [Hyper-V](#hyper-v) diff --git a/contrib/win-installer/burn.wxs b/contrib/win-installer/burn.wxs index c57b7da885f9..0ac25a91008a 100644 --- a/contrib/win-installer/burn.wxs +++ b/contrib/win-installer/burn.wxs @@ -1,4 +1,4 @@ - + diff --git a/contrib/win-installer/podman-setup.wixproj b/contrib/win-installer/podman-setup.wixproj index ed35c3385636..361873a26c6d 100644 --- a/contrib/win-installer/podman-setup.wixproj +++ b/contrib/win-installer/podman-setup.wixproj @@ -1,4 +1,4 @@ - + x64 false diff --git a/contrib/win-installer/podman-theme.wxl b/contrib/win-installer/podman-theme.wxl index 29fff880ed65..3b41284b22f9 100644 --- a/contrib/win-installer/podman-theme.wxl +++ b/contrib/win-installer/podman-theme.wxl @@ -1,4 +1,4 @@ - + diff --git a/contrib/win-installer/podman-theme.xml b/contrib/win-installer/podman-theme.xml index db5d831453cb..c7f9e80cbe74 100644 --- a/contrib/win-installer/podman-theme.xml +++ b/contrib/win-installer/podman-theme.xml @@ -1,4 +1,4 @@ - +