Skip to content
Snippets Groups Projects
Unverified Commit f5e7a5d2 authored by Kali Kaneko's avatar Kali Kaneko Committed by Kali Kaneko
Browse files

[pkg] add uninstaller to pre-install in osx

parent ee566492
No related branches found
No related tags found
No related merge requests found
...@@ -98,7 +98,7 @@ lib/%.a: $(PKGFILES) ...@@ -98,7 +98,7 @@ lib/%.a: $(PKGFILES)
@XBUILD=no ./gui/build.sh --just-golib @XBUILD=no ./gui/build.sh --just-golib
relink_vendor: relink_vendor:
@echo "==========RELINK VENDOR==========" @echo "============RELINK VENDOR============="
@echo "PLATFORM: ${PLATFORM}" @echo "PLATFORM: ${PLATFORM}"
@echo "VENDOR_PATH: ${VENDOR_PATH}" @echo "VENDOR_PATH: ${VENDOR_PATH}"
@echo "PROVIDER: ${PROVIDER}" @echo "PROVIDER: ${PROVIDER}"
...@@ -114,28 +114,28 @@ ifeq ($(VENDOR_PATH), providers) ...@@ -114,28 +114,28 @@ ifeq ($(VENDOR_PATH), providers)
@ln -s ${PROVIDER}/assets providers/assets @ln -s ${PROVIDER}/assets providers/assets
endif endif
endif endif
@echo "==========RELINK VENDOR==========" @echo "============RELINK VENDOR============="
build_golib: lib/libgoshim.a build_golib: lib/libgoshim.a
build_gui: relink_vendor build_gui: relink_vendor
@echo "==========BUILD GUI==========" @echo "==============BUILD GUI==============="
@echo "TARGET: ${TARGET}" @echo "TARGET: ${TARGET}"
@echo "VENDOR_PATH: ${VENDOR_PATH}" @echo "VENDOR_PATH: ${VENDOR_PATH}"
@XBUILD=no TARGET=${TARGET} VENDOR_PATH=${VENDOR_PATH} gui/build.sh --skip-golib @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: build_golib build_helper build_gui
build_helper: build_helper:
@echo "==========BUILDER HELPER==========" @echo "=============BUILDER HELPER==========="
@echo "PLATFORM: ${PLATFORM}" @echo "PLATFORM: ${PLATFORM}"
@echo "APPNAME: ${APPNAME}" @echo "APPNAME: ${APPNAME}"
@echo "VERSION: ${VERSION}" @echo "VERSION: ${VERSION}"
@echo "EXTRA_GO_LDFLAGS: ${EXTRA_GO_LDFLAGS}" @echo "EXTRA_GO_LDFLAGS: ${EXTRA_GO_LDFLAGS}"
@mkdir -p build/bin/${PLATFORM} @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/ @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: build_openvpn:
@[ -f $(OPENVPN_BIN) ] && echo "OpenVPN already built at" $(OPENVPN_BIN) || ./branding/thirdparty/openvpn/build_openvpn.sh @[ -f $(OPENVPN_BIN) ] && echo "OpenVPN already built at" $(OPENVPN_BIN) || ./branding/thirdparty/openvpn/build_openvpn.sh
......
...@@ -12,8 +12,9 @@ HELPER_PLIST = "/Library/LaunchDaemons/se.leap.bitmask-helper.plist" ...@@ -12,8 +12,9 @@ HELPER_PLIST = "/Library/LaunchDaemons/se.leap.bitmask-helper.plist"
_dir = os.path.dirname(os.path.realpath(__file__)) _dir = os.path.dirname(os.path.realpath(__file__))
def main(): def main(stage="uninstall"):
log = open(os.path.join('/tmp', 'bitmask-uninstall.log'), 'w') logfile = "bitmask-{stage}.log".format(stage=stage)
log = open(os.path.join('/tmp', logfile), 'w')
log.write('Checking for admin privileges...\n') log.write('Checking for admin privileges...\n')
_id = os.getuid() _id = os.getuid()
...@@ -37,7 +38,7 @@ def main(): ...@@ -37,7 +38,7 @@ def main():
log.write("result: %s \n" % str(out)) log.write("result: %s \n" % str(out))
# all done # all done
log.write('uninstall script: done\n') log.write(stage + ' script: done\n')
sys.exit(0) sys.exit(0)
...@@ -67,4 +68,7 @@ def _getProcessList(): ...@@ -67,4 +68,7 @@ def _getProcessList():
return _out return _out
if __name__ == "__main__": if __name__ == "__main__":
main() stage="uninstall"
if len(sys.argv) > 2 and sys.argv[2] == "pre":
stage="pre-install"
main(stage)
...@@ -70,6 +70,7 @@ Component.prototype.createOperations = function () ...@@ -70,6 +70,7 @@ Component.prototype.createOperations = function ()
if (systemInfo.productType === "windows") { if (systemInfo.productType === "windows") {
postInstallWindows(); postInstallWindows();
} else if (systemInfo.productType === "osx") { } else if (systemInfo.productType === "osx") {
preInstallOSX();
postInstallOSX(); postInstallOSX();
} else { } else {
postInstallLinux(); postInstallLinux();
...@@ -91,6 +92,7 @@ Component.prototype.installationFinished = function() ...@@ -91,6 +92,7 @@ Component.prototype.installationFinished = function()
} }
function postInstallWindows() { 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"); console.log("Installing OpenVPN tap driver");
component.addElevatedOperation("Execute", "@TargetDir@/tap-windows.exe", "/S", "/SELECT_UTILITIES=1"); /* TODO uninstall? */ component.addElevatedOperation("Execute", "@TargetDir@/tap-windows.exe", "/S", "/SELECT_UTILITIES=1"); /* TODO uninstall? */
console.log("Now trying to install our helper"); console.log("Now trying to install our helper");
...@@ -108,6 +110,16 @@ function postInstallWindows() { ...@@ -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() { function postInstallOSX() {
console.log("Post-installation for OSX"); console.log("Post-installation for OSX");
component.addElevatedOperation( component.addElevatedOperation(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment