diff options
author | Kali Kaneko <kali@leap.se> | 2018-07-04 22:25:15 +0200 |
---|---|---|
committer | Kali Kaneko (leap communications) <kali@leap.se> | 2018-07-07 04:54:53 +0200 |
commit | 89bb53fe82c048fc322075b67b1bc7048d4fc53d (patch) | |
tree | 23cc4176f8615bc4bdba5e2f9e10e91fd62319e6 /osx | |
parent | f81d41682ec26c489264351679924fae76884a3d (diff) |
[pkg] move info.plist to template
Diffstat (limited to 'osx')
-rw-r--r-- | osx/Makefile | 2 | ||||
-rw-r--r-- | osx/generate.py | 76 | ||||
-rw-r--r-- | osx/template-info.plist | 34 |
3 files changed, 64 insertions, 48 deletions
diff --git a/osx/Makefile b/osx/Makefile new file mode 100644 index 0000000..9742135 --- /dev/null +++ b/osx/Makefile @@ -0,0 +1,2 @@ +generate: + python ./generate.py diff --git a/osx/generate.py b/osx/generate.py index 8982d94..57aa11e 100644 --- a/osx/generate.py +++ b/osx/generate.py @@ -6,15 +6,20 @@ import shutil import sys import stat +from string import Template + # Variables ---------------------------- # TODO consolidate version string for all builds. VERSION = "0.0.1" APP_NAME = "RiseupVPN" BUNDLE_IDENTIFIER = "se.leap.riseupvpn" -ENTRYPOINT = "bitmask-systray" # Do not edit below -------------------- +TEMPLATE = 'template-info.plist' +ENTRYPOINT = 'bitmask-systray' +HELPER = 'bitmask_helper' + here = os.path.split(os.path.abspath(__file__))[0] APP_PATH = os.path.abspath(here + '/../dist/' + APP_NAME + ".app") @@ -22,57 +27,32 @@ STAGING = os.path.abspath(here + '/../staging/') os.makedirs(APP_PATH + "/Contents/MacOS", exist_ok=True) +INFO_PLIST = APP_PATH + '/Contents/Info.plist' + +vardict = { + 'entrypoint': ENTRYPOINT, + 'info_string': APP_NAME + " " + VERSION, + 'bundle_identifier': BUNDLE_IDENTIFIER, + 'bundle_name': APP_NAME, + 'version': VERSION +} + +template = Template(open(TEMPLATE).read()) +with open(INFO_PLIST, 'w') as output: + output.write(template.safe_substitute(vardict)) -f = open(APP_PATH + "/Contents/Info.plist", "w") -f.write("""<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>CFBundleDevelopmentRegion</key> - <string>English</string> - <key>CFBundleExecutable</key> - <string>%s</string> - <key>CFBundleGetInfoString</key> - <string>%s</string> - <key>CFBundleIconFile</key> - <string>app.icns</string> - <key>CFBundleIdentifier</key> - <string>%s</string> - <key>CFBundleInfoDictionaryVersion</key> - <string>6.0</string> - <key>CFBundleName</key> - <string>%s</string> - <key>CFBundlePackageType</key> - <string>APPL</string> - <key>CFBundleShortVersionString</key> - <string>%s</string> - <key>CFBundleSignature</key> - <string>????</string> - <key>CFBundleVersion</key> - <string>%s</string> - <key>NSAppleScriptEnabled</key> - <string>YES</string> - <key>NSMainNibFile</key> - <string>MainMenu</string> - <key>NSPrincipalClass</key> - <string>NSApplication</string> -</dict> -</plist> -""" % ( - ENTRYPOINT, - APP_NAME + " " + VERSION, - BUNDLE_IDENTIFIER, - APP_NAME, - APP_NAME + " " + VERSION, - VERSION)) -f.close() f = open(APP_PATH + "/Contents/PkgInfo", "w") f.write("APPL????") f.close() -entrypoint_file = APP_PATH + "/Contents/MacOS/" + ENTRYPOINT -shutil.copyfile(STAGING + '/' + ENTRYPOINT, entrypoint_file) -oldmode = os.stat(entrypoint_file).st_mode -os.chmod(entrypoint_file, oldmode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH) +def copy_payload(filename): + destfile = APP_PATH + "/Contents/MacOS/" + filename + shutil.copyfile(STAGING + '/' + filename, destfile) + cmode = os.stat(destfile).st_mode + os.chmod(destfile, cmode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH) + +copy_payload(ENTRYPOINT) +copy_payload(HELPER) + diff --git a/osx/template-info.plist b/osx/template-info.plist new file mode 100644 index 0000000..e67ddcc --- /dev/null +++ b/osx/template-info.plist @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleExecutable</key> + <string>$entrypoint</string> + <key>CFBundleGetInfoString</key> + <string>$info_string</string> + <key>CFBundleIconFile</key> + <string>app.icns</string> + <key>CFBundleIdentifier</key> + <string>$bundle_identifier</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>$bundle_name</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleShortVersionString</key> + <string>$info_string</string> + <key>CFBundleSignature</key> + <string>????</string> + <key>CFBundleVersion</key> + <string>$version</string> + <key>NSAppleScriptEnabled</key> + <string>YES</string> + <key>NSMainNibFile</key> + <string>MainMenu</string> + <key>NSPrincipalClass</key> + <string>NSApplication</string> +</dict> +</plist> |