summaryrefslogtreecommitdiff
path: root/branding
diff options
context:
space:
mode:
authorkali <kali@leap.se>2020-09-30 16:25:27 +0200
committerRuben Pollan <meskio@sindominio.net>2020-10-13 19:08:44 +0200
commitef892643df8970aec45dbc3f48eabb95a1ccbf22 (patch)
tree1a20c34cca7b94e69468e471790996fa61909805 /branding
parent47ac0543b9ed2d4afb8814a19e2f4dc3c30030e1 (diff)
[pkg] osx helper and working qt installer
Diffstat (limited to 'branding')
-rw-r--r--branding/scripts/gen-providers-json.py1
-rwxr-xr-xbranding/scripts/getparam36
-rw-r--r--branding/templates/bitmaskvpn/config.go31
-rw-r--r--branding/templates/qtinstaller/config/config.xml22
-rw-r--r--branding/templates/qtinstaller/installer.pro36
-rwxr-xr-xbranding/templates/qtinstaller/osx/post-install.py (renamed from branding/installer/post-install.py)4
-rw-r--r--branding/templates/qtinstaller/osx/se.leap.bitmask-helper.plist (renamed from branding/installer/osx/se.leap.bitmask-helper.plist)0
-rw-r--r--branding/templates/qtinstaller/packages/bitmaskvpn/.gitignore1
-rw-r--r--branding/templates/qtinstaller/packages/bitmaskvpn/meta/install.js53
-rw-r--r--branding/templates/qtinstaller/packages/bitmaskvpn/meta/package.xml11
10 files changed, 163 insertions, 32 deletions
diff --git a/branding/scripts/gen-providers-json.py b/branding/scripts/gen-providers-json.py
index beef3fe..c89217a 100644
--- a/branding/scripts/gen-providers-json.py
+++ b/branding/scripts/gen-providers-json.py
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
+
import configparser
import json
import os
diff --git a/branding/scripts/getparam b/branding/scripts/getparam
new file mode 100755
index 0000000..2b87e1e
--- /dev/null
+++ b/branding/scripts/getparam
@@ -0,0 +1,36 @@
+#!/usr/bin/env python3
+
+# A short utility to get appname in compilation time.
+# This is a convenience to build helpers while we move the branding mechanism to a separate repo.
+
+import configparser
+
+import os
+import sys
+
+from provider import getDefaultProvider
+from provider import getProviderData
+
+def getData():
+ here = os.path.abspath(os.path.dirname(__file__))
+ configPath = os.path.join(here, '../../branding/config/vendor.conf')
+ if not os.path.isfile(configPath):
+ print("ERROR: path does not exist", config)
+ os.exit(1)
+ config = configparser.ConfigParser()
+ config.read(configPath)
+ defaultProvider = getDefaultProvider(config)
+ return getProviderData(getDefaultProvider(config), config)
+
+if __name__ == "__main__":
+ param = sys.argv[1]
+ if param == "appname":
+ field = "applicationName"
+ elif param == "binname":
+ field = "binaryName"
+ else:
+ print("ERROR: unknown param")
+ sys.exit(1)
+
+ data = getData()
+ print(data[field])
diff --git a/branding/templates/bitmaskvpn/config.go b/branding/templates/bitmaskvpn/config.go
deleted file mode 100644
index e3d70cf..0000000
--- a/branding/templates/bitmaskvpn/config.go
+++ /dev/null
@@ -1,31 +0,0 @@
-// Code generated by go generate; DO NOT EDIT.
-// This file was generated by vendorize.py
-// At $timeStamp
-
-package config
-
-/* All these constants are defined in the vendor.conf file
- */
-const (
- Provider = "$providerURL"
- ApplicationName = "$applicationName"
- BinaryName = "$binaryName"
- Auth = "$auth"
- DonateURL = "$donateURL"
- AskForDonations = "$askForDonations"
- HelpURL = "$helpURL"
- TosURL = "$tosURL"
- APIURL = "$apiURL"
- GeolocationAPI = "$geolocationAPI"
-)
-
-var Version string
-
-/*
-
-CaCert : a string containing a representation of the provider CA, used to
- sign the webapp and openvpn certificates. should be placed in
- config/[provider]-ca.crt
-
-*/
-var CaCert = []byte(`$caCertString`)
diff --git a/branding/templates/qtinstaller/config/config.xml b/branding/templates/qtinstaller/config/config.xml
new file mode 100644
index 0000000..936726d
--- /dev/null
+++ b/branding/templates/qtinstaller/config/config.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Installer>
+ <Name>DemoLibVPN-0.0.1</Name>
+ <Version>0.0.1</Version>
+ <Title>DemoLibVPN Installer</Title>
+ <Publisher>LEAP Encryption Access Project</Publisher>
+ <TargetDir>@ApplicationsDir@/DemoLibVPN</TargetDir>
+ <RunProgram>@TargetDir@/demolib-vpn.app</RunProgram>
+ <RunProgramArguments>
+ </RunProgramArguments>
+ <StartMenuDir>DemoLibVPN</StartMenuDir>
+ <AllowNonAsciiCharacters>false</AllowNonAsciiCharacters>
+ <!--
+ <RemoteRepositories>
+ <Repository>
+ <Url>http://localhost/repository/</Url>
+ </Repository>
+ </RemoteRepositories>
+ -->
+ <MaintenanceToolName>Uninstall-DemoLibVPN</MaintenanceToolName>
+ <WizardStyle>mac</WizardStyle>
+</Installer>
diff --git a/branding/templates/qtinstaller/installer.pro b/branding/templates/qtinstaller/installer.pro
new file mode 100644
index 0000000..ec800c1
--- /dev/null
+++ b/branding/templates/qtinstaller/installer.pro
@@ -0,0 +1,36 @@
+!defined(INSTALLER, var):INSTALLER= "BitmaskVPN-Installer-git"
+TEMPLATE = aux
+CONFIG -= debug_and_release
+
+INPUT = $$PWD/config/config.xml $$PWD/packages
+inst.input = INPUT
+inst.output = $$INSTALLER
+inst.commands = binarycreator -c $$PWD/config/config.xml -p $$PWD/packages ${QMAKE_FILE_OUT}
+inst.CONFIG += target_predeps no_link combine
+
+QMAKE_EXTRA_COMPILERS += inst
+
+OTHER_FILES += \
+# watch out... it chokes with dashes in the path
+ packages/riseupvpn/meta/package.xml \
+ packages/riseupvpn/meta/install.js \
+ packages/riseupvpn/data/README.txt \
+
+macx {
+ OTHER_FILES += "packages/riseupvpn/data/riseup-vpn.app"
+ OTHER_FILES += "packages/riseupvpn/data/bitmask-helper"
+ OTHER_FILES += "packages/riseupvpn/data/installer.py"
+ OTHER_FILES += "packages/riseupvpn/data/se.leap.bitmask-helper.plist"
+ OTHER_FILES += "packages/riseupvpn/data/openvpn.leap"
+ OTHER_FILES += "packages/riseupvpn/data/helper/bitmask.pf.conf"
+ OTHER_FILES += "packages/riseupvpn/data/client.up.sh"
+ OTHER_FILES += "packages/riseupvpn/data/client.down.sh"
+}
+linux {
+ OTHER_FILES += "packages/riseupvpn/data/riseup-vpn"
+ OTHER_FILES += "packages/riseupvpn/data/bitmask-helper"
+}
+win32{
+ OTHER_FILES += "packages/riseupvpn/data/riseup-vpn.exe"
+ OTHER_FILES += "packages/riseupvpn/data/helper.exe"
+}
diff --git a/branding/installer/post-install.py b/branding/templates/qtinstaller/osx/post-install.py
index 02da859..32b4780 100755
--- a/branding/installer/post-install.py
+++ b/branding/templates/qtinstaller/osx/post-install.py
@@ -32,8 +32,9 @@ def main():
log.write("Copy launch daemon...\n")
copyLaunchDaemon()
+ log.write("Trying to launch helper...\n")
out = launchHelper()
- log.write("Copy plist: %s \n" % str(ok))
+ log.write("result: %s \n" % str(out))
grantPermissionsOnLogFolder()
@@ -52,6 +53,7 @@ def isHelperRunning():
def unloadHelper():
out = subprocess.call(["launchctl", "unload", HELPER_PLIST])
+ out2 = subprocess.call(["pkill", "-9", "bitmask-helper"]) # just in case
return out == 0
def fixHelperOwner(log):
diff --git a/branding/installer/osx/se.leap.bitmask-helper.plist b/branding/templates/qtinstaller/osx/se.leap.bitmask-helper.plist
index c9d9687..c9d9687 100644
--- a/branding/installer/osx/se.leap.bitmask-helper.plist
+++ b/branding/templates/qtinstaller/osx/se.leap.bitmask-helper.plist
diff --git a/branding/templates/qtinstaller/packages/bitmaskvpn/.gitignore b/branding/templates/qtinstaller/packages/bitmaskvpn/.gitignore
new file mode 100644
index 0000000..60baa9c
--- /dev/null
+++ b/branding/templates/qtinstaller/packages/bitmaskvpn/.gitignore
@@ -0,0 +1 @@
+data/*
diff --git a/branding/templates/qtinstaller/packages/bitmaskvpn/meta/install.js b/branding/templates/qtinstaller/packages/bitmaskvpn/meta/install.js
new file mode 100644
index 0000000..f9c85f2
--- /dev/null
+++ b/branding/templates/qtinstaller/packages/bitmaskvpn/meta/install.js
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 LEAP
+**
+****************************************************************************/
+
+function Component() {
+}
+
+Component.prototype.createOperations = function ()
+{
+ // This will actually install the files
+ component.createOperations();
+
+ // And now our custom actions.
+ // See https://doc.qt.io/qtinstallerframework/operations.html for reference
+ //
+ // We can also use this to register different components (different architecture for instance)
+ // See https://doc.qt.io/qtinstallerframework/qt-installer-framework-systeminfo-packages-root-meta-installscript-qs.html
+
+ if (systemInfo.productType === "windows") {
+ postInstallWindows();
+ } else if (systemInfo.productType === "osx") {
+ postInstallOSX();
+ } else {
+ postInstallLinux();
+ }
+}
+
+function postInstallWindows() {
+ component.addOperation(
+ "CreateShortcut",
+ "@TargetDir@/README.txt",
+ "@StartMenuDir@/README.lnk",
+ "workingDirectory=@TargetDir@",
+ "iconPath=%SystemRoot%/system32/SHELL32.dll",
+ "iconId=2");
+}
+
+function postInstallOSX() {
+ console.log("Post-installation for OSX");
+ // TODO add UNDOEXECUTE for the uninstaller
+ component.addElevatedOperation(
+ "Execute", "{0}",
+ "@TargetDir@/post-install.py",
+ "errormessage=There was an error during the post-installation script, things might be broken. Please report this error and attach the post-install.log file.");
+}
+
+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");
+}
diff --git a/branding/templates/qtinstaller/packages/bitmaskvpn/meta/package.xml b/branding/templates/qtinstaller/packages/bitmaskvpn/meta/package.xml
new file mode 100644
index 0000000..b910e7f
--- /dev/null
+++ b/branding/templates/qtinstaller/packages/bitmaskvpn/meta/package.xml
@@ -0,0 +1,11 @@
+<?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>
+ <Default>false</Default>
+ <RequiresAdminRights>true</RequiresAdminRights>
+ <Script>install.js</Script>
+ <ForcedInstallation>true</ForcedInstallation>
+</Package>