summaryrefslogtreecommitdiff
path: root/branding/scripts
diff options
context:
space:
mode:
authorKali Kaneko (leap communications) <kali@leap.se>2019-07-15 18:06:29 +0200
committerRuben Pollan <meskio@sindominio.net>2019-08-05 11:46:16 -0400
commit1106467f972e6e5d6781412e999d7c44195bb2df (patch)
treea0f72d3902407564439cfe866aeba4a03d9854bb /branding/scripts
parentf8218b2beb8b184e7b3585f1280695ecfef040f9 (diff)
[feat] osx build templates
Diffstat (limited to 'branding/scripts')
-rwxr-xr-xbranding/scripts/check-ca-crt.py1
-rwxr-xr-xbranding/scripts/generate-osx.py44
-rwxr-xr-xbranding/scripts/generate-vendor-make.py58
3 files changed, 103 insertions, 0 deletions
diff --git a/branding/scripts/check-ca-crt.py b/branding/scripts/check-ca-crt.py
index 431d059..dbf9b40 100755
--- a/branding/scripts/check-ca-crt.py
+++ b/branding/scripts/check-ca-crt.py
@@ -20,6 +20,7 @@ def getLocalCert(provider):
def getRemoteCert(uri):
+ print("... checking cert from", uri)
fp = urllib.request.urlopen(uri)
remote_cert = fp.read().decode('utf-8').strip()
fp.close()
diff --git a/branding/scripts/generate-osx.py b/branding/scripts/generate-osx.py
new file mode 100755
index 0000000..4430762
--- /dev/null
+++ b/branding/scripts/generate-osx.py
@@ -0,0 +1,44 @@
+#!/usr/bin/env python3
+
+import json
+import os
+import sys
+
+import configparser
+
+from provider import getDefaultProvider
+from provider import getProviderData
+
+
+VERSION = os.environ.get('VERSION', 'unknown')
+
+
+def writeOutput(data, outfile):
+
+ with open(outfile, 'w') as outf:
+ outf.write(json.dumps(data))
+
+
+if __name__ == "__main__":
+ env_provider_conf = os.environ.get('PROVIDER_CONFIG')
+ if env_provider_conf:
+ if os.path.isfile(env_provider_conf):
+ print("[+] Overriding provider config per "
+ "PROVIDER_CONFIG variable")
+ configfile = env_provider_conf
+
+ config = configparser.ConfigParser()
+ config.read(configfile)
+ provider = getDefaultProvider(config)
+ data = getProviderData(provider, config)
+
+ if len(sys.argv) != 2:
+ print('Usage: generate-osx.py <output_file>')
+ sys.exit(1)
+
+ outputf = sys.argv[1]
+
+ data['applicationNameLower'] = data.get('applicationName').lower()
+ data['URL'] = data.get('infoURL')
+ data['version'] = VERSION
+ writeOutput(data, outputf)
diff --git a/branding/scripts/generate-vendor-make.py b/branding/scripts/generate-vendor-make.py
new file mode 100755
index 0000000..e7794c3
--- /dev/null
+++ b/branding/scripts/generate-vendor-make.py
@@ -0,0 +1,58 @@
+#!/usr/bin/env python3
+
+# Generates a simplified file with variables that
+# can be imported from the main vendorized Makefile.
+
+import os
+import sys
+
+import configparser
+
+from provider import getDefaultProvider
+from provider import getProviderData
+
+
+VERSION = os.environ.get('VERSION', 'unknown')
+
+TEMPLATE = """
+# Variables for the build of {applicationName}.
+# Generated automatically. Do not edit.
+APPNAME := {applicationName}
+BINNAME := {binaryName}
+VERSION := {version}
+"""
+
+
+def writeOutput(data, outfile):
+
+ configString = TEMPLATE.format(
+ binaryName=data['binaryName'],
+ applicationName=data['applicationName'],
+ version=data['version'],
+ )
+
+ with open(outfile, 'w') as outf:
+ outf.write(configString)
+
+
+if __name__ == "__main__":
+ env_provider_conf = os.environ.get('PROVIDER_CONFIG')
+ if env_provider_conf:
+ if os.path.isfile(env_provider_conf):
+ print("[+] Overriding provider config per "
+ "PROVIDER_CONFIG variable")
+ configfile = env_provider_conf
+
+ config = configparser.ConfigParser()
+ config.read(configfile)
+ provider = getDefaultProvider(config)
+ data = getProviderData(provider, config)
+
+ if len(sys.argv) != 2:
+ print('Usage: generate-vendor-make.py <output_file>')
+ sys.exit(1)
+
+ outputf = sys.argv[1]
+ data['version'] = VERSION
+
+ writeOutput(data, outputf)