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
|
done
|
||||||
|
|
||||||
initargs=""
|
initargs=""
|
||||||
initrdargs="$initrdargs console BOOT_IMAGE rdbreak rdinitdebug rdudevinfo rdudevdebug rdnetdebug rdcopystate rdshell"
|
|
||||||
|
|
||||||
for x in "$@"; do
|
if getarg init= >/dev/null ; then
|
||||||
for s in $initrdargs; do
|
ignoreargs="console BOOT_IMAGE"
|
||||||
[ "${x%%=*}" = $s ] && continue 2
|
# 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
|
done
|
||||||
initargs="$initargs $x"
|
unset CLINE
|
||||||
done
|
fi
|
||||||
|
|
||||||
# Prepare network opts for passing
|
# Prepare network opts for passing
|
||||||
if [ -e /tmp/net.ifaces ]; then
|
if [ -e /tmp/net.ifaces ]; then
|
||||||
|
@ -257,8 +264,7 @@ fi
|
||||||
info "Switching root"
|
info "Switching root"
|
||||||
|
|
||||||
exec switch_root "$NEWROOT" "$INIT" $initargs || {
|
exec switch_root "$NEWROOT" "$INIT" $initargs || {
|
||||||
# davej doesn't like initrd bugs
|
echo "Something went very badly wrong in the initramfs. Please "
|
||||||
echo "Something went very badly wrong in the initrd. Please "
|
echo "file a bug against dracut."
|
||||||
echo "file a bug against mkinitrd."
|
|
||||||
emergency_shell
|
emergency_shell
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue