aboutsummaryrefslogtreecommitdiffstats
path: root/rc.d
diff options
context:
space:
mode:
Diffstat (limited to 'rc.d')
-rwxr-xr-xrc.d/init.d/functions64
-rwxr-xr-xrc.d/init.d/halt7
-rwxr-xr-xrc.d/init.d/network4
-rwxr-xr-xrc.d/init.d/nfsfs4
-rwxr-xr-xrc.d/init.d/random4
-rwxr-xr-xrc.d/rc4
-rwxr-xr-xrc.d/rc.sysinit43
7 files changed, 66 insertions, 64 deletions
diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions
index c3b42a65..882748f7 100755
--- a/rc.d/init.d/functions
+++ b/rc.d/init.d/functions
@@ -18,9 +18,14 @@ if [ -f /etc/sysconfig/init ]; then
. /etc/sysconfig/init
else
BOOTUP=color
+ LOGLEVEL=1
fi
-
+if [ "$BOOTUP" = "color" ]; then
+ INITLOG_ARGS="-q"
+else
+ INITLOG_ARGS=
+fi
# A function to start a program.
daemon() {
@@ -45,10 +50,10 @@ daemon() {
ulimit -c 0
# Echo daemon
- [ $BOOTUP != "color" ] && echo -n $base
+ [ $BOOTUP != "color" ] && echo -n " $base"
# And start it up.
- nice -n $nicelevel initlog -q -c "$*" && success -n "$base startup" || failure -n "$base startup"
+ nice -n $nicelevel initlog $INITLOG_ARGS -c "$*" && success "$base startup" || failure "$base startup"
}
# A function to stop a program.
@@ -76,24 +81,24 @@ killproc() {
# Kill it.
if [ "$pid" != "" ] ; then
- [ $BOOTUP != "color" ] && echo -n $base
+ [ $BOOTUP != "color" ] && echo -n "$base "
if [ "$notset" = 1 ] ; then
# TERM first, then KILL if not dead
- kill -TERM $pid && success -n "$base shutdown" || failure -n "$base shutdown"
+ kill -TERM $pid && success "$base shutdown" || failure "$base shutdown"
usleep 100000
if ps h $pid >/dev/null 2>&1 ; then
sleep 1
if ps h $pid >/dev/null 2>&1 ; then
sleep 3
- kill -KILL $pid && success -n "$base shutdown" || failure -n "$base shutdown"
+ kill -KILL $pid && success "$base shutdown" || failure "$base shutdown"
fi
fi
# use specified level only
else
- kill $killlevel $pid && success -n "$base shutdown" || failure -n "$base shutdown"
+ kill $killlevel $pid && success "$base shutdown" || failure "$base shutdown"
fi
else
- failure -n "$base shutdown"
+ failure "$base shutdown"
fi
# Remove pid file if any.
@@ -167,62 +172,48 @@ status() {
}
echo_success() {
- echo $* "[ OK ]"
+ echo -n "[ OK ]"
return 0
}
echo_failure() {
- echo $* "[FAILED]"
- return 0
+ echo -n "[FAILED]"
+ return 1
}
# Log that something succeeded
success() {
- if [ "$1" = "-n" ]; then
- ECHOARGS="-n"
- shift
- else
- ECHOARGS=""
- fi
if [ -z "$IN_INITLOG" ]; then
initlog -n $0 -s "$1" -e 1
else
echo "-n $0 -s \"$1\" -e 1" >&21
fi
- [ "$BOOTUP" = "color" ] && echo_success $ECHOARGS
+ [ "$BOOTUP" = "color" ] && echo_success
return 0
}
# Log that something failed
failure() {
- if [ "$1" = "-n" ]; then
- ECHOARGS="-n"
- shift
- else
- ECHOARGS=""
- fi
+ rc=$?
if [ -z "$IN_INITLOG" ]; then
initlog -n $0 -s "$1" -e 2
else
echo "-n $0 -s \"$1\" -e 2" >&21
fi
- [ "$BOOTUP" = "color" ] && echo_failure $ECHOARGS
- return 0
+ [ "$BOOTUP" = "color" ] && echo_failure
+ return $rc
}
# Run some action. Log its output.
action() {
- if [ "$1" = "-n" ]; then
- ECHOARGS="-n"
- shift
- else
- ECHOARGS=""
- fi
STRING=$1
- echo $ECHOARGS "$STRING "
+ echo -n "$STRING "
shift
if [ -z "$IN_INITLOG" ]; then
- initlog -q -c "$*" && success "$STRING" || failure "$STRING"
+ initlog $INITLOG_ARGS -c "$*" && success "$STRING" || failure "$STRING"
+ rc=$?
+ [ "$BOOTUP" = "color" ] && echo
+ return $rc
else
# This sucks.
output=`$*`
@@ -234,13 +225,16 @@ action() {
fi
if [ $rc ]; then
+ [ "$BOOTUP" = "color" ] || { echo ; echo $output ; }
success "$STRING"
else
+ echo
echo $output
failure "$STRING"
fi
+ [ "$BOOTUP" = "color" ] && echo
+ return $rc
fi
- return 0
}
# Confirm whether we really want to run this service
diff --git a/rc.d/init.d/halt b/rc.d/init.d/halt
index 61eab7b3..08cf9b67 100755
--- a/rc.d/init.d/halt
+++ b/rc.d/init.d/halt
@@ -16,7 +16,12 @@ PATH=/sbin:/bin:/usr/bin:/usr/sbin
runcmd() {
echo -n $1
shift
- $* && echo_success -n || echo_failure -n
+ if [ "$BOOTUP" = "color" ]; then
+ $* && echo_success || echo_failure
+ else
+ $*
+ fi
+ echo
}
# See how we were called.
diff --git a/rc.d/init.d/network b/rc.d/init.d/network
index 93f86480..fa67df29 100755
--- a/rc.d/init.d/network
+++ b/rc.d/init.d/network
@@ -57,7 +57,7 @@ ipv4_forward_set ()
fi
if [ $value != `cat /proc/sys/net/ipv4/ip_forward` ]; then
- action -n "$message" /bin/true
+ action "$message" /bin/true
echo "$value" > /proc/sys/net/ipv4/ip_forward
fi
fi
@@ -96,7 +96,7 @@ case "$1" in
;;
esac
./ifdown ifcfg-lo
- action -n "Disabling IPv4 packet forwarding" /bin/true
+ action "Disabling IPv4 packet forwarding" /bin/true
echo 0 > /proc/sys/net/ipv4/ip_forward
rm -f /var/lock/subsys/network
;;
diff --git a/rc.d/init.d/nfsfs b/rc.d/init.d/nfsfs
index 9b828248..89cd4a53 100755
--- a/rc.d/init.d/nfsfs
+++ b/rc.d/init.d/nfsfs
@@ -26,11 +26,11 @@ fi
# See how we were called.
case "$1" in
start)
- action -n "Mounting remote filesystems" mount -a -t nfs
+ action "Mounting remote filesystems" mount -a -t nfs
touch /var/lock/subsys/nfsfs
;;
stop)
- action -n "Unmounting remote filesystems" umount -a -t nfs
+ action "Unmounting remote filesystems" umount -a -t nfs
rm -f /var/lock/subsys/nfsfs
;;
status)
diff --git a/rc.d/init.d/random b/rc.d/init.d/random
index 27f2abd4..57b971f9 100755
--- a/rc.d/init.d/random
+++ b/rc.d/init.d/random
@@ -22,7 +22,7 @@ case "$1" in
else
touch $random_seed
fi
- action -n "Initializing random number generator" /bin/true
+ action "Initializing random number generator" /bin/true
chmod 600 $random_seed
dd if=/dev/urandom of=$random_seed count=1 bs=512 2>/dev/null
touch /var/lock/subsys/random
@@ -33,7 +33,7 @@ case "$1" in
# Save 512 bytes, which is the size of the entropy pool
touch $random_seed
chmod 600 $random_seed
- action -n "Saving random seed" dd if=/dev/urandom of=$random_seed count=1 bs=512 2>/dev/null
+ action "Saving random seed" dd if=/dev/urandom of=$random_seed count=1 bs=512 2>/dev/null
rm -f /var/lock/subsys/random
;;
diff --git a/rc.d/rc b/rc.d/rc
index 449df6cb..ca83b6e5 100755
--- a/rc.d/rc
+++ b/rc.d/rc
@@ -54,7 +54,7 @@ if [ -d /etc/rc.d/rc$runlevel.d ]; then
if egrep -q "(killproc |action )" $i ; then
$i stop
else
- action -n "Stopping $subsys" $i stop
+ action "Stopping $subsys" $i stop
fi
done
@@ -96,7 +96,7 @@ if [ -d /etc/rc.d/rc$runlevel.d ]; then
if [ "$subsys" = "halt" ] || [ "$subsys" = "reboot" ]; then
$i start
else
- action -n "Starting $subsys" $i start
+ action "Starting $subsys" $i start
fi
fi
done
diff --git a/rc.d/rc.sysinit b/rc.d/rc.sysinit
index ab962b70..7367b805 100755
--- a/rc.d/rc.sysinit
+++ b/rc.d/rc.sysinit
@@ -25,15 +25,18 @@ fi
# Source functions
. /etc/rc.d/init.d/functions
+# Fix console loglevel
+/sbin/loglevel 1
+
# Start up swapping.
-action -n "Activating swap partitions" swapon -a
+action "Activating swap partitions" swapon -a
# Set the hostname.
-action -n "Setting hostname ${HOSTNAME}" hostname ${HOSTNAME}
+action "Setting hostname ${HOSTNAME}" hostname ${HOSTNAME}
# Set the NIS domain name
if [ -n "$NISDOMAIN" ]; then
- action -n "Setting NIS domain name $NISDOMAIN" domainname $NISDOMAIN
+ action "Setting NIS domain name $NISDOMAIN" domainname $NISDOMAIN
else
domainname ""
fi
@@ -49,7 +52,7 @@ if [ -f /forcefsck ]; then
fi
if [ ! -f /fastboot ]; then
- action -n "Checking root filesystem" fsck -T -a $fsckoptions /
+ action "Checking root filesystem" fsck -T -a $fsckoptions /
rc=$?
# A return of 2 or higher means there were serious problems.
@@ -69,12 +72,12 @@ if [ ! -f /fastboot ]; then
echo "Automatic reboot in progress."
reboot
elif [ "$rc" = "1" -a -x /sbin/quotacheck ]; then
- action -n "Checking root filesystem quotas" /sbin/quotacheck -v /
+ action "Checking root filesystem quotas" /sbin/quotacheck -v /
fi
fi
if [ -x /sbin/quotaon ]; then
- action -n "Turning on user and group quotas for root filesystem" /sbin/quotaon /
+ action "Turning on user and group quotas for root filesystem" /sbin/quotaon /
fi
# check for arguments
@@ -90,14 +93,14 @@ fi
# set up pnp
if [ -x /sbin/isapnp -a -f /etc/isapnp.conf ]; then
if [ -n "$PNP" ]; then
- action -n "Setting up ISA PNP devices" /sbin/isapnp /etc/isapnp.conf
+ action "Setting up ISA PNP devices" /sbin/isapnp /etc/isapnp.conf
else
- action -n "Skipping ISA PNP configuration at users request" /bin/true
+ action "Skipping ISA PNP configuration at users request" /bin/true
fi
fi
# Remount the root filesystem read-write.
-action -n "Remounting root filesystem in read-write mode" mount -n -o remount,rw /
+action "Remounting root filesystem in read-write mode" mount -n -o remount,rw /
if [ -n "$IN_INITLOG" ]; then
IN_INITLOG=
@@ -138,9 +141,9 @@ fi
if [ -x /sbin/depmod -a -n "$USEMODULES" ]; then
# Get ready for kerneld if module support in the kernel
if [ -e /lib/modules/preferred ]; then
- action -n "Finding module dependencies" depmod -a preferred
+ action "Finding module dependencies" depmod -a preferred
else
- action -n "Finding module dependencies" depmod -a
+ action "Finding module dependencies" depmod -a
fi
fi
@@ -148,9 +151,9 @@ fi
if ! grep -i nomodules /proc/cmdline >/dev/null ; then
if [ -n "$USEMODULES" ]; then
if grep -s "alias sound" /etc/conf.modules > /dev/null ; then
- action -n "Loading sound module" modprobe sound
+ action "Loading sound module" modprobe sound
if grep -s "alias midi" /etc/conf.modules > /dev/null ; then
- action -n "Loading midi module" modprobe midi
+ action "Loading midi module" modprobe midi
fi
fi
fi
@@ -168,7 +171,7 @@ fi
# Add raid devices
if [ -f /proc/mdstat -a -f /etc/raidtab -a -x /sbin/raidadd ]; then
- action -n "Starting up RAID devices" raidadd -a
+ action "Starting up RAID devices" raidadd -a
rc=$?
@@ -198,7 +201,7 @@ fi
# Check filesystems
if [ ! -f /fastboot ]; then
- action -n "Checking filesystems" fsck -T -R -A -a $fsckoptions
+ action "Checking filesystems" fsck -T -R -A -a $fsckoptions
rc=$?
@@ -219,14 +222,14 @@ if [ ! -f /fastboot ]; then
echo "Automatic reboot in progress."
reboot
elif [ "$rc" = "1" -a -x /sbin/quotacheck ]; then
- action -n "Checking filesystem quotas" /sbin/quotacheck -v -R -a
+ action "Checking filesystem quotas" /sbin/quotacheck -v -R -a
fi
fi
# Mount all other filesystems (except for NFS and /proc, which is already
# mounted). Contrary to standard usage,
# filesystems are NOT unmounted in single user mode.
-action -n "Mounting local filesystems" mount -a -t nonfs,proc
+action "Mounting local filesystems" mount -a -t nonfs,proc
# set the console font
if [ -x /sbin/setsysfont ]; then
@@ -234,7 +237,7 @@ if [ -x /sbin/setsysfont ]; then
fi
if [ -x /sbin/quotaon ]; then
- action -n "Turning on user and group quotas for local filesystems" /sbin/quotaon -a
+ action "Turning on user and group quotas for local filesystems" /sbin/quotaon -a
fi
# Clean out /etc.
@@ -299,10 +302,10 @@ case "$ARC" in
esac
$CLOCK $CLOCKFLAGS
-action -n "Setting clock $CLOCKDEF: `date`" date
+action "Setting clock $CLOCKDEF: `date`" date
# Right, now turn on swap in case we swap to files.
-action -n "Enabling swap space" swapon -a 2>&1 | grep -v "busy"
+action "Enabling swap space" swapon -a 2>&1 | grep -v "busy"
# Initialize the serial ports.
if [ -f /etc/rc.d/rc.serial ]; then