init: fixed command line handling for /sbin/init and init=<custom init>
parent
233f79df99
commit
247c9f70bf
|
@ -230,14 +230,21 @@ for i in $(export -p); do
|
|||
done
|
||||
|
||||
initargs=""
|
||||
initrdargs="$initrdargs console BOOT_IMAGE rdbreak rdinitdebug rdudevinfo rdudevdebug rdnetdebug rdcopystate rdshell"
|
||||
|
||||
for x in "$@"; do
|
||||
for s in $initrdargs; do
|
||||
[ "${x%%=*}" = $s ] && continue 2
|
||||
if getarg init= >/dev/null ; then
|
||||
ignoreargs="console BOOT_IMAGE"
|
||||
# only pass arguments after init= to the init
|
||||
read CLINE </proc/cmdline
|
||||
CLINE=${CLINE#*init=}
|
||||
set $CLINE
|
||||
for x in "$@"; do
|
||||
for s in $ignoreargs; do
|
||||
[ "${x%%=*}" = $s ] && continue 2
|
||||
done
|
||||
initargs="$initargs $x"
|
||||
done
|
||||
initargs="$initargs $x"
|
||||
done
|
||||
unset CLINE
|
||||
fi
|
||||
|
||||
# Prepare network opts for passing
|
||||
if [ -e /tmp/net.ifaces ]; then
|
||||
|
@ -257,8 +264,7 @@ fi
|
|||
info "Switching root"
|
||||
|
||||
exec switch_root "$NEWROOT" "$INIT" $initargs || {
|
||||
# davej doesn't like initrd bugs
|
||||
echo "Something went very badly wrong in the initrd. Please "
|
||||
echo "file a bug against mkinitrd."
|
||||
echo "Something went very badly wrong in the initramfs. Please "
|
||||
echo "file a bug against dracut."
|
||||
emergency_shell
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue