projects
/
grml-etc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
/etc/init.d/grml-reboot: put reboot + halt binaries to the filesystem cache
[grml-etc.git]
/
etc
/
init.d
/
grml-reboot
diff --git
a/etc/init.d/grml-reboot
b/etc/init.d/grml-reboot
index
882246c
..
0b735a9
100755
(executable)
--- a/
etc/init.d/grml-reboot
+++ b/
etc/init.d/grml-reboot
@@
-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.
# 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: Mon
Jun 04 23:32:07 CEST 2007
[mika]
+# Latest change: Mon
Mär 10 18:45:36 CET 2008
[mika]
################################################################################
export PATH=/sbin:/bin:/usr/bin:/usr/sbin
################################################################################
export PATH=/sbin:/bin:/usr/bin:/usr/sbin
@@
-19,7
+19,7
@@
exec >/dev/console 2>&1 </dev/console
# Check if we are running from a GRML-CD or HD
INSTALLED=""
# Check if we are running from a GRML-CD or HD
INSTALLED=""
-[ -e /
GRML/
etc/grml_cd ] || INSTALLED=yes
+[ -e /etc/grml_cd ] || INSTALLED=yes
# Assume that we don't want the eject+prompt stuff when running in one
# of the special modes:
grep -qe ' toram' -qe ' usb' -qe 'serial' -qe 'fromhd' /proc/cmdline && INSTALLED=yes
# Assume that we don't want the eject+prompt stuff when running in one
# of the special modes:
grep -qe ' toram' -qe ' usb' -qe 'serial' -qe 'fromhd' /proc/cmdline && INSTALLED=yes
@@
-52,6
+52,10
@@
mysleep() {
# Disable kernel messages
echo "0" > /proc/sys/kernel/printk
# 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
# 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
@@
-64,7
+68,6
@@
if [ -d /sys/bus/pcmcia -a -x /sbin/pccardctl ] ; then
fi
if [ -n "$INSTALLED" ] ; then
fi
if [ -n "$INSTALLED" ] ; then
- echo
log_begin_msg_nn "Running /etc/init.d/rc ${level}: "
/etc/init.d/rc $level 1>/dev/null 2>&1 &
mysleep "$GREEN"
log_begin_msg_nn "Running /etc/init.d/rc ${level}: "
/etc/init.d/rc $level 1>/dev/null 2>&1 &
mysleep "$GREEN"
@@
-101,7
+104,7
@@
else
NETMOUNTS="$(awk '{if($1~/:/){print $2}}' /proc/mounts 2>/dev/null)"
if [ -n "$NETMOUNTS" ]; then
log_begin_msg "Unmounting network filesystems."
NETMOUNTS="$(awk '{if($1~/:/){print $2}}' /proc/mounts 2>/dev/null)"
if [ -n "$NETMOUNTS" ]; then
log_begin_msg "Unmounting network filesystems."
- umount -t nfs
-arvf 2>/dev/null ; log_end_msg $?
+ umount -t nfs
,nfs4,smbfs -alvf 2>/dev/null
fi
# Shutdown network
NETDEVICES="$(/sbin/ifconfig | awk '/^[^ ]+/ {print $1}' | grep -v '^lo$')"
fi
# Shutdown network
NETDEVICES="$(/sbin/ifconfig | awk '/^[^ ]+/ {print $1}' | grep -v '^lo$')"
@@
-147,12
+150,17
@@
if [ -z "$NOEJECT" ]; then
for dev in /proc/sys/dev/cdrom*/autoeject; do [ -f "$dev" ] && echo 1 > "$dev"; done
fi
for dev in /proc/sys/dev/cdrom*/autoeject; do [ -f "$dev" ] && echo 1 > "$dev"; done
fi
-#
Turn on auto-eject feature of cdrom (2.2 kernel)
+#
Detected cdrom device
if [ -z "$INSTALLED" ]; then
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
fi
-#
Now u
mount everything but root
+#
U
mount everything but root
log_begin_msg "Unmounting file systems."
# Be safe in case someone messed with /etc/mtab
log_begin_msg "Unmounting file systems."
# Be safe in case someone messed with /etc/mtab
@@
-165,7
+173,9
@@
fi
for i in /dev/loop*; do losetup -d $i 2>/dev/null; done
# Remove remaining unused modules (Kernel 2.4)
for i in /dev/loop*; do losetup -d $i 2>/dev/null; done
# Remove remaining unused modules (Kernel 2.4)
-rmmod -a >/dev/null 2>&1
+# rmmod -a >/dev/null 2>&1
+
+umount -t notmpfs,nosysfs,noproc,nousbfs -adrvf 1>/dev/null 2>&1
log_end_msg 0
log_end_msg 0
@@
-174,14
+184,14
@@
log_end_msg 0
if [ -z "$INSTALLED" -a -z "$NOPROMPT" ]; then
# do not prompt for removal when running in grml2ram mode:
if [ -z "$INSTALLED" -a -z "$NOPROMPT" ]; then
# do not prompt for removal when running in grml2ram mode:
- if ! mount | grep -q
'on /cdrom
' ; then
+ if ! mount | grep -q
e 'on /cdrom' -qe 'on /live/image
' ; then
echo "CD not mounted, nothing to eject therefore."
else
echo "CD not mounted, nothing to eject therefore."
else
- umount -l /cdrom
+ [ -d /live/image ] && umount -l /live/image
+ [ -d /cdrom ] && umount -l /cdrom
[ -n "$CDROM" -a -z "$NOEJECT" ] && eject -p "$CDROM" 2>/dev/null
[ -n "$CDROM" -a -z "$NOEJECT" ] && eject -p "$CDROM" 2>/dev/null
- echo ""
- echo "${GREEN}Please remove CD, close cdrom drive and hit return.${NORMAL}"
- read
+ echo
+ read -s -p "${GREEN}Please remove CD, close cdrom drive and hit return [auto 2 minutes].${NORMAL}" -t 120 a
fi
fi
fi
fi