diff options
author | Ruben Pollan <meskio@sindominio.net> | 2018-12-21 13:27:16 +0100 |
---|---|---|
committer | Kali Kaneko (leap communications) <kali@leap.se> | 2018-12-28 11:43:15 +0100 |
commit | ad4f71fffa3de2f8ee262ef76f0e926068459d1d (patch) | |
tree | 436657d3469fddea068203766d6d171e6cc1babf /snap/pre/pack_installers | |
parent | 9e226de771cce4cc31903af457721091023d0c61 (diff) |
[bug] snap post install: add support to python2
Some old systems doesn't have python3 installed by default. Let's keep
support for both python3 and python2 in our post installation script.
`subprocess.run` doesn't exist on python2.
- Resolves: #53
Diffstat (limited to 'snap/pre/pack_installers')
-rwxr-xr-x | snap/pre/pack_installers | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/snap/pre/pack_installers b/snap/pre/pack_installers index c11bca8..a893574 100755 --- a/snap/pre/pack_installers +++ b/snap/pre/pack_installers @@ -27,7 +27,7 @@ with open(os.path.join(HELPDIR, 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('#!/usr/bin/env python\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') @@ -43,9 +43,10 @@ with open('/usr/share/polkit-1/actions/{polkit_file}', 'w') as polkit: for line in lines: polkit.write(line.decode() + "\\n") -release = subprocess.run(['cat', '/etc/os-release'], stdout=subprocess.PIPE).stdout +with open('/etc/os-release') as f: + release = f.read() # this is a workaround for the fact that debian does not place snap desktop entries in a system+wide path. -if b'ID=debian' in release: +if 'ID=debian' in release: cmd = 'ln -s /snap/{app_name}/current/snap/gui/{app_name}.desktop /usr/share/applications/' subprocess.run(cmd.split(' ')) subprocess.run(['update-desktop-database']) |