|
20 | 20 | <Media Id="1" Cabinet="Podman.cab" EmbedCab="yes"/> |
21 | 21 | <MajorUpgrade AllowDowngrades="yes"/> |
22 | 22 | <Property Id="DiskPrompt" Value="Red Hat's Podman $(var.VERSION) Installation"/> |
23 | | - <SetProperty Id="WSL_INSTALL" Before="AppSearch" Value="1" Sequence="first">NOT (WITH_WSL = 0)</SetProperty> |
| 23 | + <Property Id="MACHINE_PROVIDER" Value="wsl"/> |
| 24 | + <Property Id="MACHINE_PROVIDER_CONFIG_FILE_PATH"> |
| 25 | + <DirectorySearch Id="CommonAppDataFolderSearch" Path="[CommonAppDataFolder]"> |
| 26 | + <DirectorySearch Id="ContainersFolderSearch" Path="containers"> |
| 27 | + <DirectorySearch Id="ContainersConfDFolderSearch" Path="containers.conf.d"> |
| 28 | + <FileSearch Name="99-podman-machine-provider.conf"/> |
| 29 | + </DirectorySearch> |
| 30 | + </DirectorySearch> |
| 31 | + </DirectorySearch> |
| 32 | + </Property> |
| 33 | + <Property Id="MAIN_EXECUTABLE_FILE_PATH"> |
| 34 | + <DirectorySearch Id="ProgramFiles64FolderSearch" Path="[ProgramFiles64Folder]"> |
| 35 | + <DirectorySearch Id="RedHatFolderSearch" Path="RedHat"> |
| 36 | + <DirectorySearch Id="PodmanFolderSearch" Path="Podman"> |
| 37 | + <FileSearch Name="podman.exe"/> |
| 38 | + </DirectorySearch> |
| 39 | + </DirectorySearch> |
| 40 | + </DirectorySearch> |
| 41 | + </Property> |
| 42 | + <!-- |
| 43 | + Property WSL_INSTALL is set at runtime and used as the condition to run the `WSLFeatureComponent` Component: |
| 44 | + WSL is installed only if all these conditions are met: |
| 45 | + - WSL isn't already installed |
| 46 | + - The user has set property `MACHINE_PROVIDER` to "wsl" |
| 47 | + - The user hasn't set property `WITH_WSL` to 0 |
| 48 | + --> |
| 49 | + <SetProperty Id="WSL_INSTALL" Before="AppSearch" Value="1" Sequence="first"> |
| 50 | + <![CDATA[ |
| 51 | + (HAS_WSLFEATURE = 0) |
| 52 | + AND (MACHINE_PROVIDER = "wsl") |
| 53 | + AND (NOT (WITH_WSL = 0)) |
| 54 | + ]]> |
| 55 | + </SetProperty> |
| 56 | + <!-- |
| 57 | + Property HYPERV_INSTALL is set at runtime and used as the condition to run the `HyperVFeatureComponent` Component: |
| 58 | + HyperV is installed only if all these conditions are met: |
| 59 | + - HyperV isn't already installed |
| 60 | + - The user has set property `MACHINE_PROVIDER` to "hyperv" |
| 61 | + - The user hasn't set property `WITH_HYPERV` to 0 |
| 62 | + --> |
| 63 | + <SetProperty Id="HYPERV_INSTALL" Before="AppSearch" Value="1" Sequence="first"> |
| 64 | + <![CDATA[ |
| 65 | + (HAS_HYPERVFEATURE = 0) |
| 66 | + AND (MACHINE_PROVIDER = "hyperv") |
| 67 | + AND (NOT (WITH_HYPERV = 0)) |
| 68 | + ]]> |
| 69 | + </SetProperty> |
| 70 | + <!-- |
| 71 | + Property CREATE_MACHINE_PROVIDER_CONFIG_FILE is set at runtime and used as the condition to run the `MachineProviderConfigFile` Component: |
| 72 | + The machine provider config file is created only if all these conditions are met: |
| 73 | + - The user hasn't set property `SKIP_CONFIG_FILE_CREATION` to 1 |
| 74 | + - The machine provider config file ($PROGRAMDATA/containers/containers.conf.d/99-podman-machine-provider.conf) doesn't exist |
| 75 | + - The main executable file ($PROGRAMDATA/RedHat/Podman/podman.exe) doesn't exist |
| 76 | + --> |
| 77 | + <SetProperty Id="CREATE_MACHINE_PROVIDER_CONFIG_FILE" After="AppSearch" Value="1" Sequence="first"> |
| 78 | + <![CDATA[ |
| 79 | + (NOT (SKIP_CONFIG_FILE_CREATION = 1)) |
| 80 | + AND (NOT MACHINE_PROVIDER_CONFIG_FILE_PATH) |
| 81 | + AND (NOT MAIN_EXECUTABLE_FILE_PATH) |
| 82 | + ]]> |
| 83 | + </SetProperty> |
| 84 | + <!-- |
| 85 | + Property HIDE_PROVIDER_CHOICE is set at runtime and used as the condition to hide the Machine Provider |
| 86 | + choice from the MSI GUI (the Radio Button Group and other related controls): |
| 87 | + The machine provider choice isn't shown to the user if one of these conditions are met: |
| 88 | + - The user has set the property `SKIP_CONFIG_FILE_CREATION` to 1 |
| 89 | + - The machine provider config file ($PROGRAMDATA/containers/containers.conf.d/99-podman-machine-provider.conf) exists |
| 90 | + - The main executable file ($PROGRAMDATA/RedHat/Podman/podman.exe) exists |
| 91 | + --> |
| 92 | + <SetProperty Id="HIDE_PROVIDER_CHOICE" After="AppSearch" Value="1" Sequence="first"> |
| 93 | + <![CDATA[ |
| 94 | + (SKIP_CONFIG_FILE_CREATION = 1) |
| 95 | + OR (MACHINE_PROVIDER_CONFIG_FILE_PATH) |
| 96 | + OR (MAIN_EXECUTABLE_FILE_PATH) |
| 97 | + ]]> |
| 98 | + </SetProperty> |
| 99 | + |
24 | 100 | <Directory Id="TARGETDIR" Name="SourceDir"> |
25 | 101 | <Directory Id="ProgramFiles64Folder" Name="PFiles"> |
26 | 102 | <Directory Id="RedHatPFiles" Name="RedHat"> |
|
48 | 124 | </Directory> |
49 | 125 | </Directory> |
50 | 126 | </Directory> |
| 127 | + <!-- |
| 128 | + The following code creates the `containers/containers.conf.d` folder under the system wide |
| 129 | + `$CommonAppDataFolder`. That's preferred to the user specific `$AppDataFolder` to avoid the |
| 130 | + Windows Installer ICE91 warning https://learn.microsoft.com/en-us/windows/win32/msi/ice91. |
| 131 | + --> |
| 132 | + <Directory Id="CommonAppDataFolder"> |
| 133 | + <Directory Id="CONFIGDIR" Name="containers"> |
| 134 | + <Directory Id="ContainersConfigSubDir" Name="containers.conf.d"> |
| 135 | + <Component Id="MachineProviderConfigFile" Guid="C32C0040-D9AF-4155-AC7E-465B63B6BE3B"> |
| 136 | + <CreateFolder /> |
| 137 | + <IniFile Id="MachineProviderConfigFile" Action="createLine" Directory="ContainersConfigSubDir" Section="machine" Name="99-podman-machine-provider.conf" Key="provider" Value='"[MACHINE_PROVIDER]"' /> |
| 138 | + <Condition>CREATE_MACHINE_PROVIDER_CONFIG_FILE</Condition> |
| 139 | + </Component> |
| 140 | + </Directory> |
| 141 | + </Directory> |
| 142 | + </Directory> |
51 | 143 | <Directory Id="EnvEntries"> |
52 | 144 | <Component Id="EnvEntriesComponent" Guid="b662ec43-0e0e-4018-8bf3-061904bb8f5b" Win64="yes"> |
53 | 145 | <CreateFolder /> |
|
57 | 149 | </Directory> |
58 | 150 |
|
59 | 151 | <CustomAction Id="OpenGuide" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" /> |
60 | | - <CustomAction Id="CheckWSL" BinaryKey="PodmanHooks" Execute="immediate" DllEntry="CheckWSL" /> |
| 152 | + <CustomAction Id="CheckWSL" BinaryKey="PodmanHooks" Execute="firstSequence" DllEntry="CheckWSL" /> |
| 153 | + <CustomAction Id="CheckHyperV" BinaryKey="PodmanHooks" Execute="firstSequence" DllEntry="CheckHyperV" /> |
61 | 154 | <CustomActionRef Id="WixBroadcastEnvironmentChange" /> |
62 | 155 | <ComponentGroup Id="WSLFeature" Directory="INSTALLDIR"> |
63 | | - <Component> |
64 | | - <Condition>(NOT Installed) AND WSL_INSTALL = 1 AND HAS_WSLFEATURE = 0</Condition> |
65 | | - <File Source="$(sys.SOURCEFILEPATH)"/> |
| 156 | + <Component Id="WSLFeatureComponent" Guid="F6A693BC-186C-4E64-8015-C3073013B3A8"> |
| 157 | + <Condition>(NOT Installed) AND WSL_INSTALL = 1</Condition> |
| 158 | + <CreateFolder /> |
66 | 159 | <PanelSW:Dism EnableFeature="VirtualMachinePlatform" ErrorHandling="prompt"/> |
67 | 160 | <PanelSW:Dism EnableFeature="Microsoft-Windows-Subsystem-Linux" ErrorHandling="prompt"/> |
68 | 161 | </Component> |
69 | 162 | </ComponentGroup> |
| 163 | + <ComponentGroup Id="HyperVFeature" Directory="INSTALLDIR"> |
| 164 | + <Component Id="HyperVFeatureComponent" Guid="F7B2D4C9-6C89-46BB-B4EA-FF39424972F3"> |
| 165 | + <Condition>(NOT Installed) AND HYPERV_INSTALL = 1</Condition> |
| 166 | + <CreateFolder /> |
| 167 | + <PanelSW:Dism EnableFeature="Microsoft-Hyper-V" ErrorHandling="prompt"/> |
| 168 | + </Component> |
| 169 | + </ComponentGroup> |
70 | 170 | <Feature Id="Complete" Level="1"> |
71 | 171 | <ComponentRef Id="INSTALLDIR_Component"/> |
72 | 172 | <ComponentRef Id="EnvEntriesComponent"/> |
|
76 | 176 | <ComponentRef Id="GvProxyExecutable"/> |
77 | 177 | <?endif?> |
78 | 178 | <ComponentRef Id="GuideHTMLComponent"/> |
| 179 | + <ComponentRef Id="MachineProviderConfigFile"/> |
79 | 180 | <ComponentGroupRef Id="ManFiles"/> |
80 | 181 | <ComponentGroupRef Id="WSLFeature"/> |
| 182 | + <ComponentGroupRef Id="HyperVFeature"/> |
81 | 183 | </Feature> |
82 | 184 |
|
83 | 185 | <Icon Id="podman.ico" SourceFile="resources/podman-logo.ico"/> |
|
94 | 196 | </UI> |
95 | 197 |
|
96 | 198 | <InstallExecuteSequence> |
97 | | - <Custom Action="CheckWSL" After="SetWSL_INSTALL">WSL_INSTALL = 1</Custom> |
98 | | - <ForceReboot Before="StopServices">(NOT Installed) AND WSL_INSTALL = 1 AND HAS_WSLFEATURE = 0 AND NOT AFTERREBOOT</ForceReboot> |
| 199 | + <Custom Action="CheckWSL" Before="SetWSL_INSTALL" /> |
| 200 | + <Custom Action="CheckHyperV" Before="SetHYPERV_INSTALL" /> |
| 201 | + <ForceReboot Before="StopServices"> |
| 202 | + (NOT Installed) |
| 203 | + AND ((WSL_INSTALL = 1) OR (HYPERV_INSTALL = 1)) |
| 204 | + AND (NOT AFTERREBOOT) |
| 205 | + </ForceReboot> |
99 | 206 | </InstallExecuteSequence> |
100 | 207 | <Binary Id="PodmanHooks" SourceFile="artifacts/podman-msihooks.dll" /> |
101 | 208 | </Product> |
|
0 commit comments