Package native DUO-RDP 2.2.0 with Inno Setup wizard
This commit is contained in:
1 parent
d05253ba84
commit
d60c0bb5be
10 files changed
+280
-8
No files matched your search
@@ -0,0 +1,61 @@
|
||||
"""Package the native CMake install layout with Inno Setup 7.
|
||||
|
||||
Windows: python scripts/package_release.py --dist build/native/release --iscc C:/Inno/ISCC.exe
|
||||
Linux: add --wine /usr/lib/wine/wine64 (run under xvfb-run when headless).
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import hashlib
|
||||
from pathlib import Path
|
||||
import re
|
||||
import subprocess
|
||||
import zipfile
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
REQUIRED = (
|
||||
"DuoRdpInstaller.exe", "DUOUnIstall.exe", "payload/DUOUnIstall.exe",
|
||||
"payload/DuoRdpAuthService.exe", "payload/DuoRdpAdmin.exe",
|
||||
"payload/DuoRdpCredentialProvider.dll",
|
||||
)
|
||||
|
||||
|
||||
def windows_path(path: Path, wine: str | None) -> str:
|
||||
return "Z:" + str(path.resolve()).replace("/", "\\") if wine else str(path.resolve())
|
||||
|
||||
|
||||
def main() -> None:
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--dist", type=Path, required=True)
|
||||
parser.add_argument("--iscc", type=Path, required=True)
|
||||
parser.add_argument("--wine")
|
||||
parser.add_argument("--output", type=Path, default=ROOT / "artifacts")
|
||||
args = parser.parse_args()
|
||||
version = re.search(r"project\(DuoRdpNative VERSION ([\d.]+)",
|
||||
(ROOT / "CMakeLists.txt").read_text()).group(1)
|
||||
for name in REQUIRED:
|
||||
path = args.dist / name
|
||||
if not path.is_file() or path.read_bytes()[:2] != b"MZ":
|
||||
raise ValueError(f"Missing Windows binary: {path}")
|
||||
# Explicit allowlist prevents configs, keys and local backup files leaking.
|
||||
args.output.mkdir(parents=True, exist_ok=True)
|
||||
portable = args.output / f"DUO-RDP-Portable-{version}-x64.zip"
|
||||
with zipfile.ZipFile(portable, "w", zipfile.ZIP_DEFLATED) as archive:
|
||||
for name in REQUIRED:
|
||||
archive.write(args.dist / name, name)
|
||||
for source, name in [(ROOT / "packaging/README.txt", "README.txt"),
|
||||
(ROOT / "LICENSE", "LICENSE"),
|
||||
(ROOT / "THIRD_PARTY_NOTICES.md", "THIRD_PARTY_NOTICES.md")]:
|
||||
archive.write(source, name)
|
||||
command = ([args.wine] if args.wine else []) + [str(args.iscc.resolve()),
|
||||
"/DAppVersion=" + version,
|
||||
"/DAppDist=" + windows_path(args.dist, args.wine),
|
||||
"/DReleaseDir=" + windows_path(args.output, args.wine),
|
||||
windows_path(ROOT / "packaging/DuoRdp.iss", args.wine)]
|
||||
subprocess.run(command, cwd=ROOT, check=True)
|
||||
for path in [portable, args.output / f"DUO-RDP-Setup-{version}-x64.exe"]:
|
||||
print(hashlib.sha256(path.read_bytes()).hexdigest(), path.name)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in new issue
Block a user