Fix incorrect usage of $@

"$@" works differently on ash and dash. `foo="$@"` assigns only the
first item (according to IFS) to the variable on dash.
This commit is contained in:
Jakub Jirutka 2017-10-11 20:39:00 +02:00
parent fb0ad9b107
commit c50b9100a1

View file

@ -199,7 +199,7 @@ prepare_chroot() {
# root of the image. # root of the image.
rc_add() { rc_add() {
local runlevel="$1"; shift # runlevel name local runlevel="$1"; shift # runlevel name
local services="$@" # names of services local services="$*" # names of services
local svc; for svc in $services; do local svc; for svc in $services; do
mkdir -p etc/runlevels/$runlevel mkdir -p etc/runlevels/$runlevel
@ -413,10 +413,10 @@ if [ -n "$SCRIPT" ]; then
script_name="${SCRIPT##*/}" script_name="${SCRIPT##*/}"
if [ "$SCRIPT_CHROOT" = 'no' ]; then if [ "$SCRIPT_CHROOT" = 'no' ]; then
einfo "Executing script: $script_name $@" einfo "Executing script: $script_name $*"
"$SCRIPT" "$@" || die 'Script failed' "$SCRIPT" "$@" || die 'Script failed'
else else
einfo "Executing script in chroot: $script_name $@" einfo "Executing script in chroot: $script_name $*"
mount --bind "${SCRIPT%/*}" mnt/ mount --bind "${SCRIPT%/*}" mnt/
chroot . sh -c "cd /mnt && ./$script_name \"\$@\"" -- "$@" \ chroot . sh -c "cd /mnt && ./$script_name \"\$@\"" -- "$@" \
|| die 'Script failed' || die 'Script failed'