/etc/init.d/grml-reboot: put reboot + halt binaries to the filesystem cache
[grml-etc.git] / etc / init.d / grml-reboot
index a7995b3..0b735a9 100755 (executable)
@@ -4,7 +4,7 @@
 # Authors:       grml-team (grml.org), (c) Klaus Knopper, (c) Michael Prokop <mika@grml.org>
 # Bug-Reports:   see http://grml.org/bugs/
 # License:       This file is licensed under the GPL v2.
-# Latest change: Fre Nov 16 11:37:58 CET 2007 [mika]
+# Latest change: Mon Mär 10 18:45:36 CET 2008 [mika]
 ################################################################################
 
 export PATH=/sbin:/bin:/usr/bin:/usr/sbin
@@ -52,6 +52,10 @@ mysleep() {
 # Disable kernel messages
 echo "0" > /proc/sys/kernel/printk
 
+# make sure halt/reboot commands are available even if
+# someone is using shutdown command:
+cat /sbin/halt /sbin/reboot >/dev/null
+
 # We may kill our network connection here before unmounting NFS. Bad luck.
 # poweroff pcmcia devices
 if [ -d /sys/bus/pcmcia -a -x /sbin/pccardctl ] ; then
@@ -148,7 +152,12 @@ fi
 
 # Detected cdrom device
 if [ -z "$INSTALLED" ]; then
-   CDROM="$(awk '/ \/cdrom /{print $1;exit 0;}' /proc/mounts)"
+   # new live-initramfs layout:
+   if [ -d /live/image ] ; then
+      CDROM="$(awk '/ \/live\/image /{print $1;exit 0;}' /proc/mounts)"
+   else # old unionfs layout:
+      CDROM="$(awk '/ \/cdrom /{print $1;exit 0;}' /proc/mounts)"
+   fi
 fi
 
 # Umount everything but root