diff options
author | Kali Kaneko <kali@leap.se> | 2018-07-05 00:17:26 +0200 |
---|---|---|
committer | Kali Kaneko (leap communications) <kali@leap.se> | 2018-07-07 04:55:22 +0200 |
commit | 7d54e7dfd073c5f8a90a7055fd99d5dccb5277b6 (patch) | |
tree | 5f5ea85aeb261eb07364df2eda585ee9b0a7e43b /osx/generate.py | |
parent | 5f66af8266eda3e8bc5d1b394e5fb81271b7733f (diff) |
[pkg] get openvpn for osx
for now I'm skipping the integration of the build step for openvpn.
this is done manually, using the thirdparty scripts in bitmask-dev, and
uploaded periodically to downloads.leap.se
Diffstat (limited to 'osx/generate.py')
-rw-r--r-- | osx/generate.py | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/osx/generate.py b/osx/generate.py index b8a6bec..aec4ea9 100644 --- a/osx/generate.py +++ b/osx/generate.py @@ -1,5 +1,10 @@ #!/usr/bin/python +# Generate bundles for brandable Bitmask Lite. + +# (c) LEAP Encryption Access Project +# (c) Kali Kaneko 2018 + import os import os.path import shutil @@ -19,6 +24,7 @@ here = os.path.split(os.path.abspath(__file__))[0] ENTRYPOINT = 'bitmask-systray' HELPER = 'bitmask_helper' +OPENVPN = 'openvpn' TEMPLATE_INFO = 'template-info.plist' TEMPLATE_HELPER = 'template-helper.plist' TEMPLATE_PREINSTALL = 'template-preinstall' @@ -51,8 +57,11 @@ vardict = { # utils -def copy_payload(filename): - destfile = APP_PATH + "/Contents/MacOS/" + filename +def copy_payload(filename, destfile=None): + if destfile is None: + destfile = APP_PATH + "/Contents/MacOS/" + filename + else: + destfile = APP_PATH + destfile shutil.copyfile(STAGING + '/' + filename, destfile) cmode = os.stat(destfile).st_mode os.chmod(destfile, cmode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH) @@ -72,10 +81,10 @@ generate_from_template(TEMPLATE_INFO, INFO_PLIST, vardict) # 2. Generate PkgInfo # ------------------------------------------- -# XXX is this enough? -f = open(APP_PATH + "/Contents/PkgInfo", "w") -f.write("APPL????") -f.close() + +with open(APP_PATH + "/Contents/PkgInfo", "w") as f: + # is this enough? See what PyInstaller does. + f.write("APPL????") # 3. Copy the binary payloads @@ -83,14 +92,25 @@ f.close() copy_payload(ENTRYPOINT) copy_payload(HELPER) +copy_payload(OPENVPN, destfile='/Contents/Resources/openvpn.leap') -# 4. Copy the app icon +# 4. Copy the app icon from the assets folder # ----------------------------------------------- + shutil.copyfile(ICON, APP_PATH + '/Contents/Resources/app.icns') # 5. Generate the scripts for the installer # ----------------------------------------------- + +# Watch out that, for now, all the brandings are sharing the same helper name. +# This is intentional: I prefer not to have too many root helpers laying around +# until we consolidate a way of uninstalling and/or updating them. +# This also means that only one of the derivatives will work at a given time +# (ie, uninstall bitmask legacy to use riseupvpn). +# If this bothers you, and it should, let's work on improving uninstall and +# updates. + generate_from_template(TEMPLATE_HELPER, HELPER_PLIST, vardict) generate_from_template(TEMPLATE_PREINSTALL, PREINSTALL, vardict) generate_from_template(TEMPLATE_POSTINSTALL, POSTINSTALL, vardict) @@ -100,13 +120,12 @@ generate_from_template(TEMPLATE_POSTINSTALL, POSTINSTALL, vardict) # ----------------------------------------------- # TODO copy the uninstaller script from bitmask-dev # TODO substitute vars -# TODO this is a bit weak for now. +# this is a bit weak procedure for now. # To begin with, this assumes everything is hardcoded into /Applications/APPNAME.app # We could consider moving the helpers into /usr/local/sbin, so that the plist files # always reference there. -# We're all set here. +# We're all set here +# ------------------ print("[+] Output written to dist/{appname}.app".format(appname=APP_NAME)) - - |