summaryrefslogtreecommitdiff
path: root/pkg/riseupvpn/pack_installers
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2018-02-27 01:52:59 +0100
committerKali Kaneko <kali@leap.se>2018-03-02 03:54:14 +0100
commit031a2044a77153b6c2a3e111de17827c8395ea1e (patch)
tree3c013eb9d03366630aa04fe98cee78ae90ba79b0 /pkg/riseupvpn/pack_installers
parentc9fbec21b700c25d35a03b12df1adbb65f67ff12 (diff)
[pkg] install helpers from snap
Diffstat (limited to 'pkg/riseupvpn/pack_installers')
-rwxr-xr-xpkg/riseupvpn/pack_installers35
1 files changed, 35 insertions, 0 deletions
diff --git a/pkg/riseupvpn/pack_installers b/pkg/riseupvpn/pack_installers
new file mode 100755
index 00000000..693a9543
--- /dev/null
+++ b/pkg/riseupvpn/pack_installers
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+import os
+import subprocess
+from base64 import encodestring as encode
+HELPDIR = '../../src/leap/bitmask/vpn/helpers/linux/'
+INSTALL = './snap/hooks/install'
+
+with open(os.path.join(HELPDIR, 'bitmask-root')) as bmroot:
+ b64_bmroot = encode(bmroot.read())
+
+with open(os.path.join(HELPDIR, 'se.leap.bitmask.bundle.policy')) as polkit:
+ b64_polkit = encode(polkit.read())
+
+with open(INSTALL, 'w') as install:
+ install.write('#!/usr/bin/env python\n')
+ install.write('# This helper installs bitmask-root and polkit policy file\n')
+ install.write('import subprocess\n')
+ install.write('from base64 import decodestring as decode\n')
+ install.write("""
+BMROOT = \"\"\"{bmroot}\"\"\"
+POLKIT = \"\"\"{polkit}\"\"\"
+BMROOT_DEST = "/usr/local/sbin/bitmask-root"
+with open(BMROOT_DEST, "w") as bmroot:
+ lines = str(decode(BMROOT)).split("\\n")
+ for line in lines:
+ bmroot.write(line + "\\n")
+with open('/usr/share/polkit-1/actions/se.leap.bitmask.bundle.policy', 'w') as polkit:
+ lines = str(decode(POLKIT)).split("\\n")
+ for line in lines:
+ polkit.write(line + "\\n")
+""".format(bmroot=b64_bmroot, polkit=b64_polkit))
+ install.write('subprocess.Popen(["chmod", "+x", BMROOT_DEST])\n')
+
+subprocess.Popen(["chmod", "+x", INSTALL])
+print("done packing installers")