From 93a0668a02b3a280919c4881db9085d5f2a912af Mon Sep 17 00:00:00 2001
From: kali <kali@leap.se>
Date: Tue, 13 Oct 2020 19:24:11 +0200
Subject: [PATCH] [pkg] osx fixes for installer build

---
 Makefile                         | 16 ++++++++--------
 branding/scripts/gen-qtinstaller |  5 +----
 branding/scripts/provider.py     |  8 +++++---
 3 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/Makefile b/Makefile
index 560c1234..1f8720eb 100644
--- a/Makefile
+++ b/Makefile
@@ -107,21 +107,21 @@ ifeq (${PLATFORM}, darwin)
 	@mkdir -p ${INST_DATA}/helper
 	@VERSION=${VERSION} VENDOR_PATH=${VENDOR_PATH} ${SCRIPTS}/gen-qtinstaller osx ${INSTALLER}
 	@cp "${TEMPLATES}/osx/bitmask.pf.conf" ${INST_DATA}helper/bitmask.pf.conf
-	@cp "${TEMPLATES}/osx/client.up.sh" ${INST_DATA}
-	@cp "${TEMPLATES}/osx/client.down.sh" ${INST_DATA}
-	@cp "${TEMPLATES}/qtinstaller/osx-data/post-install.py" ${INST_DATA}
-	@cp "${TEMPLATES}/qtinstaller/osx-data/uninstall.py" ${INST_DATA}
-	@cp "${TEMPLATES}/qtinstaller/osx-data/se.leap.bitmask-helper.plist" ${INST_DATA}
-	@cp build/bin/${PLATFORM}/bitmask-helper ${INST_DATA}
+	@cp "${TEMPLATES}/osx/client.up.sh" ${INST_DATA}/
+	@cp "${TEMPLATES}/osx/client.down.sh" ${INST_DATA}/
+	@cp "${TEMPLATES}/qtinstaller/osx-data/post-install.py" ${INST_DATA}/
+	@cp "${TEMPLATES}/qtinstaller/osx-data/uninstall.py" ${INST_DATA}/
+	@cp "${TEMPLATES}/qtinstaller/osx-data/se.leap.bitmask-helper.plist" ${INST_DATA}/
+	@cp build/bin/${PLATFORM}/bitmask-helper ${INST_DATA}/
 	# FIXME our static openvpn build fails with an "Assertion failed at crypto.c". Needs to be fixed!!! - kali
 	# a working (old) version:
 	#@curl -L https://downloads.leap.se/thirdparty/osx/openvpn/openvpn -o build/${PROVIDER}/staging/openvpn-osx
 	#FIXME FIXME @cp $(OPENVPN_BIN) ${INST_DATA}/openvpn.leap
-	@rm -f ${INST_DATA}openvpn.leap && cp /usr/local/bin/openvpn ${OSX_DATA}openvpn.leap
+	@rm -f ${INST_DATA}openvpn.leap && cp /usr/local/bin/openvpn ${INST_DATA}/openvpn.leap
 	@echo "WARNING: workaround for broken static build. Shipping homebrew dynamically linked instead"
 	@echo "[+] Running macdeployqt"
 	@macdeployqt ${QTBUILD}/release/${PROVIDER}-vpn.app ${MACDEPLOYQT_OPTS}
-	@cp -r "${QTBUILD}/release/${TARGET}.app"/ ${OSX_DATA}/
+	@cp -r "${QTBUILD}/release/${TARGET}.app"/ ${INST_DATA}/
 endif
 ifeq (${PLATFORM}, windows)
 	@VERSION=${VERSION} ${SCRIPTS}/gen-qtinstaller windows ${INSTALLER}
diff --git a/branding/scripts/gen-qtinstaller b/branding/scripts/gen-qtinstaller
index 58ab3f9f..1f2c03d9 100755
--- a/branding/scripts/gen-qtinstaller
+++ b/branding/scripts/gen-qtinstaller
@@ -35,11 +35,9 @@ OS_CONFIG = {
 """
 }
 
-
-
 def getData():
     config = configparser.ConfigParser()
-    configPath = os.path.join(here(), '../../branding/config/vendor.conf')
+    configPath = os.path.join(VENDOR_PATH, 'vendor.conf')
     config.read(configPath)
 
     provider = os.environ.get('PROVIDER')
@@ -120,7 +118,6 @@ def getVersion():
     return os.environ.get('VERSION', 'unknown')
 
 if __name__ == "__main__":
-    # TODO get from vendor - maybe just in provider module
     VENDOR_PATH = os.environ.get('VENDOR_PATH')
 
     if len(sys.argv) != 3:
diff --git a/branding/scripts/provider.py b/branding/scripts/provider.py
index 9f6bb088..8904c378 100644
--- a/branding/scripts/provider.py
+++ b/branding/scripts/provider.py
@@ -15,10 +15,12 @@ def getDefaultProvider(config):
 
 def getProviderData(provider, config):
     print("[+] Configured provider:", provider)
-
-    c = config[provider]
+    try:
+        c = config[provider]
+    except Exception:
+        raise ValueError('Cannot find provider')
+        
     d = dict()
-
     keys = ('name', 'applicationName', 'binaryName', 'auth', 'authEmptyPass',
             'providerURL', 'tosURL', 'helpURL',
             'askForDonations', 'donateURL', 'apiURL',
-- 
GitLab