summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkali <kali@leap.se>2020-12-02 21:46:06 +0100
committerkali kaneko (leap communications) <kali@leap.se>2021-02-08 23:32:12 +0100
commitf5e7a5d2cab5fc3cfca8c5f75e57090cda27c4e1 (patch)
tree256ab35abca7e1995a0fb349167ddf86ca37fa51
parentee566492264882b5024876180113d4800a29dbda (diff)
[pkg] add uninstaller to pre-install in osx
-rw-r--r--Makefile12
-rwxr-xr-xbranding/templates/qtinstaller/osx-data/uninstall.py12
-rw-r--r--branding/templates/qtinstaller/packages/bitmaskvpn/meta/install.js12
3 files changed, 26 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index 2759704..54fdf33 100644
--- a/Makefile
+++ b/Makefile
@@ -98,7 +98,7 @@ lib/%.a: $(PKGFILES)
@XBUILD=no ./gui/build.sh --just-golib
relink_vendor:
- @echo "==========RELINK VENDOR=========="
+ @echo "============RELINK VENDOR============="
@echo "PLATFORM: ${PLATFORM}"
@echo "VENDOR_PATH: ${VENDOR_PATH}"
@echo "PROVIDER: ${PROVIDER}"
@@ -114,28 +114,28 @@ ifeq ($(VENDOR_PATH), providers)
@ln -s ${PROVIDER}/assets providers/assets
endif
endif
- @echo "==========RELINK VENDOR=========="
+ @echo "============RELINK VENDOR============="
build_golib: lib/libgoshim.a
build_gui: relink_vendor
- @echo "==========BUILD GUI=========="
+ @echo "==============BUILD GUI==============="
@echo "TARGET: ${TARGET}"
@echo "VENDOR_PATH: ${VENDOR_PATH}"
@XBUILD=no TARGET=${TARGET} VENDOR_PATH=${VENDOR_PATH} gui/build.sh --skip-golib
- @echo "==========BUILD GUI=========="
+ @echo "============BUILD GUI================="
build: build_golib build_helper build_gui
build_helper:
- @echo "==========BUILDER HELPER=========="
+ @echo "=============BUILDER HELPER==========="
@echo "PLATFORM: ${PLATFORM}"
@echo "APPNAME: ${APPNAME}"
@echo "VERSION: ${VERSION}"
@echo "EXTRA_GO_LDFLAGS: ${EXTRA_GO_LDFLAGS}"
@mkdir -p build/bin/${PLATFORM}
@go build -o build/bin/${PLATFORM}/bitmask-helper -ldflags "-X main.AppName=${APPNAME} -X main.Version=${VERSION} ${EXTRA_GO_LDFLAGS}" ./cmd/bitmask-helper/
- @echo "==========BUILDER HELPER=========="
+ @echo "===========BUILDER HELPER============="
build_openvpn:
@[ -f $(OPENVPN_BIN) ] && echo "OpenVPN already built at" $(OPENVPN_BIN) || ./branding/thirdparty/openvpn/build_openvpn.sh
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(