mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-28 18:02:38 +02:00
Merge 223fb0f1b9
into f540a67d06
This commit is contained in:
commit
fb2805e59f
4 changed files with 220 additions and 164 deletions
12
.github/workflows/ci.yml
vendored
12
.github/workflows/ci.yml
vendored
|
@ -110,10 +110,14 @@ jobs:
|
||||||
key: v1-tessdata-${{ hashFiles('./install/common/download-tessdata.py') }}
|
key: v1-tessdata-${{ hashFiles('./install/common/download-tessdata.py') }}
|
||||||
- name: Run CLI tests
|
- name: Run CLI tests
|
||||||
run: poetry run make test
|
run: poetry run make test
|
||||||
# Taken from: https://github.com/orgs/community/discussions/27149#discussioncomment-3254829
|
- name: Set up .NET CLI environment
|
||||||
- name: Set path for candle and light
|
uses: actions/setup-dotnet@v4
|
||||||
run: echo "C:\Program Files (x86)\WiX Toolset v3.14\bin" >> $GITHUB_PATH
|
with:
|
||||||
shell: bash
|
dotnet-version: "8.x"
|
||||||
|
- name: Install WiX Toolset
|
||||||
|
run: dotnet tool install --global wix --version 5.0.1
|
||||||
|
- name: Add WiX UI extension
|
||||||
|
run: wix extension add --global WixToolset.UI.wixext/5.0.1
|
||||||
- name: Build the MSI installer
|
- name: Build the MSI installer
|
||||||
# NOTE: This also builds the .exe internally.
|
# NOTE: This also builds the .exe internally.
|
||||||
run: poetry run .\install\windows\build-app.bat
|
run: poetry run .\install\windows\build-app.bat
|
||||||
|
|
19
BUILD.md
19
BUILD.md
|
@ -474,11 +474,22 @@ poetry shell
|
||||||
.\dev_scripts\dangerzone.bat
|
.\dev_scripts\dangerzone.bat
|
||||||
```
|
```
|
||||||
|
|
||||||
### If you want to build the installer
|
### If you want to build the Windows installer
|
||||||
|
|
||||||
* Go to https://dotnet.microsoft.com/download/dotnet-framework and download and install .NET Framework 3.5 SP1 Runtime. I downloaded `dotnetfx35.exe`.
|
Install [.NET SDK](https://dotnet.microsoft.com/en-us/download) version 6 or later. Then, open a terminal and install the [WiX Toolset .NET tool](https://wixtoolset.org/) v5.0.1.
|
||||||
* Go to https://wixtoolset.org/releases/ and download and install WiX toolset. I downloaded `wix314.exe`.
|
|
||||||
* Add `C:\Program Files (x86)\WiX Toolset v3.14\bin` to the path ([instructions](https://web.archive.org/web/20230221104142/https://windowsloop.com/how-to-add-to-windows-path/)).
|
```sh
|
||||||
|
dotnet tool install --global wix --version 5.0.1
|
||||||
|
```
|
||||||
|
|
||||||
|
Install the WiX UI extension **in a new terminal**, in order to use the newly installed `wix` .NET tool:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
wix extension add --global WixToolset.UI.wixext/5.0.1
|
||||||
|
```
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> To prevent compatibility issues, ensure that all WiX plugins you install match the version of WiX Toolset.
|
||||||
|
|
||||||
### If you want to sign binaries with Authenticode
|
### If you want to sign binaries with Authenticode
|
||||||
|
|
||||||
|
|
|
@ -17,22 +17,24 @@ signtool.exe sign /v /d "Dangerzone" /a /n "Freedom of the Press Foundation" /fd
|
||||||
REM verify the signature of dangerzone-cli.exe
|
REM verify the signature of dangerzone-cli.exe
|
||||||
signtool.exe verify /pa build\exe.win-amd64-3.12\dangerzone-cli.exe
|
signtool.exe verify /pa build\exe.win-amd64-3.12\dangerzone-cli.exe
|
||||||
|
|
||||||
REM build the wix file
|
REM build the wxs file
|
||||||
python install\windows\build-wxs.py > build\Dangerzone.wxs
|
python install\windows\build-wxs.py
|
||||||
|
|
||||||
REM build the msi package
|
REM build the msi package
|
||||||
cd build
|
cd build
|
||||||
candle.exe Dangerzone.wxs
|
wix build -arch x64 -ext WixToolset.UI.wixext .\Dangerzone.wxs -out Dangerzone.msi
|
||||||
light.exe -ext WixUIExtension Dangerzone.wixobj
|
|
||||||
|
REM validate Dangerzone.msi
|
||||||
|
wix msi validate Dangerzone.msi
|
||||||
|
|
||||||
REM code sign Dangerzone.msi
|
REM code sign Dangerzone.msi
|
||||||
insignia.exe -im 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
|
||||||
signtool.exe verify /pa Dangerzone.msi
|
signtool.exe verify /pa Dangerzone.msi
|
||||||
|
|
||||||
REM moving Dangerzone.msi to dist
|
REM move Dangerzone.msi to dist
|
||||||
cd ..
|
cd ..
|
||||||
mkdir dist
|
mkdir dist
|
||||||
move build\Dangerzone.msi dist
|
move build\Dangerzone.msi dist
|
||||||
|
|
|
@ -4,114 +4,75 @@ import uuid
|
||||||
import xml.etree.ElementTree as ET
|
import xml.etree.ElementTree as ET
|
||||||
|
|
||||||
|
|
||||||
def build_data(dirname, dir_prefix, id_, name):
|
def build_data(base_path, path_prefix, dir_id, dir_name):
|
||||||
data = {
|
data = {
|
||||||
"id": id_,
|
"directory_name": dir_name,
|
||||||
"name": name,
|
"directory_id": dir_id,
|
||||||
"files": [],
|
"files": [],
|
||||||
"dirs": [],
|
"dirs": [],
|
||||||
}
|
}
|
||||||
|
|
||||||
for basename in os.listdir(dirname):
|
if dir_id == "INSTALLFOLDER":
|
||||||
filename = os.path.join(dirname, basename)
|
data["component_id"] = "ApplicationFiles"
|
||||||
if os.path.isfile(filename):
|
else:
|
||||||
data["files"].append(os.path.join(dir_prefix, basename))
|
data["component_id"] = "Component" + dir_id
|
||||||
elif os.path.isdir(filename):
|
data["component_guid"] = str(uuid.uuid4()).upper()
|
||||||
if id_ == "INSTALLDIR":
|
|
||||||
id_prefix = "Folder"
|
for entry in os.listdir(base_path):
|
||||||
|
entry_path = os.path.join(base_path, entry)
|
||||||
|
if os.path.isfile(entry_path):
|
||||||
|
data["files"].append(os.path.join(path_prefix, entry))
|
||||||
|
elif os.path.isdir(entry_path):
|
||||||
|
if dir_id == "INSTALLFOLDER":
|
||||||
|
next_dir_prefix = "Folder"
|
||||||
else:
|
else:
|
||||||
id_prefix = id_
|
next_dir_prefix = dir_id
|
||||||
|
|
||||||
# Skip lib/PySide6/examples folder due to ilegal file names
|
# Skip lib/PySide6/examples folder due to ilegal file names
|
||||||
if "\\build\\exe.win-amd64-3.12\\lib\\PySide6\\examples" in dirname:
|
if "\\build\\exe.win-amd64-3.12\\lib\\PySide6\\examples" in base_path:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Skip lib/PySide6/qml/QtQuick folder due to ilegal file names
|
# Skip lib/PySide6/qml/QtQuick folder due to ilegal file names
|
||||||
# XXX Since we're not using Qml it should be no problem
|
# XXX Since we're not using Qml it should be no problem
|
||||||
if "\\build\\exe.win-amd64-3.12\\lib\\PySide6\\qml\\QtQuick" in dirname:
|
if "\\build\\exe.win-amd64-3.12\\lib\\PySide6\\qml\\QtQuick" in base_path:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
id_value = f"{id_prefix}{basename.capitalize().replace('-', '_')}"
|
next_dir_id = next_dir_prefix + entry.capitalize().replace("-", "_")
|
||||||
data["dirs"].append(
|
subdata = build_data(
|
||||||
build_data(
|
os.path.join(base_path, entry),
|
||||||
os.path.join(dirname, basename),
|
os.path.join(path_prefix, entry),
|
||||||
os.path.join(dir_prefix, basename),
|
next_dir_id,
|
||||||
id_value,
|
entry,
|
||||||
basename,
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if len(data["files"]) > 0:
|
# Add the subdirectory only if it contains files or subdirectories
|
||||||
if id_ == "INSTALLDIR":
|
if subdata["files"] or subdata["dirs"]:
|
||||||
data["component_id"] = "ApplicationFiles"
|
data["dirs"].append(subdata)
|
||||||
else:
|
|
||||||
data["component_id"] = "FolderComponent" + id_[len("Folder") :]
|
|
||||||
data["component_guid"] = str(uuid.uuid4())
|
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
def build_dir_xml(root, data):
|
def build_directory_xml(root, data):
|
||||||
attrs = {}
|
attrs = {}
|
||||||
if "id" in data:
|
attrs["Id"] = data["directory_id"]
|
||||||
attrs["Id"] = data["id"]
|
attrs["Name"] = data["directory_name"]
|
||||||
if "name" in data:
|
directory_el = ET.SubElement(root, "Directory", attrs)
|
||||||
attrs["Name"] = data["name"]
|
|
||||||
el = ET.SubElement(root, "Directory", attrs)
|
|
||||||
for subdata in data["dirs"]:
|
for subdata in data["dirs"]:
|
||||||
build_dir_xml(el, subdata)
|
build_directory_xml(directory_el, subdata)
|
||||||
|
|
||||||
# If this is the ProgramMenuFolder, add the menu component
|
|
||||||
if "id" in data and data["id"] == "ProgramMenuFolder":
|
|
||||||
component_el = ET.SubElement(
|
|
||||||
el,
|
|
||||||
"Component",
|
|
||||||
Id="ApplicationShortcuts",
|
|
||||||
Guid="539e7de8-a124-4c09-aa55-0dd516aad7bc",
|
|
||||||
)
|
|
||||||
ET.SubElement(
|
|
||||||
component_el,
|
|
||||||
"Shortcut",
|
|
||||||
Id="ApplicationShortcut1",
|
|
||||||
Name="Dangerzone",
|
|
||||||
Description="Dangerzone",
|
|
||||||
Target="[INSTALLDIR]dangerzone.exe",
|
|
||||||
WorkingDirectory="INSTALLDIR",
|
|
||||||
)
|
|
||||||
ET.SubElement(
|
|
||||||
component_el,
|
|
||||||
"RegistryValue",
|
|
||||||
Root="HKCU",
|
|
||||||
Key="Software\Freedom of the Press Foundation\Dangerzone",
|
|
||||||
Name="installed",
|
|
||||||
Type="integer",
|
|
||||||
Value="1",
|
|
||||||
KeyPath="yes",
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def build_components_xml(root, data):
|
def build_components_xml(root, data):
|
||||||
component_ids = []
|
component_el = ET.SubElement(
|
||||||
if "component_id" in data:
|
root,
|
||||||
component_ids.append(data["component_id"])
|
"Component",
|
||||||
|
Id=data["component_id"],
|
||||||
|
Guid=data["component_guid"],
|
||||||
|
Directory=data["directory_id"],
|
||||||
|
)
|
||||||
|
for filename in data["files"]:
|
||||||
|
ET.SubElement(component_el, "File", Source=filename)
|
||||||
for subdata in data["dirs"]:
|
for subdata in data["dirs"]:
|
||||||
if "component_guid" in subdata:
|
build_components_xml(root, subdata)
|
||||||
dir_ref_el = ET.SubElement(root, "DirectoryRef", Id=subdata["id"])
|
|
||||||
component_el = ET.SubElement(
|
|
||||||
dir_ref_el,
|
|
||||||
"Component",
|
|
||||||
Id=subdata["component_id"],
|
|
||||||
Guid=subdata["component_guid"],
|
|
||||||
)
|
|
||||||
for filename in subdata["files"]:
|
|
||||||
file_el = ET.SubElement(
|
|
||||||
component_el, "File", Source=filename, Id="file_" + uuid.uuid4().hex
|
|
||||||
)
|
|
||||||
|
|
||||||
component_ids += build_components_xml(root, subdata)
|
|
||||||
|
|
||||||
return component_ids
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
@ -123,122 +84,200 @@ 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.
|
||||||
version = f.read().strip().split("-")[0]
|
dangerzone_version = f.read().strip().split("-")[0]
|
||||||
|
|
||||||
dist_dir = os.path.join(
|
dangerzone_product_upgrade_code = "12B9695C-965B-4BE0-BC33-21274E809576"
|
||||||
|
|
||||||
|
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__)))),
|
||||||
"build",
|
"build",
|
||||||
"exe.win-amd64-3.12",
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
cx_freeze_dir = "exe.win-amd64-3.12"
|
||||||
|
|
||||||
|
dist_dir = os.path.join(build_dir, cx_freeze_dir)
|
||||||
|
|
||||||
if not os.path.exists(dist_dir):
|
if not os.path.exists(dist_dir):
|
||||||
print("You must build the dangerzone binary before running this")
|
print("You must build the dangerzone binary before running this")
|
||||||
return
|
return
|
||||||
|
|
||||||
data = {
|
# Prepare data for WiX file harvesting from the output of cx_Freeze
|
||||||
"id": "TARGETDIR",
|
data = build_data(
|
||||||
"name": "SourceDir",
|
dist_dir,
|
||||||
"dirs": [
|
cx_freeze_dir,
|
||||||
{
|
"INSTALLFOLDER",
|
||||||
"id": "ProgramFilesFolder",
|
"Dangerzone",
|
||||||
"dirs": [],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "ProgramMenuFolder",
|
|
||||||
"dirs": [],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
|
|
||||||
data["dirs"][0]["dirs"].append(
|
|
||||||
build_data(
|
|
||||||
dist_dir,
|
|
||||||
"exe.win-amd64-3.12",
|
|
||||||
"INSTALLDIR",
|
|
||||||
"Dangerzone",
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
root_el = ET.Element("Wix", xmlns="http://schemas.microsoft.com/wix/2006/wi")
|
# Add the Wix root element
|
||||||
product_el = ET.SubElement(
|
wix_el = ET.Element(
|
||||||
root_el,
|
"Wix",
|
||||||
"Product",
|
{
|
||||||
|
"xmlns": "http://wixtoolset.org/schemas/v4/wxs",
|
||||||
|
"xmlns:ui": "http://wixtoolset.org/schemas/v4/wxs/ui",
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
# Add the Package element
|
||||||
|
package_el = ET.SubElement(
|
||||||
|
wix_el,
|
||||||
|
"Package",
|
||||||
Name="Dangerzone",
|
Name="Dangerzone",
|
||||||
Manufacturer="Freedom of the Press Foundation",
|
Manufacturer="Freedom of the Press Foundation",
|
||||||
Id="*",
|
UpgradeCode=dangerzone_product_upgrade_code,
|
||||||
UpgradeCode="$(var.ProductUpgradeCode)",
|
|
||||||
Language="1033",
|
Language="1033",
|
||||||
Codepage="1252",
|
|
||||||
Version="$(var.ProductVersion)",
|
|
||||||
)
|
|
||||||
ET.SubElement(
|
|
||||||
product_el,
|
|
||||||
"Package",
|
|
||||||
Id="*",
|
|
||||||
Keywords="Installer",
|
|
||||||
Description="Dangerzone $(var.ProductVersion) Installer",
|
|
||||||
Manufacturer="Freedom of the Press Foundation",
|
|
||||||
InstallerVersion="100",
|
|
||||||
Languages="1033",
|
|
||||||
Compressed="yes",
|
Compressed="yes",
|
||||||
SummaryCodepage="1252",
|
Codepage="1252",
|
||||||
|
Version=dangerzone_version,
|
||||||
)
|
)
|
||||||
ET.SubElement(product_el, "Media", Id="1", Cabinet="product.cab", EmbedCab="yes")
|
|
||||||
ET.SubElement(
|
ET.SubElement(
|
||||||
product_el, "Icon", Id="ProductIcon", SourceFile="..\\share\\dangerzone.ico"
|
package_el,
|
||||||
|
"SummaryInformation",
|
||||||
|
Keywords="Installer",
|
||||||
|
Description="Dangerzone " + dangerzone_version + " Installer",
|
||||||
|
Codepage="1252",
|
||||||
)
|
)
|
||||||
ET.SubElement(product_el, "Property", Id="ARPPRODUCTICON", Value="ProductIcon")
|
ET.SubElement(package_el, "MediaTemplate", EmbedCab="yes")
|
||||||
ET.SubElement(
|
ET.SubElement(
|
||||||
product_el,
|
package_el, "Icon", Id="ProductIcon", SourceFile="..\\share\\dangerzone.ico"
|
||||||
|
)
|
||||||
|
ET.SubElement(package_el, "Property", Id="ARPPRODUCTICON", Value="ProductIcon")
|
||||||
|
ET.SubElement(
|
||||||
|
package_el,
|
||||||
"Property",
|
"Property",
|
||||||
Id="ARPHELPLINK",
|
Id="ARPHELPLINK",
|
||||||
Value="https://dangerzone.rocks",
|
Value="https://dangerzone.rocks",
|
||||||
)
|
)
|
||||||
ET.SubElement(
|
ET.SubElement(
|
||||||
product_el,
|
package_el,
|
||||||
"Property",
|
"Property",
|
||||||
Id="ARPURLINFOABOUT",
|
Id="ARPURLINFOABOUT",
|
||||||
Value="https://freedom.press",
|
Value="https://freedom.press",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
ui_el = ET.SubElement(package_el, "UI")
|
||||||
|
|
||||||
ET.SubElement(
|
ET.SubElement(
|
||||||
product_el,
|
ui_el, "ui:WixUI", Id="WixUI_InstallDir", InstallDirectory="INSTALLFOLDER"
|
||||||
"Property",
|
|
||||||
Id="WIXUI_INSTALLDIR",
|
|
||||||
Value="INSTALLDIR",
|
|
||||||
)
|
)
|
||||||
ET.SubElement(product_el, "UIRef", Id="WixUI_InstallDir")
|
ET.SubElement(ui_el, "UIRef", Id="WixUI_ErrorProgressText")
|
||||||
ET.SubElement(product_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(
|
ET.SubElement(
|
||||||
product_el,
|
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",
|
"WixVariable",
|
||||||
Id="WixUILicenseRtf",
|
Id="WixUILicenseRtf",
|
||||||
Value="..\\install\\windows\\license.rtf",
|
Value="..\\install\\windows\\license.rtf",
|
||||||
)
|
)
|
||||||
ET.SubElement(
|
ET.SubElement(
|
||||||
product_el,
|
package_el,
|
||||||
"WixVariable",
|
"WixVariable",
|
||||||
Id="WixUIDialogBmp",
|
Id="WixUIDialogBmp",
|
||||||
Value="..\\install\\windows\\dialog.bmp",
|
Value="..\\install\\windows\\dialog.bmp",
|
||||||
)
|
)
|
||||||
ET.SubElement(
|
ET.SubElement(
|
||||||
product_el,
|
package_el,
|
||||||
"MajorUpgrade",
|
"MajorUpgrade",
|
||||||
AllowSameVersionUpgrades="yes",
|
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.",
|
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.",
|
||||||
)
|
)
|
||||||
|
|
||||||
build_dir_xml(product_el, data)
|
# Add the ProgramMenuFolder StandardDirectory
|
||||||
component_ids = build_components_xml(product_el, data)
|
programmenufolder_el = ET.SubElement(
|
||||||
|
package_el,
|
||||||
|
"StandardDirectory",
|
||||||
|
Id="ProgramMenuFolder",
|
||||||
|
)
|
||||||
|
|
||||||
feature_el = ET.SubElement(product_el, "Feature", Id="DefaultFeature", Level="1")
|
shortcut_el = ET.SubElement(
|
||||||
for component_id in component_ids:
|
programmenufolder_el,
|
||||||
ET.SubElement(feature_el, "ComponentRef", Id=component_id)
|
"Component",
|
||||||
|
Id="ApplicationShortcuts",
|
||||||
|
Guid="539E7DE8-A124-4C09-AA55-0DD516AAD7BC",
|
||||||
|
)
|
||||||
|
ET.SubElement(
|
||||||
|
shortcut_el,
|
||||||
|
"Shortcut",
|
||||||
|
Id="DangerzoneStartMenuShortcut",
|
||||||
|
Name="Dangerzone",
|
||||||
|
Description="Dangerzone",
|
||||||
|
Target="[INSTALLFOLDER]dangerzone.exe",
|
||||||
|
WorkingDirectory="INSTALLFOLDER",
|
||||||
|
)
|
||||||
|
ET.SubElement(
|
||||||
|
shortcut_el,
|
||||||
|
"RegistryValue",
|
||||||
|
Root="HKCU",
|
||||||
|
Key="Software\\Freedom of the Press Foundation\\Dangerzone",
|
||||||
|
Name="installed",
|
||||||
|
Type="integer",
|
||||||
|
Value="1",
|
||||||
|
KeyPath="yes",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Add the ProgramFilesFolder StandardDirectory
|
||||||
|
programfilesfolder_el = ET.SubElement(
|
||||||
|
package_el,
|
||||||
|
"StandardDirectory",
|
||||||
|
Id="ProgramFiles64Folder",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Generate the directory layout for the installed product
|
||||||
|
build_directory_xml(programfilesfolder_el, data)
|
||||||
|
|
||||||
|
applicationcomponents_el = ET.SubElement(
|
||||||
|
package_el, "ComponentGroup", Id="ApplicationComponents"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Generate the components for the installed product
|
||||||
|
build_components_xml(applicationcomponents_el, data)
|
||||||
|
|
||||||
|
# Add the Feature element
|
||||||
|
feature_el = ET.SubElement(package_el, "Feature", Id="DefaultFeature", Level="1")
|
||||||
|
ET.SubElement(feature_el, "ComponentGroupRef", Id="ApplicationComponents")
|
||||||
ET.SubElement(feature_el, "ComponentRef", Id="ApplicationShortcuts")
|
ET.SubElement(feature_el, "ComponentRef", Id="ApplicationShortcuts")
|
||||||
|
|
||||||
print('<?xml version="1.0" encoding="windows-1252"?>')
|
ET.indent(wix_el, space=" ")
|
||||||
print(f'<?define ProductVersion = "{version}"?>')
|
|
||||||
print('<?define ProductUpgradeCode = "12b9695c-965b-4be0-bc33-21274e809576"?>')
|
with open(os.path.join(build_dir, "Dangerzone.wxs"), "w") as wxs_file:
|
||||||
ET.indent(root_el)
|
wxs_file.write(ET.tostring(wix_el).decode())
|
||||||
print(ET.tostring(root_el).decode())
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Reference in a new issue