Skip to content

Commit

Permalink
Merge pull request #25237 from l0rd/stop-automatic-wsl-hyperv-install…
Browse files Browse the repository at this point in the history
…ation

Remove the option to install WSL/HyperV on Windows
  • Loading branch information
openshift-merge-bot[bot] authored Feb 10, 2025
2 parents 3967ac2 + 91e4f69 commit 7185d46
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 66 deletions.
15 changes: 5 additions & 10 deletions build_windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -356,15 +356,12 @@ which include detailed installation information, in the current directory.

Run it in `quiet` mode to automate the installation and avoid interacting with
the GUI. Open the terminal **as an administrator**, add the `/quiet` option, and
set the bundle variables `MachineProvider` (`wsl` or `hyperv`), `WSLCheckbox`
(`1` to install WSL as part of the installation, `0` otherwise), and
`HyperVCheckbox` (`1` to install Hyper-V as part of the installation, `0`
otherwise):
set the bundle variable `MachineProvider` (`wsl` or `hyperv`):

```pwsh
contrib\win-installer\podman-5.1.0-dev-setup.exe /install `
/log podman-setup.log /quiet `
MachineProvider=wsl WSLCheckbox=0 HyperVCheckbox=0
MachineProvider=wsl
```

:information_source: If uninstallation fails, the installer may end up in an
Expand Down Expand Up @@ -418,13 +415,11 @@ 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
administrator**, add the `/quiet` option, and set the MSI properties
`MACHINE_PROVIDER` (`wsl` or `hyperv`), `WITH_WSL` (`1` to install WSL as part
of the installation, `0` otherwise) and `WITH_HYPERV` (`1` to install Hyper-V as
part of the installation, `0` otherwise):
administrator**, add the `/quiet` option, and set the MSI property
`MACHINE_PROVIDER` (`wsl` or `hyperv`):

```pwsh
msiexec /package contrib\win-installer\en-US\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
```

:information_source: `podman.msi` GUI dialogs, defined in the file
Expand Down
5 changes: 0 additions & 5 deletions contrib/win-installer/burn.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
<Variable Name="InstallFolder" Type="formatted" Value="[ProgramFiles64Folder]RedHat\Podman" bal:Overridable="yes" />
<Variable Name="VERSION" Value="$(var.VERSION)" />
<Variable Name="MachineProvider" Type="string" Value="wsl" bal:Overridable="yes" />
<Variable Name="WSLCheckbox" Type="numeric" Value="0" bal:Overridable="yes" />
<Variable Name="HyperVCheckbox" Type="numeric" Value="0" bal:Overridable="yes" />
<Variable Name="AllowOldWin" Type="numeric" Value="0" bal:Overridable="yes" />
<Variable Name="LaunchTarget" Value="explorer.exe" />
<Variable Name="LaunchArguments" Value="&quot;[InstallFolder]\podman-for-windows.html&quot;" />
Expand All @@ -31,11 +29,8 @@
<MsiPackage Id="Setup" SourceFile="en-US\podman.msi" Vital="yes">
<MsiProperty Name="INSTALLDIR" Value="[InstallFolder]" />
<MsiProperty Name="MACHINE_PROVIDER" Value="[MachineProvider]" />
<MsiProperty Name="WITH_WSL" Value="[WSLCheckbox]" />
<MsiProperty Name="WITH_HYPERV" Value="[HyperVCheckbox]" />
<MsiProperty Name="SKIP_CONFIG_FILE_CREATION" Value="[SkipConfigFileCreation]" />
</MsiPackage>
<ExePackage DisplayName="WSL Kernel Install" InstallCondition="(MachineProvider = &quot;wsl&quot;) AND (WSLCheckbox = 1) AND (NOT PreviousInstallFolder)" SourceFile="artifacts\podman-wslkerninst.exe" DetectCondition="" Permanent="true" />
</Chain>
<OptionalUpdateRegistration />
</Bundle>
Expand Down
4 changes: 1 addition & 3 deletions contrib/win-installer/podman-theme.wxl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<String Id="InstallMessage" Value="Welcome to the [WixBundleName] [VERSION] setup wizard. This will install [WixBundleName] on your computer." />
<String Id="ProvidersMessage" Value="Additionally, you have the option to select the virtualization provider required by Podman: WSLv2 or Hyper-V.
You can choose to also install the virtualization provider if it is not already enabled. This operation requires a reboot during the installation process. Alternatively, you can deselect the checkbox, and install the virtualization provider manually.
If it's not already installed, you will have to install the virtualization provider manually.
Finally, click install to continue, or Close to abort the installation." />
<String Id="InstallVersion" Value="Version [WixBundleVersion]" />
Expand All @@ -27,8 +27,6 @@ Finally, click install to continue, or Close to abort the installation." />
<String Id="HelpCloseButton" Value="&amp;Close" />
<String Id="InstallLicenseLinkText" Value='[WixBundleName] &lt;a href="#"&gt;license terms&lt;/a&gt;.' />
<String Id="InstallAcceptCheckbox" Value="I &amp;agree to the license terms and conditions" />
<String Id="InstallWSLCheckbox" Value="&amp;Install WSLv2 if not present" />
<String Id="InstallHypervCheckbox" Value="&amp;Install Hyper-V if not present" />
<String Id="InstallInstallButton" Value="&amp;Install" />
<String Id="InstallCancelButton" Value="&amp;Close" />
<String Id="OptionsHeader" Value="Setup Options" />
Expand Down
2 changes: 0 additions & 2 deletions contrib/win-installer/podman-theme.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
</RadioButtons>
<Hypertext Name="EulaHyperlink" X="185" Y="-111" Width="-11" Height="17" TabStop="yes" FontId="3" HideWhenDisabled="yes">#(loc.InstallLicenseLinkText)</Hypertext>
<Label Name="InstallVersion" X="510" Y="-50" Width="-11" Height="17" FontId="3" DisablePrefix="yes" VisibleCondition="WixStdBAShowVersion">#(loc.InstallVersion)</Label>
<Checkbox Name="WSLCheckbox" VisibleCondition="(MachineProvider = &quot;wsl&quot;) AND (NOT PreviousInstallFolder)" X="185" Y="320" Width="-11" Height="17" TabStop="yes" FontId="6" HideWhenDisabled="yes">#(loc.InstallWSLCheckbox)</Checkbox>
<Checkbox Name="HyperVCheckbox" VisibleCondition="(MachineProvider = &quot;hyperv&quot;) AND (NOT PreviousInstallFolder)" X="185" Y="320" Width="-11" Height="17" TabStop="yes" FontId="6" HideWhenDisabled="yes">#(loc.InstallHypervCheckbox)</Checkbox>
<Button Name="OptionsButton" X="-171" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0" VisibleCondition="NOT WixStdBASuppressOptionsUI">
<Text>#(loc.InstallOptionsButton)</Text>
<ChangePageAction Page="Options" />
Expand Down
36 changes: 2 additions & 34 deletions contrib/win-installer/podman.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,6 @@
</DirectorySearch>
</Property>

<!--
Property WSL_INSTALL is set at runtime and used as the condition to run the `WSLFeatureComponent` Component:
WSL is installed only if all these conditions are met:
- WSL isn't already installed
- The user has set property `MACHINE_PROVIDER` to "wsl"
- The user hasn't set property `WITH_WSL` to 0
-->
<SetProperty Id="WSL_INSTALL" Before="AppSearch" Value="1" Sequence="first" Condition="(HAS_WSLFEATURE = 0) AND (MACHINE_PROVIDER = &quot;wsl&quot;) AND (NOT (WITH_WSL = 0))" />
<!--
Property HYPERV_INSTALL is set at runtime and used as the condition to run the `HyperVFeatureComponent` Component:
HyperV is installed only if all these conditions are met:
- HyperV isn't already installed
- The user has set property `MACHINE_PROVIDER` to "hyperv"
- The user hasn't set property `WITH_HYPERV` to 0
-->
<SetProperty Id="HYPERV_INSTALL" Before="AppSearch" Value="1" Sequence="first" Condition="(HAS_HYPERVFEATURE = 0) AND (MACHINE_PROVIDER = &quot;hyperv&quot;) AND (NOT (WITH_HYPERV = 0))" />
<!--
Property CREATE_MACHINE_PROVIDER_CONFIG_FILE is set at runtime and used as the condition to run the `MachineProviderConfigFile` Component:
The machine provider config file is created (or is not deleted if it already exist) if these conditions are met:
Expand All @@ -71,19 +55,6 @@
<CustomAction Id="CheckWSL" Execute="firstSequence" DllEntry="CheckWSL" BinaryRef="PodmanHooks" />
<CustomAction Id="CheckHyperV" Execute="firstSequence" DllEntry="CheckHyperV" BinaryRef="PodmanHooks" />
<util:BroadcastEnvironmentChange />
<ComponentGroup Id="WSLFeature" Directory="INSTALLDIR">
<Component Id="WSLFeatureComponent" Guid="F6A693BC-186C-4E64-8015-C3073013B3A8" Condition="(NOT Installed) AND (WSL_INSTALL = 1)">
<CreateFolder />
<PanelSW:Dism EnableFeature="VirtualMachinePlatform" ErrorHandling="prompt" />
<PanelSW:Dism EnableFeature="Microsoft-Windows-Subsystem-Linux" ErrorHandling="prompt" />
</Component>
</ComponentGroup>
<ComponentGroup Id="HyperVFeature" Directory="INSTALLDIR">
<Component Id="HyperVFeatureComponent" Guid="F7B2D4C9-6C89-46BB-B4EA-FF39424972F3" Condition="(NOT Installed) AND (HYPERV_INSTALL = 1)">
<CreateFolder />
<PanelSW:Dism EnableFeature="Microsoft-Hyper-V" ErrorHandling="prompt" />
</Component>
</ComponentGroup>
<Feature Id="Complete" Level="1">
<ComponentRef Id="INSTALLDIR_Component" />
<ComponentRef Id="EnvEntriesComponent" />
Expand All @@ -94,8 +65,6 @@
<?endif?>
<ComponentRef Id="GuideHTMLComponent" />
<ComponentGroupRef Id="ManFiles" />
<ComponentGroupRef Id="WSLFeature" />
<ComponentGroupRef Id="HyperVFeature" />
</Feature>
<Feature Id="MachineProviderConfig" Level="1">
<ComponentRef Id="MachineProviderConfigFile" />
Expand All @@ -114,9 +83,8 @@
</UI>

<InstallExecuteSequence>
<Custom Action="CheckWSL" Before="SetWSL_INSTALL" />
<Custom Action="CheckHyperV" Before="SetHYPERV_INSTALL" />
<ForceReboot After="DismX86" Condition="(NOT Installed) AND (NOT UpdateStarted) AND (NOT BURNMSIUNINSTALL) AND ((WSL_INSTALL = 1) OR (HYPERV_INSTALL = 1)) AND (NOT AFTERREBOOT)" />
<Custom Action="CheckWSL" Before="InstallFiles" />
<Custom Action="CheckHyperV" Before="InstallFiles" />
</InstallExecuteSequence>
<Binary Id="PodmanHooks" SourceFile="artifacts/podman-msihooks.dll" />

Expand Down
9 changes: 1 addition & 8 deletions contrib/win-installer/test-installer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
# .\winmake.ps1 installer 9.9.9 &&
# .\contrib\win-installer\test-installer.ps1 `
# -scenario all `
# -previousSetupExePath ".\contrib\win-installer\podman-5.3.0-dev-setup.exe" `
# -setupExePath ".\contrib\win-installer\podman-5.4.0-dev-setup.exe" `
# -nextSetupExePath ".\contrib\win-installer\podman-9.9.9-dev-setup.exe" `
# -provider hyperv
Expand All @@ -32,8 +31,6 @@ param (
[string]$nextSetupExePath,
[ValidateSet("wsl", "hyperv")]
[string]$provider="wsl",
[switch]$installWSL=$false,
[switch]$installHyperV=$false,
[switch]$skipWinVersionCheck=$false,
[switch]$skipConfigFileCreation=$false
)
Expand All @@ -53,19 +50,15 @@ function Install-Podman {
[ValidateScript({Test-Path $_ -PathType Leaf})]
[string]$setupExePath
)
if ($installWSL) {$wslCheckboxVar = "1"} else {$wslCheckboxVar = "0"}
if ($installHyperV) {$hypervCheckboxVar = "1"} else {$hypervCheckboxVar = "0"}
if ($skipWinVersionCheck) {$allowOldWinVar = "1"} else {$allowOldWinVar = "0"}
if ($skipConfigFileCreation) {$skipConfigFileCreationVar = "1"} else {$skipConfigFileCreationVar = "0"}

Write-Host "Running the installer ($setupExePath)..."
Write-Host "(provider=`"$provider`", WSLCheckbox=`"$wslCheckboxVar`", HyperVCheckbox=`"$hypervCheckboxVar`", AllowOldWin=`"$allowOldWinVar`", SkipConfigFileCreation=`"$skipConfigFileCreationVar`")"
Write-Host "(provider=`"$provider`", AllowOldWin=`"$allowOldWinVar`", SkipConfigFileCreation=`"$skipConfigFileCreationVar`")"
$ret = Start-Process -Wait `
-PassThru "$setupExePath" `
-ArgumentList "/install /quiet `
MachineProvider=${provider} `
WSLCheckbox=${wslCheckboxVar} `
HyperVCheckbox=${hypervCheckboxVar} `
AllowOldWin=${allowOldWinVar} `
SkipConfigFileCreation=${skipConfigFileCreationVar} `
/log $PSScriptRoot\podman-setup.log"
Expand Down
3 changes: 0 additions & 3 deletions contrib/win-installer/welcome-install-dlg.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@
<RadioButton Text="Windows Linux Subsystem (WSLv2)" Height="15" Value="wsl" Width="226" X="10" Y="0" />
<RadioButton Text="Windows Hyper-V" Height="15" Value="hyperv" Width="226" X="10" Y="15" />
</RadioButtonGroup>

</Control>
<Control Id="WSLInstallCheckbox" Type="CheckBox" X="135" Y="190" Width="226" Height="18" CheckBoxValue="1" Property="WSL_INSTALL" Default="no" Text="Install WSL if needed (requires reboot)" ShowCondition="MACHINE_PROVIDER = &quot;wsl&quot;" HideCondition="(MACHINE_PROVIDER = &quot;hyperv&quot; OR HIDE_PROVIDER_CHOICE) OR (HAS_WSLFEATURE = 1)" />
<Control Id="HyperVInstallCheckbox" Type="CheckBox" X="135" Y="190" Width="226" Height="18" CheckBoxValue="1" Property="HYPERV_INSTALL" Default="no" Text="Install Hyper-V if needed (requires reboot)" ShowCondition="MACHINE_PROVIDER = &quot;hyperv&quot;" HideCondition="(MACHINE_PROVIDER = &quot;wsl&quot; OR HIDE_PROVIDER_CHOICE) OR (HAS_HYPERVFEATURE = 1)" />
<Control Id="Back" Type="PushButton" X="156" Y="243" Width="56" Height="17" Disabled="yes" Text="!(loc.WixUIBack)" />
<Control Id="Install" Type="PushButton" ElevationShield="yes" X="212" Y="243" Width="80" Height="17" Default="yes" Text="!(loc.WelcomeEulaDlgInstall)">
<Publish Event="SpawnWaitDialog" Value="WaitForCostingDlg" Condition="!(wix.WixUICostingPopupOptOut) OR CostingComplete = 1" />
Expand Down
27 changes: 26 additions & 1 deletion winmake.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,32 @@ function Podman-Remote{
}

function Make-Clean{
Remove-Item ./bin -Recurse -Force -Confirm:$false
$paths= @(
# Files generated by the `podman` target
"$PSScriptRoot\bin\windows"
# Files generated by the `installer` target
"$PSScriptRoot\test\version\version.exe"
"$PSScriptRoot\contrib\win-installer\artifacts"
"$PSScriptRoot\contrib\win-installer\current"
"$PSScriptRoot\contrib\win-installer\docs"
"$PSScriptRoot\contrib\win-installer\en-us"
"$PSScriptRoot\contrib\win-installer\fetch"
"$PSScriptRoot\contrib\win-installer\obj"
"$PSScriptRoot\contrib\win-installer\*.log"
"$PSScriptRoot\contrib\win-installer\*.exe"
"$PSScriptRoot\contrib\win-installer\*.wixpdb"
# Files generated by the Documentation target
"$PSScriptRoot\docs\build\remote\podman-*.html"
"$PSScriptRoot\docs\build\remote\podman-for-windows.html"
)

foreach ($path in $paths) {
if (Test-Path -Path $path -PathType Container) {
Remove-Item $path -Recurse -Force -Confirm:$false
} elseif (Test-Path -Path $path -PathType Leaf) {
Remove-Item $path -Force -Confirm:$false
}
}
}

function Local-Machine {
Expand Down

0 comments on commit 7185d46

Please sign in to comment.