]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
base: add logger for rdinitdebug
authorHarald Hoyer <harald@redhat.com>
Thu, 1 Oct 2009 16:11:24 +0000 (18:11 +0200)
committerHarald Hoyer <harald@redhat.com>
Thu, 1 Oct 2009 16:11:24 +0000 (18:11 +0200)
initlog logs to /init.log /dev/kmsg and /dev/console

dracut.8
modules.d/99base/init
modules.d/99base/install

index 5a9965ab77f7979b0855b2e26616250486990f4f..fccd574b0b0d914cf1a248759ed5ce7fd784508f 100644 (file)
--- a/dracut.8
+++ b/dracut.8
@@ -286,7 +286,7 @@ print informational output though "quiet" is set
 allow dropping to a shell, if root mounting fails
 .TP
 .B rdinitdebug
-set -x for the dracut shell
+set -x for the dracut shell and logs to dmesg, console and /init.log
 .TP
 .B rdbreak
 drop to a shell at the end
index a814446608f02bf8acebb416c055c328e88eca3c..4b45b37153fcd5a34ead10315577c7a3ea37fa0c 100755 (executable)
@@ -7,7 +7,10 @@
 
 emergency_shell()
 {
-    exec >/dev/console 2>&1 </dev/console
+    set +x
+    exec 0<>/dev/console 1<>/dev/console 2<>/dev/console
+    # wait for loginit
+    wait
     echo ; echo
     echo $@
     source_all emergency
@@ -50,6 +53,12 @@ if [ ! -c /dev/ptmx ]; then
     fi
 fi
 
+if getarg rdinitdebug; then
+    getarg quiet && DRACUT_QUIET="yes"
+    mkfifo /dev/initlog.pipe
+    /sbin/loginit $DRACUT_QUIET </dev/initlog.pipe >/dev/console 2>&1 &
+    exec >/dev/initlog.pipe 2>&1
+fi
 setdebug
 
 mkdir /dev/shm
@@ -244,6 +253,10 @@ fi
 
 info "Switching root"
 
+exec 0<>/dev/console 1<>/dev/console 2<>/dev/console
+# wait for loginit
+wait
+
 exec switch_root "$NEWROOT" "$INIT" $initargs || {
     echo "Something went very badly wrong in the initramfs.  Please "
     echo "file a bug against dracut."
index 8cd0babd66943edad806bc1d7b3c204b106246a7..801c8d75c58f018f0ca1f694b76aa7b9742ec473 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/bash
 dracut_install mount mknod mkdir modprobe pidof sleep chroot \
-    sed ls flock cp mv dmesg rm ln rmmod
+    sed ls flock cp mv dmesg rm ln rmmod mkfifo less 
 if [ ! -e "${initdir}/bin/sh" ]; then
     dracut_install bash
     (ln -s bash "${initdir}/bin/sh" || :)
@@ -8,6 +8,7 @@ fi
 # install our scripts and hooks
 inst "$moddir/init" "/init"
 inst "$moddir/initqueue" "/sbin/initqueue"
+inst "$moddir/loginit" "/sbin/loginit"
 mkdir -p ${initdir}/initqueue
 mkdir -p ${initdir}/initqueue-finished
 mkdir -p ${initdir}/initqueue-settled