Compare commits

..

17 commits

Author SHA1 Message Date
jkarasti
5c9f5fe34c Fix: Dangerzone installed using an msi built with WiX Toolset v3 is not uninstalled by an msi built with WiX Toolset v5
Fix 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 v3
2. Finds the older installation
3. And finally flips the scope back to "perMachine" which is the default in WiX v4 and newer

TODO: Revert this once we are reasonably certain there are no affected Dangerzone Installations?
2024-10-31 19:18:08 +02:00
jkarasti
5bb09f7c03 Change: Wrap installer ui related things in a UI element 2024-10-31 19:18:08 +02:00
JKarasti
2149ad8963 Change: Build 64bit installer 2024-10-31 19:18:08 +02:00
JKarasti
096b075126 Docs: Documentation for WiX Toolset 5 2024-10-31 19:18:08 +02:00
JKarasti
5ecfbcd323 Change: Update the build-app.bat script to work with WiX Toolset v5
- WiX Toolset v3 used to validate the msi package by default. In v5 that has moved to a new command, so add a new validation step to the script.

- Also emove the step that uses `insignia.exe` to sign the Dangerzone.msi with the digital signatures from its external cab archives.

  In WiX Toolset v4 and newer, insignia is replaced with a new command `wix msi inscribe`, but we tell wix to embed the cabinets into the .msi
  (That's what`EmbedCab="yes"` in the Media / MediaTemplate element does) so singning them separately is not necessary. [0]

  [0] https://wixtoolset.org/docs/tools/signing/
2024-10-31 19:18:08 +02:00
JKarasti
2d95c078d3 Change: Use WiX Toolset v5 to build the msi in CI 2024-10-31 19:18:08 +02:00
JKarasti
b1d9bfccab Change: Write Dangerzone.wxs inside the script directly
Also reduce duplication slightly by definig `build_dir`, `cx_freeze_dir` and `dist_dir`
2024-10-31 19:18:08 +02:00
JKarasti
31e865a347 Fix: Make GUIDs uppercase
See [1]

[1] https://learn.microsoft.com/en-us/windows/win32/msi/guid
2024-10-31 19:18:08 +02:00
JKarasti
b9c9dbccae Change: Write dangerzone version and upgradecode into Package and SummaryInformation elements directly 2024-10-31 19:18:08 +02:00
JKarasti
a78f0a7000 Refactor: build_dir_xml() function
- rename for clarity
- remove unnecessary checks
2024-10-31 19:18:08 +02:00
JKarasti
cd9eafbd63 Change: Wrap all files to be included in the .msi in a ComponentGroupRef
With this, all the files are organised into Components,
each of which points to a Directory defined in the StandardDirectory element.
This simplifies the Feature element considerable as only thing it needs to
include everything in the built msi is a reference to `ApplicationComponents`
2024-10-31 19:18:08 +02:00
JKarasti
e8202759f1 Refactor: Simplify build_data() function
- Rename variables to be more clear about what they do:
- reorganise code
- simplify a few checks
2024-10-31 19:18:08 +02:00
JKarasti
1a84fbe998 Change: Swap Media element with MediaTemplate
This is a new default and makes authoring slightly simpler without any functional changes.
2024-10-31 19:18:08 +02:00
JKarasti
287bd55c2e Change: Convert Wix UI extension authoring to WiX Toolset v5
Due to limitations of the xml.etree.ElementTree library, add the items in the root element as a dictionary
2024-10-31 19:18:08 +02:00
JKarasti
6ca30a39b2 Change: Wrap ProgramFilesFolder component with a StandardDirectory component 2024-10-31 19:18:08 +02:00
JKarasti
0f2a385913 Change: Wrap ProgramMenuFolder component with a StandardDirectory component 2024-10-31 19:18:08 +02:00
JKarasti
3df5c0d3be Change: Merge Product into Package element
- The Keywords and Description items move under a new SummaryInformation element.
- Shuffle things around so that elements previously under the product element are now under the Package element.
- Rename SummaryCodepage in SummaryInformation to Codepage and remove a duplicate Manufacturer item.
- Remove InstallerVersion and let WiX set it to default value. (500 a.k.a Windows 7)
2024-10-31 19:18:02 +02:00
2 changed files with 31 additions and 36 deletions

View file

@ -28,7 +28,6 @@ REM validate Dangerzone.msi
wix msi validate Dangerzone.msi wix msi validate Dangerzone.msi
REM code sign Dangerzone.msi REM code sign Dangerzone.msi
wix msi inscribe Dangerzone.msi
signtool.exe sign /v /d "Dangerzone" /a /n "Freedom of the Press Foundation" /fd sha256 /t http://time.certum.pl/ Dangerzone.msi signtool.exe sign /v /d "Dangerzone" /a /n "Freedom of the Press Foundation" /fd sha256 /t http://time.certum.pl/ Dangerzone.msi
REM verify the signature of Dangerzone.msi REM verify the signature of Dangerzone.msi

View file

@ -84,9 +84,7 @@ def main():
with open(version_filename) as f: with open(version_filename) as f:
# Read the Dangerzone version from share/version.txt, and remove any potential # Read the Dangerzone version from share/version.txt, and remove any potential
# -rc markers. # -rc markers.
dangerzone_version = f.read().strip().split("-")[0] version = f.read().strip().split("-")[0]
dangerzone_product_upgrade_code = "12B9695C-965B-4BE0-BC33-21274E809576"
build_dir = os.path.join( build_dir = os.path.join(
os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))), os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))),
@ -124,18 +122,17 @@ def main():
"Package", "Package",
Name="Dangerzone", Name="Dangerzone",
Manufacturer="Freedom of the Press Foundation", Manufacturer="Freedom of the Press Foundation",
UpgradeCode=dangerzone_product_upgrade_code, UpgradeCode="12B9695C-965B-4BE0-BC33-21274E809576",
Language="1033", Language="1033",
Compressed="yes", Compressed="yes",
Codepage="1252", Codepage="1252",
Version=dangerzone_version, Version=version,
) )
ET.SubElement( ET.SubElement(
package_el, package_el,
"SummaryInformation", "SummaryInformation",
Keywords="Installer", Keywords="Installer",
Description="Dangerzone " + dangerzone_version + " Installer", Description="Dangerzone " + version + " Installer",
Codepage="1252", Codepage="1252",
) )
ET.SubElement(package_el, "MediaTemplate", EmbedCab="yes") ET.SubElement(package_el, "MediaTemplate", EmbedCab="yes")
@ -155,22 +152,40 @@ def main():
Id="ARPURLINFOABOUT", Id="ARPURLINFOABOUT",
Value="https://freedom.press", Value="https://freedom.press",
) )
ET.SubElement(
package_el,
"WixVariable",
Id="WixUILicenseRtf",
Value="..\\install\\windows\\license.rtf",
)
ET.SubElement(
package_el,
"WixVariable",
Id="WixUIDialogBmp",
Value="..\\install\\windows\\dialog.bmp",
)
ET.SubElement(
package_el,
"MajorUpgrade",
AllowSameVersionUpgrades="yes",
DowngradeErrorMessage="A newer version of [ProductName] is already installed. If you are sure you want to downgrade, remove the existing installation via Programs and Features.",
)
# Add The UI element
ui_el = ET.SubElement(package_el, "UI") ui_el = ET.SubElement(package_el, "UI")
ET.SubElement( ET.SubElement(
ui_el, "ui:WixUI", Id="WixUI_InstallDir", InstallDirectory="INSTALLFOLDER" ui_el, "ui:WixUI", Id="WixUI_InstallDir", InstallDirectory="INSTALLFOLDER"
) )
ET.SubElement(ui_el, "UIRef", Id="WixUI_ErrorProgressText") ET.SubElement(ui_el, "UIRef", Id="WixUI_ErrorProgressText")
# Workaround for an issue after upgrading from WiX Toolset 3 to 5 where the older # Workaround for an issue after upgrading from WiX Toolset v3 to v5 where the older
# version of Dangerzone is not uninstalled during the upgrade # 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 # Fix 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: # 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 # 1. Flips the install scope to "perUser" which is the default in WiX v3
# 2. Finds the older installation # 2. Finds the older installation
# 3. And finally flips the scope back to "perMachine" which is the default in WiX 4 and newer # 3. And finally flips the scope back to "perMachine" which is the default in WiX v4 and newer
# #
# Adapted from this stack overflow answer: https://stackoverflow.com/a/35064434 # Adapted from this stack overflow answer: https://stackoverflow.com/a/35064434
# #
@ -200,32 +215,13 @@ def main():
Value="1", Value="1",
) )
ET.SubElement(
package_el,
"WixVariable",
Id="WixUILicenseRtf",
Value="..\\install\\windows\\license.rtf",
)
ET.SubElement(
package_el,
"WixVariable",
Id="WixUIDialogBmp",
Value="..\\install\\windows\\dialog.bmp",
)
ET.SubElement(
package_el,
"MajorUpgrade",
AllowSameVersionUpgrades="yes",
DowngradeErrorMessage="A newer version of [ProductName] is already installed. If you are sure you want to downgrade, remove the existing installation via Programs and Features.",
)
# Add the ProgramMenuFolder StandardDirectory # Add the ProgramMenuFolder StandardDirectory
programmenufolder_el = ET.SubElement( programmenufolder_el = ET.SubElement(
package_el, package_el,
"StandardDirectory", "StandardDirectory",
Id="ProgramMenuFolder", Id="ProgramMenuFolder",
) )
# Add a shortcut for Dangerzone in the Start menu
shortcut_el = ET.SubElement( shortcut_el = ET.SubElement(
programmenufolder_el, programmenufolder_el,
"Component", "Component",
@ -259,14 +255,14 @@ def main():
Id="ProgramFiles64Folder", Id="ProgramFiles64Folder",
) )
# Generate the directory layout for the installed product # Create the directory structure for the installed product
build_directory_xml(programfilesfolder_el, data) build_directory_xml(programfilesfolder_el, data)
# Create a component group for application components
applicationcomponents_el = ET.SubElement( applicationcomponents_el = ET.SubElement(
package_el, "ComponentGroup", Id="ApplicationComponents" package_el, "ComponentGroup", Id="ApplicationComponents"
) )
# Populate the application components group with components for the installed package
# Generate the components for the installed product
build_components_xml(applicationcomponents_el, data) build_components_xml(applicationcomponents_el, data)
# Add the Feature element # Add the Feature element