diff --git a/modules.d/99base/dracut-dev-lib.sh b/modules.d/99base/dracut-dev-lib.sh index 0df22b82cb..63265f2101 100755 --- a/modules.d/99base/dracut-dev-lib.sh +++ b/modules.d/99base/dracut-dev-lib.sh @@ -17,7 +17,7 @@ str_replace() { out="${out}${chop}$r" in="${in#*"$s"}" done - echo "${out}${in}" + printf -- '%s' "${out}${in}" } # get a systemd-compatible unit name from a path diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh index 344455596e..ca1df90d57 100755 --- a/modules.d/99base/init.sh +++ b/modules.d/99base/init.sh @@ -299,6 +299,9 @@ udevadm info --cleanup-db debug_off # Turn off debugging for this section +CAPSH=$(command -v capsh) +SWITCH_ROOT=$(command -v switch_root) + # unexport some vars export_n root rflags fstype netroot NEWROOT unset CMDLINE @@ -370,8 +373,6 @@ info "Switching root" unset PS4 -CAPSH=$(command -v capsh) -SWITCH_ROOT=$(command -v switch_root) PATH=$OLDPATH export PATH @@ -380,10 +381,10 @@ if [ -f /etc/capsdrop ]; then info "Calling $INIT with capabilities $CAPS_INIT_DROP dropped." unset RD_DEBUG exec "$CAPSH" --drop="$CAPS_INIT_DROP" -- \ - -c "exec switch_root \"$NEWROOT\" \"$INIT\" $initargs" \ + -c "exec \"$SWITCH_ROOT\" \"$NEWROOT\" \"$INIT\" $initargs" \ || { warn "Command:" - warn capsh --drop="$CAPS_INIT_DROP" -- -c exec switch_root "$NEWROOT" "$INIT" "$initargs" + warn capsh --drop="$CAPS_INIT_DROP" -- -c exec "$SWITCH_ROOT" "$NEWROOT" "$INIT" "$initargs" warn "failed." emergency_shell }