From 5518645dfdfd1250dcabd98bda5d71d18eb4edcc Mon Sep 17 00:00:00 2001 From: kali Date: Fri, 25 Sep 2020 16:49:46 +0200 Subject: [pkg] windows helper and qtinstaller --- branding/qtinstaller/config/config.xml | 9 +++ .../packages/root.win_x86_64/.gitignore | 1 + .../packages/root.win_x86_64/meta/installscript.js | 75 ++++++++++++++++++++++ .../packages/root.win_x86_64/meta/package.xml | 10 +++ .../qtinstaller/packages/root/meta/package.xml | 7 ++ 5 files changed, 102 insertions(+) create mode 100644 branding/qtinstaller/config/config.xml create mode 100644 branding/qtinstaller/packages/root.win_x86_64/.gitignore create mode 100644 branding/qtinstaller/packages/root.win_x86_64/meta/installscript.js create mode 100644 branding/qtinstaller/packages/root.win_x86_64/meta/package.xml create mode 100644 branding/qtinstaller/packages/root/meta/package.xml (limited to 'branding/qtinstaller') diff --git a/branding/qtinstaller/config/config.xml b/branding/qtinstaller/config/config.xml new file mode 100644 index 0000000..4469d65 --- /dev/null +++ b/branding/qtinstaller/config/config.xml @@ -0,0 +1,9 @@ + + + DemoLibVPN + 0.0.1 + DemoLibVPN Installer + LEAP Encryption Access Project + DemoLibVPN + @ApplicationsDir@/DemoLibVPN + diff --git a/branding/qtinstaller/packages/root.win_x86_64/.gitignore b/branding/qtinstaller/packages/root.win_x86_64/.gitignore new file mode 100644 index 0000000..60baa9c --- /dev/null +++ b/branding/qtinstaller/packages/root.win_x86_64/.gitignore @@ -0,0 +1 @@ +data/* diff --git a/branding/qtinstaller/packages/root.win_x86_64/meta/installscript.js b/branding/qtinstaller/packages/root.win_x86_64/meta/installscript.js new file mode 100644 index 0000000..691d1a4 --- /dev/null +++ b/branding/qtinstaller/packages/root.win_x86_64/meta/installscript.js @@ -0,0 +1,75 @@ +/* +** +** Copyright (C) 2020 LEAP Encryption Access Project. +** +*/ + +function cancelInstaller(message) +{ + installer.setDefaultPageVisible(QInstaller.Introduction, false); + installer.setDefaultPageVisible(QInstaller.TargetDirectory, false); + installer.setDefaultPageVisible(QInstaller.ComponentSelection, false); + installer.setDefaultPageVisible(QInstaller.ReadyForInstallation, false); + installer.setDefaultPageVisible(QInstaller.StartMenuSelection, false); + installer.setDefaultPageVisible(QInstaller.PerformInstallation, false); + installer.setDefaultPageVisible(QInstaller.LicenseCheck, false); + + var abortText = "" + message +""; + installer.setValue("FinishedText", abortText); +} +function majorVersion(str) +{ + return parseInt(str.split(".", 1)); +} + +function Component() +{ + // Check whether OS is supported. + // start installer with -v to see debug output + + console.log("OS: " + systemInfo.productType); + console.log("Kernel: " + systemInfo.kernelType + "/" + systemInfo.kernelVersion); + + var validOs = false; + + if (systemInfo.kernelType === "winnt") { + if (majorVersion(systemInfo.kernelVersion) >= 6) + validOs = true; + } else if (systemInfo.kernelType === "darwin") { + if (majorVersion(systemInfo.kernelVersion) >= 11) + validOs = true; + } else { + if (systemInfo.productType !== "ubuntu" + || systemInfo.productVersion !== "20.04") { + QMessageBox["warning"]("os.warning", "Installer", + "Note that the binaries are only tested on Ubuntu 20.04", + QMessageBox.Ok); + } + validOs = true; + } + + if (!validOs) { + cancelInstaller("Installation on " + systemInfo.prettyProductName + " is not supported"); + return; + } + + console.log("CPU Architecture: " + systemInfo.currentCpuArchitecture); + + if ( systemInfo.kernelType === "winnt") { + installer.componentByName("root.win_x86_64").setValue("Default", "true"); + installer.componentByName("root.win_x86_64").setValue("Virtual", "false"); + } +} + +Component.prototype.createOperations = function() +{ + component.createOperations() + component.addElevatedOperation("Execute", "@TargetDir@/helper.exe", "install", "UNDOEXECUTE", "@TargetDir@/helper.exe", "remove"); + component.addElevatedOperation("Execute", "@TargetDir@/helper.exe", "start", "UNDOEXECUTE", "@TargetDir@/helper.exe", "stop"); + if (systemInfo.productType === "windows") { + console.log("Adding shortcut entries"); + component.addElevatedOperation("Mkdir", "@StartMenuDir@"); + component.addElevatedOperation("CreateShortcut", "@TargetDir@/demolib-vpn.exe", "@StartMenuDir@/DemoLibVPN.lnk", "workingDirectory=@TargetDir@", "iconPath=%SystemRoot%/system32/SHELL32.dll", "iconId=2", "description=Start DemoLibVPN"); + component.addElevatedOperation("CreateShortcut", "@TargetDir@/maintenancetool.exe", "@StartMenuDir@/uninstall.lnk", "workingDirectory=@TargetDir@", "iconPath=%SystemRoot%/system32/SHELL32.dll", "iconId=2", "description=Uninstall application"); + } +} diff --git a/branding/qtinstaller/packages/root.win_x86_64/meta/package.xml b/branding/qtinstaller/packages/root.win_x86_64/meta/package.xml new file mode 100644 index 0000000..11d630f --- /dev/null +++ b/branding/qtinstaller/packages/root.win_x86_64/meta/package.xml @@ -0,0 +1,10 @@ + + + DemoLibVPN For Windows + Install DemoLibVPN + 0.0.1-1 + 2020-09-15 + true + true + + diff --git a/branding/qtinstaller/packages/root/meta/package.xml b/branding/qtinstaller/packages/root/meta/package.xml new file mode 100644 index 0000000..b4ca25e --- /dev/null +++ b/branding/qtinstaller/packages/root/meta/package.xml @@ -0,0 +1,7 @@ + + + DemoLibVPN + 0.0.1-1 + 2020-09-15 + script + -- cgit v1.2.3