podman/contrib/win-installer/podman.wxs

140 lines
7.5 KiB
XML

<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:PanelSW="http://schemas.panel-sw.co.il/wix/WixExtension" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
<?ifndef VERSION?>
<?error VERSION must be defined via command line argument?>
<?endif?>
<?ifdef env.UseGVProxy?>
<?define UseGVProxy = "$(env.UseGVProxy)"?>
<?else?>
<?define UseGVProxy = ""?>
<?endif?>
<Package Name="podman" Manufacturer="Red Hat Inc." Version="$(VERSION)" UpgradeCode="a6a9dd9c-0732-44ba-9279-ffe22ea50671">
<Media Id="1" Cabinet="Podman.cab" EmbedCab="yes" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." RemoveFeatures="Complete" Schedule="afterInstallExecute" />
<Property Id="DiskPrompt" Value="Red Hat's Podman $(VERSION) Installation" />
<Property Id="MACHINE_PROVIDER" Value="wsl" />
<Property Id="MACHINE_PROVIDER_CONFIG_FILE_PATH">
<DirectorySearch Id="CommonAppDataFolderSearch" Path="[CommonAppDataFolder]">
<DirectorySearch Id="ContainersFolderSearch" Path="containers">
<DirectorySearch Id="ContainersConfDFolderSearch" Path="containers.conf.d">
<FileSearch Name="99-podman-machine-provider.conf" />
</DirectorySearch>
</DirectorySearch>
</DirectorySearch>
</Property>
<Property Id="MAIN_EXECUTABLE_FILE_PATH">
<DirectorySearch Id="ProgramFiles64FolderSearch" Path="[ProgramFiles64Folder]">
<DirectorySearch Id="RedHatFolderSearch" Path="RedHat">
<DirectorySearch Id="PodmanFolderSearch" Path="Podman">
<FileSearch Name="podman.exe" />
</DirectorySearch>
</DirectorySearch>
</DirectorySearch>
</Property>
<!--
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:
- The user hasn't set property `SKIP_CONFIG_FILE_CREATION` to 1
- The main executable file ($PROGRAMDATA/RedHat/Podman/podman.exe) doesn't exist or, if it exists, the machine provider config file exists
-->
<SetProperty Id="CREATE_MACHINE_PROVIDER_CONFIG_FILE" After="AppSearch" Value="1" Sequence="first" Condition="(NOT (SKIP_CONFIG_FILE_CREATION = 1)) AND ((NOT MAIN_EXECUTABLE_FILE_PATH) OR (MACHINE_PROVIDER_CONFIG_FILE_PATH))" />
<!--
Property HIDE_PROVIDER_CHOICE is set at runtime and used as the condition to hide the Machine Provider
choice from the MSI GUI (the Radio Button Group and other related controls):
The machine provider choice isn't shown to the user if one of these conditions are met:
- The user has set the property `SKIP_CONFIG_FILE_CREATION` to 1
- The machine provider config file ($PROGRAMDATA/containers/containers.conf.d/99-podman-machine-provider.conf) exists
- The main executable file ($PROGRAMDATA/RedHat/Podman/podman.exe) exists
-->
<SetProperty Id="HIDE_PROVIDER_CHOICE" After="AppSearch" Value="1" Sequence="first" Condition="(SKIP_CONFIG_FILE_CREATION = 1) OR (MACHINE_PROVIDER_CONFIG_FILE_PATH) OR (MAIN_EXECUTABLE_FILE_PATH)" />
<CustomAction Id="OpenGuide" DllEntry="WixShellExec" Impersonate="yes" BinaryRef="Wix4UtilCA_X86" />
<CustomAction Id="CheckWSL" Execute="firstSequence" DllEntry="CheckWSL" BinaryRef="PodmanHooks" />
<CustomAction Id="CheckHyperV" Execute="firstSequence" DllEntry="CheckHyperV" BinaryRef="PodmanHooks" />
<util:BroadcastEnvironmentChange />
<Feature Id="Complete" Level="1">
<ComponentRef Id="INSTALLDIR_Component" />
<ComponentRef Id="EnvEntriesComponent" />
<ComponentRef Id="MainExecutable" />
<ComponentRef Id="WinSshProxyExecutable" />
<?if $(var.UseGVProxy) != Skip?>
<ComponentRef Id="GvProxyExecutable" />
<?endif?>
<ComponentRef Id="GuideHTMLComponent" />
<ComponentGroupRef Id="ManFiles" />
</Feature>
<Feature Id="MachineProviderConfig" Level="1">
<ComponentRef Id="MachineProviderConfigFile" />
</Feature>
<Icon Id="podman.ico" SourceFile="resources/podman-logo.ico" />
<Property Id="ARPPRODUCTICON" Value="podman.ico" />
<Property Id="WixShellExecTarget" Value="[#GuideHTMLFile]" />
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Show Getting Started Guide" />
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="1" />
<WixVariable Id="WixUIBannerBmp" Value="resources\podman-banner.png" />
<WixVariable Id="WixUIDialogBmp" Value="resources\podman-dialog.png" />
<UIRef Id="PodmanUI" />
<UI>
<Publish Dialog="ExitDialog" Control="Finish" Event="DoAction" Value="OpenGuide" Condition="(WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1) AND (NOT Installed) AND (NOT UpdateStarted)" />
</UI>
<InstallExecuteSequence>
<Custom Action="CheckWSL" Before="InstallFiles" />
<Custom Action="CheckHyperV" Before="InstallFiles" />
</InstallExecuteSequence>
<Binary Id="PodmanHooks" SourceFile="artifacts/podman-msihooks.dll" />
<StandardDirectory Id="ProgramFiles6432Folder">
<Directory Id="RedHatPFiles" Name="RedHat">
<Directory Id="INSTALLDIR" Name="Podman">
<Component Id="INSTALLDIR_Component" Guid="14B310C4-9B5D-4DA5-ADF9-B9D008E4CD82" Bitness="always64">
<CreateFolder />
<RegistryKey Root="HKLM" Key="SOFTWARE\Red Hat\Podman">
<RegistryValue Name="InstallDir" Value="[INSTALLDIR]" Type="string" />
</RegistryKey>
</Component>
<Component Id="MainExecutable" Guid="73752F94-6589-4C7B-ABED-39D655A19714" Bitness="always64">
<File Id="MainExecutableFile" Name="podman.exe" Source="artifacts/podman.exe" KeyPath="yes" />
</Component>
<Component Id="WinSshProxyExecutable" Guid="0DA730AB-2F97-40E8-A8FC-356E88EAA4D2" Bitness="always64">
<File Id="WinSshProxyExecutableFile" Name="win-sshproxy.exe" Source="artifacts/win-sshproxy.exe" KeyPath="yes" />
</Component>
<?if $(var.UseGVProxy) != Skip?>
<Component Id="GvProxyExecutable" Guid="1A4A2975-AD2D-44AA-974B-9B343C098333" Bitness="always64">
<File Id="GvProxyExecutableFile" Name="gvproxy.exe" Source="artifacts/gvproxy.exe" KeyPath="yes" />
</Component>
<?endif?>
<Component Id="GuideHTMLComponent" Guid="8B23C76B-F7D4-4030-8C46-1B5729E616B5" Bitness="always64">
<File Id="GuideHTMLFile" Name="welcome-podman.html" Source="docs/podman-for-windows.html" KeyPath="yes" />
</Component>
</Directory>
</Directory>
</StandardDirectory>
<!--
The following code creates the `containers/containers.conf.d` folder under the system wide
`$CommonAppDataFolder`. That's preferred to the user specific `$AppDataFolder` to avoid the
Windows Installer ICE91 warning https://learn.microsoft.com/en-us/windows/win32/msi/ice91.
-->
<StandardDirectory Id="CommonAppDataFolder">
<Directory Id="CONFIGDIR" Name="containers">
<Directory Id="ContainersConfigSubDir" Name="containers.conf.d">
<Component Id="MachineProviderConfigFile" Guid="C32C0040-D9AF-4155-AC7E-465B63B6BE3B" Condition="CREATE_MACHINE_PROVIDER_CONFIG_FILE" Transitive="true">
<CreateFolder />
<IniFile Id="MachineProviderConfigFile" Action="createLine" Directory="ContainersConfigSubDir" Section="machine" Name="99-podman-machine-provider.conf" Key="provider" Value="&quot;[MACHINE_PROVIDER]&quot;" />
</Component>
</Directory>
</Directory>
</StandardDirectory>
<Directory Id="EnvEntries">
<Component Id="EnvEntriesComponent" Guid="b662ec43-0e0e-4018-8bf3-061904bb8f5b" Bitness="always64">
<CreateFolder />
<Environment Id="UpdatePath" Name="PATH" Action="set" Permanent="no" System="yes" Part="last" Value="[INSTALLDIR]" />
</Component>
</Directory>
</Package>
</Wix>