diff options
author | Kali Kaneko (leap communications) <kali@leap.se> | 2019-08-16 12:50:45 +0200 |
---|---|---|
committer | Kali Kaneko (leap communications) <kali@leap.se> | 2019-08-16 12:58:00 +0200 |
commit | 3120b855ac31158a52c9263f522615b4c3a0aa20 (patch) | |
tree | 624837ece395e563286a54cbb050f4f21ae48cd2 /branding/templates/snap/local | |
parent | 4aa6fd4109aa9e92a1ade72885d7c99effcd7c76 (diff) |
[pkg] add helpers to repo, generate hooks in snap
Diffstat (limited to 'branding/templates/snap/local')
-rwxr-xr-x | branding/templates/snap/local/pre/pack_installers | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/branding/templates/snap/local/pre/pack_installers b/branding/templates/snap/local/pre/pack_installers index 9cf7b15..58134cc 100755 --- a/branding/templates/snap/local/pre/pack_installers +++ b/branding/templates/snap/local/pre/pack_installers @@ -3,33 +3,20 @@ import os import subprocess from base64 import encodestring as encode -# we expect to find bitmask-dev cloned in the parent folder for this repo -# we will clone it if not -PARENT = '../../' -BITMASK_FOLDER = PARENT + 'bitmask-dev/' -BITMASK_GIT = 'https://0xacab.org/leap/bitmask-dev' -HELPDIR = BITMASK_FOLDER + 'src/leap/bitmask/vpn/helpers/linux/' +HELPDIR = '../../../../../helpers' INSTALL = 'hooks/install' -POLKIT_FILE = 'se.leap.bitmask.riseupvpn.policy' -APP_NAME = 'riseup-vpn' -if not os.path.isdir(BITMASK_FOLDER): - print('[+] Cloning bitmask-dev repo to get helpers...') - cmd = 'cd ../.. && git clone %s' % (BITMASK_GIT, ) - os.system(cmd) -else: - print('[+] Updating bitmask-dev repo to get helpers...') - cmd = 'cd ' + BITMASK_FOLDER + ' && git pull' - os.system(cmd) +POLKIT_FILE = os.environ.get('POLKIT_FILE') +APP_NAME = os.environ.get('APP_NAME') -with open(os.path.join(HELPDIR, POLKIT_FILE)) as polkit: +with open(POLKIT_FILE) as polkit: b64_polkit = encode(polkit.read().encode()) with open(INSTALL, 'w') as install: install.write('#!/usr/bin/env python3\n') install.write('# DO NOT MODIFY MANUALLY\n') install.write('# This helper installs the polkit policy file\n') - install.write('# for the RiseupVPN snap.\n') + install.write('# for the ${applicationName} snap.\n') install.write('# It is generated automatically\n') install.write('# by the script at "snap/local/pre/pack_installers"\n') install.write('import subprocess\n') @@ -53,9 +40,9 @@ if 'ID=debian' in release: os.symlink("/snap/{app_name}/current/snap/meta/gui/{app_name}.desktop", desktop_path) subprocess.call(['update-desktop-database']) """.format( - polkit=b64_polkit, - polkit_file=POLKIT_FILE, - app_name=APP_NAME)) + polkit=b64_polkit, + polkit_file=POLKIT_FILE, + app_name=APP_NAME)) subprocess.Popen(["chmod", "+x", INSTALL]) print("[+] Done packing installers into the snap install hook...") |