Don't drop parameters in run-script (MR 2230)

Note that the parameters aren't included directly in the sh -c command
string, but instead as additional parameters after. That avoids having
to find a cross-shell approach for quoting them in a way that works
inside the string (there doesn't seem to be one).

That's also the reason for the additional "sh" parameter: The first
parameter after the command string becomes the command name ($0), the
ones after positional parameters.
This commit is contained in:
Fiona Klute 2024-01-18 01:14:08 +01:00 committed by Oliver Smith
parent 7dd565f7f3
commit 23a8d14d4a
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
1 changed files with 2 additions and 1 deletions

View File

@ -256,11 +256,12 @@ set_alias_make() {
cmd="_run_script() {"
cmd="$cmd echo '*** pmbootstrap envkernel.sh active for $PWD! ***';"
cmd="$cmd _script=\"\$1\";"
cmd="$cmd shift;"
cmd="$cmd if [ -e \"\$_script\" ]; then"
cmd="$cmd echo \"Running \$_script in the chroot native /mnt/linux/\";"
cmd="$cmd pmbootstrap -q chroot --user -- sh -c \"cd /mnt/linux;"
cmd="$cmd srcdir=/mnt/linux builddir=/mnt/linux/.output tmpdir=/tmp/envkernel"
cmd="$cmd ./\"\$_script\"\";"
cmd="$cmd ./\"\$_script\" \\\"\\\$@\\\"\" \"sh\" \"\$@\";"
cmd="$cmd else"
cmd="$cmd echo \"ERROR: \$_script not found.\";"
cmd="$cmd fi;"