diff options
author | kali <kali@leap.se> | 2020-10-08 03:04:25 +0200 |
---|---|---|
committer | Ruben Pollan <meskio@sindominio.net> | 2020-10-13 19:08:50 +0200 |
commit | 4d9d578902aae37d62ea3218efa2b062cb7f893f (patch) | |
tree | 39c96fc5d3cb7703e2fbea07e5782fcdb4b4189a /branding/templates/qtinstaller | |
parent | c77ba97502da5c954447abf738ab78108d1b0892 (diff) |
[pkg] parametrize win/osx installer
Diffstat (limited to 'branding/templates/qtinstaller')
-rw-r--r-- | branding/templates/qtinstaller/config/config.xml | 21 | ||||
-rw-r--r-- | branding/templates/qtinstaller/linux-data/readme | 1 | ||||
-rwxr-xr-x | branding/templates/qtinstaller/osx-data/post-install.py (renamed from branding/templates/qtinstaller/osx/post-install.py) | 0 | ||||
-rw-r--r-- | branding/templates/qtinstaller/osx-data/se.leap.bitmask-helper.plist (renamed from branding/templates/qtinstaller/osx/se.leap.bitmask-helper.plist) | 0 | ||||
-rwxr-xr-x | branding/templates/qtinstaller/osx-data/uninstall.py (renamed from branding/templates/qtinstaller/osx/uninstall.py) | 0 | ||||
-rw-r--r-- | branding/templates/qtinstaller/packages/bitmaskvpn/meta/install.js | 64 | ||||
-rw-r--r-- | branding/templates/qtinstaller/packages/bitmaskvpn/meta/package.xml | 8 | ||||
-rw-r--r-- | branding/templates/qtinstaller/win-data/readme | 1 |
8 files changed, 70 insertions, 25 deletions
diff --git a/branding/templates/qtinstaller/config/config.xml b/branding/templates/qtinstaller/config/config.xml index 8b28be6..c02b0a6 100644 --- a/branding/templates/qtinstaller/config/config.xml +++ b/branding/templates/qtinstaller/config/config.xml @@ -1,13 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <Installer> - - <Name>DemoLibVPN-0.0.1</Name> - <Version>0.0.1</Version> - <Title>DemoLibVPN Installer</Title> + <Name>$APPNAME-$VERSION</Name> + <Version>$VERSION</Version> + <Title>$APPNAME Installer ($VERSION)</Title> <Publisher>LEAP Encryption Access Project</Publisher> - <TargetDir>@ApplicationsDir@/DemoLibVPN.app</TargetDir> - - <StartMenuDir>DemoLibVPN.app</StartMenuDir> <AllowNonAsciiCharacters>false</AllowNonAsciiCharacters> <!-- @@ -18,15 +14,8 @@ </RemoteRepositories> --> - <MaintenanceToolName>Uninstall-DemoLibVPN</MaintenanceToolName> + <MaintenanceToolName>Uninstall-$APPNAME</MaintenanceToolName> - <!-- osx run --> - <RunProgram>open</RunProgram> - <RunProgramDescription>Start DemoLibVPN now!</RunProgramDescription> - <RunProgramArguments> - <Argument>@TargetDir@</Argument> - </RunProgramArguments> - <WizardStyle>mac</WizardStyle> - <!-- end osx run --> + $PLATFORM_BLOCK </Installer> diff --git a/branding/templates/qtinstaller/linux-data/readme b/branding/templates/qtinstaller/linux-data/readme new file mode 100644 index 0000000..e039088 --- /dev/null +++ b/branding/templates/qtinstaller/linux-data/readme @@ -0,0 +1 @@ +linux-specific installer data diff --git a/branding/templates/qtinstaller/osx/post-install.py b/branding/templates/qtinstaller/osx-data/post-install.py index 2c15845..2c15845 100755 --- a/branding/templates/qtinstaller/osx/post-install.py +++ b/branding/templates/qtinstaller/osx-data/post-install.py diff --git a/branding/templates/qtinstaller/osx/se.leap.bitmask-helper.plist b/branding/templates/qtinstaller/osx-data/se.leap.bitmask-helper.plist index c333aba..c333aba 100644 --- a/branding/templates/qtinstaller/osx/se.leap.bitmask-helper.plist +++ b/branding/templates/qtinstaller/osx-data/se.leap.bitmask-helper.plist diff --git a/branding/templates/qtinstaller/osx/uninstall.py b/branding/templates/qtinstaller/osx-data/uninstall.py index 7aa8a56..7aa8a56 100755 --- a/branding/templates/qtinstaller/osx/uninstall.py +++ b/branding/templates/qtinstaller/osx-data/uninstall.py diff --git a/branding/templates/qtinstaller/packages/bitmaskvpn/meta/install.js b/branding/templates/qtinstaller/packages/bitmaskvpn/meta/install.js index 0bcaeef..361e14d 100644 --- a/branding/templates/qtinstaller/packages/bitmaskvpn/meta/install.js +++ b/branding/templates/qtinstaller/packages/bitmaskvpn/meta/install.js @@ -1,10 +1,64 @@ /**************************************************************************** ** -** Copyright (C) 2020 LEAP +** Copyright (C) 2020 LEAP Encryption Access Project ** ****************************************************************************/ +function majorVersion(str) +{ + return parseInt(str.split(".", 1)); +} + +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 = "<font color='red'>" + message +"</font>"; + installer.setValue("FinishedText", abortText); +} + 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 () @@ -31,7 +85,7 @@ Component.prototype.installationFinished = function() { console.log("DEBUG: running installationFinished"); if (installer.isInstaller() && installer.status == QInstaller.Success) { - var argList = ["-a", "@TargetDir@/DemoLibVPN.app"]; + var argList = ["-a", "@TargetDir@/$APPNAME.app"]; try { installer.execute("touch", ["/tmp/install-finished"]); installer.execute("open", argList); @@ -46,12 +100,12 @@ function postInstallWindows() { component.addElevatedOperation("Execute", "@TargetDir@/helper.exe", "start", "UNDOEXECUTE", "@TargetDir@/helper.exe", "stop"); console.log("Adding shortcut entries"); component.addElevatedOperation("Mkdir", "@StartMenuDir@"); - component.addElevatedOperation("CreateShortcut", "@TargetDir@/demolib-vpn.exe", "@StartMenuDir@/DemoLibVPN.lnk", "workingDirectory=@TargetDir@", "iconPath=@TargetDir@/icon.ico", "description=Start DemoLibVPN"); + component.addElevatedOperation("CreateShortcut", "@TargetDir@/$BINNAME.exe", "@StartMenuDir@/$APPNAME.lnk", "workingDirectory=@TargetDir@", "iconPath=@TargetDir@/icon.ico", "description=Start $APPNAME"); // TODO I think this one is not being created because the path doesn't exist yet. We might want to do this by hooking on the installation finished signal instead. component.addElevatedOperation( "CreateShortcut", - "@TargetDir@/Uninstall-DemoLibVPN.exe", + "@TargetDir@/Uninstall-$APPNAME.exe", "@StartMenuDir@/Uninstall.lnk" ); } @@ -70,5 +124,5 @@ function postInstallOSX() { function postInstallLinux() { console.log("Post-installation for GNU/Linux"); console.log("Maybe you want to use your package manager instead?"); - component.addOperation("AppendFile", "/tmp/riseupvpn.log", "this is a test - written from the installer"); + component.addOperation("AppendFile", "/tmp/bitmask-installer.log", "this is a test - written from the installer"); } diff --git a/branding/templates/qtinstaller/packages/bitmaskvpn/meta/package.xml b/branding/templates/qtinstaller/packages/bitmaskvpn/meta/package.xml index b910e7f..0e56f4f 100644 --- a/branding/templates/qtinstaller/packages/bitmaskvpn/meta/package.xml +++ b/branding/templates/qtinstaller/packages/bitmaskvpn/meta/package.xml @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <Package> - <DisplayName>DemoLibVPN</DisplayName> - <Description>DemoLibVPN</Description> - <Version>0.20.9-1</Version> - <ReleaseDate>2020-10-01</ReleaseDate> + <DisplayName>$APPNAME</DisplayName> + <Description>$APPNAME</Description> + <Version>$VERSION</Version> + <ReleaseDate>$TIMESTAMP</ReleaseDate> <Default>false</Default> <RequiresAdminRights>true</RequiresAdminRights> <Script>install.js</Script> diff --git a/branding/templates/qtinstaller/win-data/readme b/branding/templates/qtinstaller/win-data/readme new file mode 100644 index 0000000..8938b54 --- /dev/null +++ b/branding/templates/qtinstaller/win-data/readme @@ -0,0 +1 @@ +windows-specific installer data |