Skip to content

Commit c26a52f

Browse files
committed
Export APPDIR and this_dir in generated scripts
1 parent 13877b0 commit c26a52f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

ldnp/abstractpackager.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,14 @@ def create_binary_script(script_path: str | os.PathLike, target_binary: str | os
158158
"",
159159
"set -e",
160160
"",
161-
f'script_dir="{shlex.quote(str(self.appdir_installed_path))}/apprun-hooks"',
161+
"# might be used by some AppRun scripts, e.g., craft runenv hook",
162+
f"this_dir={shlex.quote(str(self.appdir_installed_path))}",
163+
"",
164+
"# might be used by some other scripts, generally a good idea to set it",
165+
'APPDIR="this_dir"',
166+
"export APPDIR",
167+
"",
168+
f'script_dir="$APPDIR/apprun-hooks"',
162169
f'if [ -d "$script_dir" ]; then',
163170
' for script in "$script_dir"/*; do',
164171
' . "$script"',

0 commit comments

Comments
 (0)