From f0823c445a01320ec471fe8c9163ab16b1cb3e1e Mon Sep 17 00:00:00 2001 From: Ruben Pollan Date: Thu, 17 Jan 2019 17:01:20 +0100 Subject: [pkg] snap: don't use subprocess.run on the post-install hook - Resolves: #53 --- snap/pre/pack_installers | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'snap/pre') diff --git a/snap/pre/pack_installers b/snap/pre/pack_installers index a893574..827d16e 100755 --- a/snap/pre/pack_installers +++ b/snap/pre/pack_installers @@ -34,6 +34,7 @@ with open(INSTALL, 'w') as install: install.write('# It is generated automatically\n') install.write('# by the script at "snap/pre/pack_installers"\n') install.write('import subprocess\n') + install.write('import os\n') install.write('from base64 import decodestring as decode\n') install.write(""" POLKIT = {polkit} @@ -47,9 +48,11 @@ 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 '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']) + desktop_path = "/usr/share/applications/{app_name}.desktop" + if os.path.exists(desktop_path): + os.remove(desktop_path) + os.symlink("/snap/{app_name}/current/snap/gui/{app_name}.desktop", desktop_path) + subprocess.call(['update-desktop-database']) """.format( polkit=b64_polkit, polkit_file=POLKIT_FILE, -- cgit v1.2.3