From 223fb0f1b95c7b8daa62525378c662261038d4b5 Mon Sep 17 00:00:00 2001 From: jkarasti Date: Tue, 29 Oct 2024 18:58:00 +0200 Subject: [PATCH] Fix: Dangerzone installed using an msi built with WiX Toolset 3 is not uninstalled by an msi built with WiX Toolset 5 Work around the issue by adding some extra functionality to the "Next" button on the welcome screen of the installer. When the user clicks it to proceed with the installation this: 1. Flips the install scope to "perUser" which is the default in WiX 3 2. Finds the older installation 3. And finally flips the scope back to "perMachine" which is the default in WiX 4 and newer TODO: Revert this once we are reasonably certain there are no affected Dangerzone Installations? --- install/windows/build-wxs.py | 37 ++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/install/windows/build-wxs.py b/install/windows/build-wxs.py index 489f43f..fd1e154 100644 --- a/install/windows/build-wxs.py +++ b/install/windows/build-wxs.py @@ -163,6 +163,43 @@ def main(): ) ET.SubElement(ui_el, "UIRef", Id="WixUI_ErrorProgressText") + # Workaround for an issue after upgrading from WiX Toolset 3 to 5 where the older + # version of Dangerzone is not uninstalled during the upgrade + # + # Work around the issue by adding some extra functionality to the "Next" button on the welcome screen + # of the installer. When the user clicks it to proceed with the installation this: + # 1. Flips the install scope to "perUser" which is the default in WiX 3 + # 2. Finds the older installation + # 3. And finally flips the scope back to "perMachine" which is the default in WiX 4 and newer + # + # Adapted from this stack overflow answer: https://stackoverflow.com/a/35064434 + # + # TODO: Revert this once we are reasonably certain there are no affected Dangerzone Installations? + ET.SubElement( + ui_el, + "Publish", + Dialog="WelcomeDlg", + Control="Next", + Property="ALLUSERS", + Value="{}", + ) + ET.SubElement( + ui_el, + "Publish", + Dialog="WelcomeDlg", + Control="Next", + Event="DoAction", + Value="FindRelatedProducts", + ) + ET.SubElement( + ui_el, + "Publish", + Dialog="WelcomeDlg", + Control="Next", + Property="ALLUSERS", + Value="1", + ) + ET.SubElement( package_el, "WixVariable",