Change working directory before executing install/update/uninstall script
This commit is contained in:
parent
ecfa225187
commit
ecb09001d4
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user