diff options
author | kali <kali@leap.se> | 2020-12-02 21:46:06 +0100 |
---|---|---|
committer | kali kaneko (leap communications) <kali@leap.se> | 2021-02-08 23:32:12 +0100 |
commit | f5e7a5d2cab5fc3cfca8c5f75e57090cda27c4e1 (patch) | |
tree | 256ab35abca7e1995a0fb349167ddf86ca37fa51 /branding | |
parent | ee566492264882b5024876180113d4800a29dbda (diff) |
[pkg] add uninstaller to pre-install in osx
Diffstat (limited to 'branding')
-rwxr-xr-x | branding/templates/qtinstaller/osx-data/uninstall.py | 12 | ||||
-rw-r--r-- | branding/templates/qtinstaller/packages/bitmaskvpn/meta/install.js | 12 |
2 files changed, 20 insertions, 4 deletions
diff --git a/branding/templates/qtinstaller/osx-data/uninstall.py b/branding/templates/qtinstaller/osx-data/uninstall.py index 7aa8a56..7520321 100755 --- a/branding/templates/qtinstaller/osx-data/uninstall.py +++ b/branding/templates/qtinstaller/osx-data/uninstall.py @@ -12,8 +12,9 @@ HELPER_PLIST = "/Library/LaunchDaemons/se.leap.bitmask-helper.plist" _dir = os.path.dirname(os.path.realpath(__file__)) -def main(): - log = open(os.path.join('/tmp', 'bitmask-uninstall.log'), 'w') +def main(stage="uninstall"): + logfile = "bitmask-{stage}.log".format(stage=stage) + log = open(os.path.join('/tmp', logfile), 'w') log.write('Checking for admin privileges...\n') _id = os.getuid() @@ -37,7 +38,7 @@ def main(): log.write("result: %s \n" % str(out)) # all done - log.write('uninstall script: done\n') + log.write(stage + ' script: done\n') sys.exit(0) @@ -67,4 +68,7 @@ def _getProcessList(): return _out if __name__ == "__main__": - main() + stage="uninstall" + if len(sys.argv) > 2 and sys.argv[2] == "pre": + stage="pre-install" + main(stage) diff --git a/branding/templates/qtinstaller/packages/bitmaskvpn/meta/install.js b/branding/templates/qtinstaller/packages/bitmaskvpn/meta/install.js index 0b065d6..407ea39 100644 --- a/branding/templates/qtinstaller/packages/bitmaskvpn/meta/install.js +++ b/branding/templates/qtinstaller/packages/bitmaskvpn/meta/install.js @@ -70,6 +70,7 @@ Component.prototype.createOperations = function () if (systemInfo.productType === "windows") { postInstallWindows(); } else if (systemInfo.productType === "osx") { + preInstallOSX(); postInstallOSX(); } else { postInstallLinux(); @@ -91,6 +92,7 @@ Component.prototype.installationFinished = function() } function postInstallWindows() { + // TODO - check if we're on Windows10 or older, and use the needed tap-windows installer accordingly. console.log("Installing OpenVPN tap driver"); component.addElevatedOperation("Execute", "@TargetDir@/tap-windows.exe", "/S", "/SELECT_UTILITIES=1"); /* TODO uninstall? */ console.log("Now trying to install our helper"); @@ -108,6 +110,16 @@ function postInstallWindows() { ); } +function preInstallOSX() { + console.log("Pre-installation for OSX"); + // TODO use installer filepath?? + component.addElevatedOperation( + "Execute", "{0}", + "@TargetDir@/uninstall.py", "pre", + "errormessage=There was an error during the pre-installation script, things might be broken. Please report this error and attach the pre-install.log file." + ); +} + function postInstallOSX() { console.log("Post-installation for OSX"); component.addElevatedOperation( |