From 23a8d14d4ae7a89aa4a80c9bb4c5b064a128bc6b Mon Sep 17 00:00:00 2001 From: Fiona Klute Date: Thu, 18 Jan 2024 01:14:08 +0100 Subject: [PATCH] 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. --- helpers/envkernel.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/helpers/envkernel.sh b/helpers/envkernel.sh index 7599d5f6..e71fb860 100644 --- a/helpers/envkernel.sh +++ b/helpers/envkernel.sh @@ -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;"