From ecb09001d49ddd160580a1f1de72bb7e06c4179c Mon Sep 17 00:00:00 2001 From: Disassembler Date: Mon, 14 Oct 2019 08:23:45 +0200 Subject: [PATCH] Change working directory before executing install/update/uninstall script --- usr/lib/python3.6/lxcmgr/pkgmgr.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/usr/lib/python3.6/lxcmgr/pkgmgr.py b/usr/lib/python3.6/lxcmgr/pkgmgr.py index 970ed98..5d39964 100644 --- a/usr/lib/python3.6/lxcmgr/pkgmgr.py +++ b/usr/lib/python3.6/lxcmgr/pkgmgr.py @@ -194,9 +194,14 @@ class PkgMgr: def run_script(self, app, script): # Runs script for an app, if the script is present - script_path = os.path.join(REPO_CACHE_DIR, 'apps', app, script) + script_dir = os.path.join(REPO_CACHE_DIR, 'apps', app) + script_path = os.path.join(script_dir, script) if os.path.exists(script_path): + # Change working directory, so the script doesn't have to figure out paths to packaged files + cwd = os.getcwd() + os.chdir(script_dir) subprocess.run(script_path, check=True) + os.chdir(cwd) def register_app(self, app, metadata): # Register installed app in list of installed apps