]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
init: fixed command line handling for /sbin/init and init=<custom init>
authorHarald Hoyer <harald@redhat.com>
Thu, 10 Sep 2009 14:46:08 +0000 (16:46 +0200)
committerHarald Hoyer <harald@redhat.com>
Thu, 10 Sep 2009 14:48:36 +0000 (16:48 +0200)
modules.d/99base/init

index 1797bf896ae81bffc5cdd378c0b5ffc75184c110..bd901f2ef358a0858f0300680abe05abf4b929ee 100755 (executable)
@@ -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
 }