From b1c3fe8675bf6d6831b2d63adb42dc43ef96f69e Mon Sep 17 00:00:00 2001 From: Florian La Roche Date: Wed, 26 Jun 2002 09:02:16 +0000 Subject: - start cleaning up some sh coding things --- rc.d/init.d/halt | 62 +++++++++++++++++++++++++---------------------------- rc.d/init.d/killall | 3 +-- rc.d/rc.sysinit | 7 +++--- 3 files changed, 33 insertions(+), 39 deletions(-) (limited to 'rc.d') diff --git a/rc.d/init.d/halt b/rc.d/init.d/halt index 815ac4ac..82ffe34e 100755 --- a/rc.d/init.d/halt +++ b/rc.d/init.d/halt @@ -1,6 +1,6 @@ #!/bin/bash # -# rc.halt This file is executed by init when it goes into runlevel +# 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. # @@ -11,7 +11,7 @@ # Set the path. PATH=/sbin:/bin:/usr/bin:/usr/sbin -export NOLOCALE=1 +NOLOCALE=1 . /etc/init.d/functions runcmd() { @@ -32,29 +32,27 @@ halt_get_remaining() { # See how we were called. case "$0" in - *halt) + *halt) message=$"Halting system..." - command="halt" + command="/sbin/halt" ;; - *reboot) + *reboot) message=$"Please stand by while rebooting the system..." - command="reboot" + command="/sbin/reboot" ;; - *) - echo $"$0: call me as 'rc.halt' or 'rc.reboot' please!" + *) + echo $"$0: call me as 'halt' or 'reboot' please!" exit 1 ;; esac -if [ -n "$1" ]; then - case "$1" in +case "$1" in *start) ;; *) - echo $"Usage: (halt|reboot) {start}" + echo $"Usage: $0 {start}" exit 1 ;; - esac -fi +esac # Kill all processes. [ "${BASH+bash}" = bash ] && enable kill @@ -64,7 +62,7 @@ sleep 5 runcmd $"Sending all processes the KILL signal..." /sbin/killall5 -9 # Write to wtmp file before unmounting /var -halt -w +/sbin/halt -w # Save mixer settings, here for lack of a better place. grep -q "\(sparcaudio\|sound\)" /proc/devices @@ -93,26 +91,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 @@ -197,15 +195,13 @@ if [ -f /poweroff -o ! -f /halt ]; then HALTARGS="$HALTARGS -p" fi -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 +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 -k $DEVICE fi -if [ -x "/sbin/halt.local" ]; then +if [ -x /sbin/halt.local ]; then /sbin/halt.local fi -eval $command $HALTARGS +exec $command $HALTARGS diff --git a/rc.d/init.d/killall b/rc.d/init.d/killall index 823169e5..82208730 100755 --- a/rc.d/init.d/killall +++ b/rc.d/init.d/killall @@ -5,7 +5,7 @@ for i in /var/lock/subsys/*; do # Check if the script is there. - [ ! -f $i ] && continue + [ -f $i ] || continue # Get the subsystem name. subsys=${i#/var/lock/subsys/} @@ -19,4 +19,3 @@ for i in /var/lock/subsys/*; do rm -f $i fi done - diff --git a/rc.d/rc.sysinit b/rc.d/rc.sysinit index 61e21c4e..0d0786b1 100755 --- a/rc.d/rc.sysinit +++ b/rc.d/rc.sysinit @@ -1,19 +1,18 @@ #!/bin/bash # -# /etc/rc.sysinit - run once at boot time +# /etc/rc.d/rc.sysinit - run once at boot time # # Taken in part from Miquel van Smoorenburg's bcheckrc. # # Rerun ourselves through initlog -if [ -z "$IN_INITLOG" ]; then - [ -f /sbin/initlog ] && exec /sbin/initlog $INITLOG_ARGS -r /etc/rc.sysinit +if [ -z "$IN_INITLOG" -a -x /sbin/initlog ]; then + exec /sbin/initlog $INITLOG_ARGS -r /etc/rc.d/rc.sysinit fi # If we're using devfs, start devfsd now - we need the old device names [ -e /dev/.devfsd -a -x /sbin/devfsd ] && /sbin/devfsd /dev -# Set the path PATH=/bin:/sbin:/usr/bin:/usr/sbin export PATH -- cgit v1.2.1