Skip to content

Commit

Permalink
Export APPDIR and this_dir in generated scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAssassin committed Nov 29, 2023
1 parent 13877b0 commit c26a52f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ldnp/abstractpackager.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,14 @@ def create_binary_script(script_path: str | os.PathLike, target_binary: str | os
"",
"set -e",
"",
f'script_dir="{shlex.quote(str(self.appdir_installed_path))}/apprun-hooks"',
"# might be used by some AppRun scripts, e.g., craft runenv hook",
f"this_dir={shlex.quote(str(self.appdir_installed_path))}",
"",
"# might be used by some other scripts, generally a good idea to set it",
'APPDIR="this_dir"',
"export APPDIR",
"",
f'script_dir="$APPDIR/apprun-hooks"',
f'if [ -d "$script_dir" ]; then',
' for script in "$script_dir"/*; do',
' . "$script"',
Expand Down

0 comments on commit c26a52f

Please sign in to comment.