fix(packaging/windows): Allow WiX installer downgrades (#5435)

This commit is contained in:
Dave Lane
2026-07-21 18:29:24 -04:00
committed by GitHub
parent 9d2409f71b
commit 82a9720e36
2 changed files with 61 additions and 0 deletions
+10
View File
@@ -64,6 +64,10 @@ set(CPACK_WIX_HELP_LINK "https://docs.lizardbyte.dev/projects/sunshine/latest/md
set(CPACK_WIX_PRODUCT_ICON "${SUNSHINE_ICON_PATH}")
set(CPACK_WIX_PRODUCT_URL "${CMAKE_PROJECT_HOMEPAGE_URL}")
set(CPACK_WIX_PROGRAM_MENU_FOLDER "LizardByte")
# Force package files to replace existing files when switching between release
# and PR builds, regardless of their embedded file versions.
# https://learn.microsoft.com/en-us/windows/win32/msi/reinstallmode
set(CPACK_WIX_PROPERTY_REINSTALLMODE "amus")
set(CPACK_WIX_EXTENSIONS
"WixToolset.UI.wixext"
@@ -82,6 +86,12 @@ set(CPACK_WIX_EXTRA_SOURCES
set(CPACK_WIX_PATCH_FILE
"${WIX_BUILD_PARENT_DIRECTORY}/patch.xml"
)
# CPack's default WiX template blocks downgrades. Sunshine users commonly switch
# between release and PR builds, so allow any build to replace the installed one.
# https://docs.firegiant.com/wix/schema/wxs/majorupgrade/#allowdowngrades
set(CPACK_WIX_TEMPLATE
"${WIX_BUILD_PARENT_DIRECTORY}/wix.template.in"
)
# Copy root LICENSE and rename to have .txt extension
file(COPY "${CMAKE_SOURCE_DIR}/LICENSE"
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<?include "cpack_variables.wxi"?>
<Wix
xmlns="http://wixtoolset.org/schemas/v4/wxs"@CPACK_WIX_CUSTOM_XMLNS_EXPANDED@
RequiredVersion="4.0"
>
<Package
Name="$(var.CPACK_PACKAGE_NAME)"
Version="$(var.CPACK_PACKAGE_VERSION)"
Manufacturer="$(var.CPACK_PACKAGE_VENDOR)"
UpgradeCode="$(var.CPACK_WIX_UPGRADE_GUID)"
ProductCode="$(var.CPACK_WIX_PRODUCT_GUID)"
Scope="$(var.CPACK_WIX_INSTALL_SCOPE)"
InstallerVersion="500"
Language="1033"
Compressed="yes"
>
<?ifndef CPACK_WIX_CAB_PER_COMPONENT?>
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes"/>
<?endif?>
<MajorUpgrade
Schedule="afterInstallInitialize"
AllowDowngrades="yes"/>
<WixVariable Id="WixUILicenseRtf" Value="$(var.CPACK_WIX_LICENSE_RTF)"/>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALL_ROOT"/>
<?ifdef CPACK_WIX_PRODUCT_ICON?>
<Property Id="ARPPRODUCTICON" Value="ProductIcon.ico" />
<Icon Id="ProductIcon.ico" SourceFile="$(var.CPACK_WIX_PRODUCT_ICON)"/>
<?endif?>
<?ifdef CPACK_WIX_UI_BANNER?>
<WixVariable Id="WixUIBannerBmp" Value="$(var.CPACK_WIX_UI_BANNER)"/>
<?endif?>
<?ifdef CPACK_WIX_UI_DIALOG?>
<WixVariable Id="WixUIDialogBmp" Value="$(var.CPACK_WIX_UI_DIALOG)"/>
<?endif?>
<FeatureRef Id="ProductFeature"/>
<ui:WixUI Id="$(var.CPACK_WIX_UI_REF)" />
<UIRef Id="WixUI_ErrorProgressText" />
<?include "properties.wxi"?>
<?include "product_fragment.wxi"?>
</Package>
</Wix>