aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2002-10-18 20:11:42 +0000
committerBill Nottingham <notting@redhat.com>2002-10-18 20:11:42 +0000
commit905463ad1200485ed0046854bb2ea1f649329d93 (patch)
treeb82278c3a8953dd0a08edc621b7e15d8f65602ac
parent050c3c46d10ca188f139022ff588e89582a83769 (diff)
downloadinitscripts-905463ad1200485ed0046854bb2ea1f649329d93.tar
initscripts-905463ad1200485ed0046854bb2ea1f649329d93.tar.gz
initscripts-905463ad1200485ed0046854bb2ea1f649329d93.tar.bz2
initscripts-905463ad1200485ed0046854bb2ea1f649329d93.tar.xz
initscripts-905463ad1200485ed0046854bb2ea1f649329d93.zip
merge tmpfs fix back
-rwxr-xr-xrc.d/init.d/halt73
1 files changed, 41 insertions, 32 deletions
diff --git a/rc.d/init.d/halt b/rc.d/init.d/halt
index 9c27a847..d6b585de 100755
--- a/rc.d/init.d/halt
+++ b/rc.d/init.d/halt
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# halt This file is executed by init when it goes into runlevel
+# rc.halt This file is executed by init when it goes into runlevel
# 0 (halt) or runlevel 6 (reboot). It kills all processes,
# unmounts file systems and then either halts or reboots.
#
@@ -8,7 +8,10 @@
# Modified for RHS Linux by Damien Neil
#
-NOLOCALE=1
+# Set the path.
+PATH=/sbin:/bin:/usr/bin:/usr/sbin
+
+export NOLOCALE=1
. /etc/init.d/functions
runcmd() {
@@ -30,27 +33,29 @@ halt_get_remaining() {
# See how we were called.
case "$0" in
- *halt)
+ *halt)
message=$"Halting system..."
- command="/sbin/halt"
+ command="halt"
;;
- *reboot)
+ *reboot)
message=$"Please stand by while rebooting the system..."
- command="/sbin/reboot"
+ command="reboot"
;;
- *)
- echo $"$0: call me as 'halt' or 'reboot' please!"
+ *)
+ echo $"$0: call me as 'rc.halt' or 'rc.reboot' please!"
exit 1
;;
esac
-case "$1" in
+if [ -n "$1" ]; then
+ case "$1" in
*start)
;;
*)
- echo $"Usage: $0 {start}"
+ echo $"Usage: (halt|reboot) {start}"
exit 1
;;
-esac
+ esac
+fi
# Kill all processes.
[ "${BASH+bash}" = bash ] && enable kill
@@ -60,7 +65,7 @@ sleep 5
runcmd $"Sending all processes the KILL signal..." /sbin/killall5 -9
# Write to wtmp file before unmounting /var
-/sbin/halt -w
+halt -w
# Save mixer settings, here for lack of a better place.
grep -q "\(sparcaudio\|sound\)" /proc/devices
@@ -89,26 +94,26 @@ CLOCKFLAGS="$CLOCKFLAGS --systohc"
case "$UTC" in
yes|true)
- CLOCKFLAGS="$CLOCKFLAGS -u";
- CLOCKDEF="$CLOCKDEF (utc)";
- ;;
+ CLOCKFLAGS="$CLOCKFLAGS -u";
+ CLOCKDEF="$CLOCKDEF (utc)";
+ ;;
no|false)
- CLOCKFLAGS="$CLOCKFLAGS --localtime";
- CLOCKDEF="$CLOCKDEF (localtime)";
- ;;
+ CLOCKFLAGS="$CLOCKFLAGS --localtime";
+ CLOCKDEF="$CLOCKDEF (localtime)";
+ ;;
esac
case "$ARC" in
- yes|true)
- CLOCKFLAGS="$CLOCKFLAGS -A";
- CLOCKDEF="$CLOCKDEF (arc)";
- ;;
+ yes|true)
+ CLOCKFLAGS="$CLOCKFLAGS -A";
+ CLOCKDEF="$CLOCKDEF (arc)";
+ ;;
esac
case "$SRM" in
- yes|true)
+ yes|true)
CLOCKFLAGS="$CLOCKFLAGS -S";
CLOCKDEF="$CLOCKDEF (srm)";
- ;;
+ ;;
esac
runcmd $"Syncing hardware clock to system time" /sbin/hwclock $CLOCKFLAGS
@@ -188,16 +193,20 @@ elif [ -f /forcefsck ]; then
echo $"On the next boot fsck will be forced."
fi
-if [ "$command" = /sbin/halt -a -r /etc/ups/upsmon.conf -a -f /etc/killpower -a -f /etc/sysconfig/ups ] ; then
- . /etc/sysconfig/ups
- [ "$SERVER" = "yes" -a "$MODEL" != "NONE" -a -n "$MODEL" -a -n "$DEVICE" ] && $MODEL $OPTIONS_HALT -k $DEVICE
+HALTARGS="-i -d"
+if [ -f /poweroff -o ! -f /halt ]; then
+ HALTARGS="$HALTARGS -p"
fi
-if [ -x /sbin/halt.local ]; then
- /sbin/halt.local
+if [ "$command" = halt ] ; then
+ if [ -r /etc/ups/upsmon.conf -a -f /etc/killpower -a -f /etc/sysconfig/ups ] ; then
+ . /etc/sysconfig/ups
+ [ "$SERVER" = "yes" -a "$MODEL" != "NONE" -a -n "$MODEL" -a -n "$DEVICE" ] && $MODEL -k $DEVICE
+ fi
fi
-HALTARGS="-i -d"
-[ -f /poweroff -o ! -f /halt ] && HALTARGS="$HALTARGS -p"
+if [ -x "/sbin/halt.local" ]; then
+ /sbin/halt.local
+fi
-exec $command $HALTARGS
+eval $command $HALTARGS