add 04watchdog dracut module
authorHarald Hoyer <harald@redhat.com>
Mon, 18 Jun 2012 17:17:22 +0000 (19:17 +0200)
committerHarald Hoyer <harald@redhat.com>
Mon, 18 Jun 2012 18:05:25 +0000 (20:05 +0200)
dracut.spec
modules.d/04watchdog/module-setup.sh [new file with mode: 0755]
modules.d/04watchdog/watchdog.sh [new file with mode: 0755]
modules.d/99base/dracut-lib.sh

index eb5df2c..6e8c733 100644 (file)
@@ -254,6 +254,7 @@ rm -rf $RPM_BUILD_ROOT
 %{_mandir}/man5/dracut.conf.5*
 %{dracutlibdir}/modules.d/00bootchart
 %{dracutlibdir}/modules.d/00dash
+%{dracutlibdir}/modules.d/04watchdog
 %{dracutlibdir}/modules.d/05busybox
 %{dracutlibdir}/modules.d/10i18n
 %{dracutlibdir}/modules.d/30convertfs
diff --git a/modules.d/04watchdog/module-setup.sh b/modules.d/04watchdog/module-setup.sh
new file mode 100755 (executable)
index 0000000..eb46143
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/bash
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+check() {
+    return 255
+}
+
+depends() {
+    return 0
+}
+
+install() {
+    inst_hook cmdline   00 "$moddir/watchdog.sh"
+    inst_hook cmdline   50 "$moddir/watchdog.sh"
+    inst_hook pre-trigger 00 "$moddir/watchdog.sh"
+    inst_hook initqueue 00 "$moddir/watchdog.sh"
+    inst_hook mount     00 "$moddir/watchdog.sh"
+    inst_hook mount     50 "$moddir/watchdog.sh"
+    inst_hook pre-pivot 00 "$moddir/watchdog.sh"
+    inst_hook cleanup   00 "$moddir/watchdog.sh"
+}
+
diff --git a/modules.d/04watchdog/watchdog.sh b/modules.d/04watchdog/watchdog.sh
new file mode 100755 (executable)
index 0000000..712969f
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+if [ -e /dev/watchdog ]; then
+       >/dev/watchdog
+else
+       modprobe ib700wdt
+fi
index 3ecba9a..8cfd7b3 100755 (executable)
@@ -832,6 +832,8 @@ emergency_shell()
         fi
         [ -c "$_ctty" ] || _ctty=/dev/tty1
         strstr "$(setsid --help 2>/dev/null)" "ctty" && CTTY="-c"
+        # stop watchdog
+        echo 'V' > /dev/watchdog
         setsid $CTTY /bin/sh -i -l 0<$_ctty 1>$_ctty 2>&1
     else
         warn "$action has failed. To debug this issue add \"rd.shell\" to the kernel command line."