summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJudd Vinet <judd@archlinux.org>2002-07-24 02:57:16 +0000
committerJudd Vinet <judd@archlinux.org>2002-07-24 02:57:16 +0000
commitfd8fde036ab46b593590b362bc94b051e432a295 (patch)
tree06fe9bb2ce1828ea03261828ee5eda6d7e751517
parent2b503065569fa2ffedf5eafc76158c74062ac49b (diff)
Upgraded initscripts to 0.30.3
-rw-r--r--functions65
-rwxr-xr-xnetwork16
-rwxr-xr-xrc.sysinit33
3 files changed, 66 insertions, 48 deletions
diff --git a/functions b/functions
index f4c4efa..dcd391a 100644
--- a/functions
+++ b/functions
@@ -1,3 +1,4 @@
+#!/bin/bash
#
# functions
#
@@ -5,46 +6,72 @@
STAT_COL=68
deltext() {
- echo -ne "\033[$(($STAT_COL+4))G"
+ echo -ne "\033[$(($STAT_COL+4))G"
}
stat_busy() {
- echo -n "[ $1 "
- awk "BEGIN { for (j=length(\"$1\"); j<$STAT_COL; j++) printf \" \" }"
- echo -n " BUSY ]"
+ echo -n "[ $1 "
+ awk "BEGIN { for (j=length(\"$1\"); j<$STAT_COL; j++) printf \" \" }"
+ echo -n " BUSY ]"
}
stat_done() {
- deltext
- echo " DONE ]"
+ deltext
+ echo " DONE ]"
}
stat_fail() {
- deltext
- echo " FAILED ]"
+ deltext
+ echo " FAILED ]"
}
stat_die() {
- stat_fail
- exit 1
+ stat_fail
+ exit 1
}
+#
+# here for legcay reasons: use 'status' instead
+#
checkret() {
- $* >/dev/null 2>&1
- if [ $? -gt 0 ]; then
- stat_fail
- else
- stat_done
- fi
+ $* >/dev/null 2>&1
+ if [ $? -gt 0 ]; then
+ stat_fail
+ return 0
+ else
+ stat_done
+ return 1
+ fi
+}
+
+status() {
+ stat_busy "$1"
+ shift
+ $* >/dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ stat_done
+ return 0
+ else
+ stat_fail
+ return 1
+ fi
}
add_daemon() {
- [ -d /var/run/daemons ] || mkdir -p /var/run/daemons
- touch /var/run/daemons/$1
+ [ -d /var/run/daemons ] || mkdir -p /var/run/daemons
+ touch /var/run/daemons/$1
}
rm_daemon() {
- rm -f /var/run/daemons/$1
+ rm -f /var/run/daemons/$1
+}
+
+ck_daemon() {
+ if [ -f /var/run/daemons/$1 ]; then
+ return 1
+ else
+ return 0
+ fi
}
# End of file
diff --git a/network b/network
index 20f9f76..c650fbc 100755
--- a/network
+++ b/network
@@ -6,6 +6,7 @@
case "$1" in
start)
+ ck_daemon network || exit
stat_busy "Starting Network"
for ifline in ${INTERFACES[@]}; do
if echo $ifline | grep '^[^\!]' 2>&1 > /dev/null; then
@@ -15,7 +16,7 @@ case "$1" in
/usr/sbin/dhcpcd $ifline || stat_die
else
/sbin/ifconfig $new_ifline || stat_die
- fi
+ fi
fi
done
for rtline in "${ROUTES[@]}"; do
@@ -25,10 +26,13 @@ case "$1" in
/sbin/route add $new_rtline || stat_die
fi
done
+ add_daemon network
stat_done
;;
stop)
+ ck_daemon network && exit
stat_busy "Stopping Network"
+ rm_daemon network
for rtline in "${ROUTES[@]}"; do
if echo $rtline | grep '^[^\!]' 2>&1 > /dev/null; then
varname="\$${rtline}"
@@ -40,12 +44,12 @@ case "$1" in
if echo $ifline | grep '^[^\!]' 2>&1 > /dev/null; then
varname="\$${ifline}"
eval new_ifline=$varname
- if [ "$new_ifline" = "dhcp" ]; then
- # do nothing - we kill dhcpcd later
- /bin/true
- else
+ if [ "$new_ifline" = "dhcp" ]; then
+ # do nothing - we kill dhcpcd later
+ /bin/true
+ else
/sbin/ifconfig $new_ifline down || stat_die
- fi
+ fi
fi
done
/usr/bin/killall -q dhcpcd
diff --git a/rc.sysinit b/rc.sysinit
index 047ceeb..2d257a4 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -13,14 +13,11 @@ echo " ]"
. /etc/rc.conf
. /etc/rc.d/functions
-stat_busy "Starting DevFS Daemon"
-checkret /sbin/devfsd /dev
+status "Starting DevFS Daemon" /sbin/devfsd /dev
-stat_busy "Activating Swap"
-checkret /sbin/swapon -a
+status "Activating Swap" /sbin/swapon -a
-stat_busy "Mounting Root Read-only"
-checkret /bin/mount -n -o remount,ro /
+status "Mounting Root Read-only" /bin/mount -n -o remount,ro /
stat_busy "Checking Filesystems"
/sbin/fsck -A -T -C -a
@@ -61,29 +58,21 @@ stat_busy "Removing Leftover Files"
: > /var/run/utmp
stat_done
-stat_busy "Updating Shared Library Links"
-/sbin/ldconfig
-stat_done
+status "Updating Shared Library Links" /sbin/ldconfig
if [ "$HOSTNAME" != "" ]; then
- stat_busy "Setting Hostname: $HOSTNAME"
- checkret /bin/hostname $HOSTNAME
+ status "Setting Hostname: $HOSTNAME" /bin/hostname $HOSTNAME
fi
-stat_busy "Starting System Logger"
-checkret /usr/sbin/syslogd -m 0
+status "Starting System Logger" /usr/sbin/syslogd -m 0
-stat_busy "Starting Kernel Logger"
-checkret /usr/sbin/klogd -c 4
+status "Starting Kernel Logger" /usr/sbin/klogd -c 4
-stat_busy "Updating Module Dependencies"
-checkret /sbin/depmod -a
+status "Updating Module Dependencies" /sbin/depmod -a
-stat_busy "Initializing Random Seed"
if [ -f /var/run/random-seed ]; then
- /bin/cat /var/run/random-seed > /dev/urandom
+ status "Initializing Random Seed" /bin/cat /var/run/random-seed > /dev/urandom
fi
-stat_done
stat_busy "Configuring System Clock"
if [ ! -f /etc/adjtime ]; then
@@ -96,9 +85,7 @@ fi
stat_done
if [ "$KEYMAP" != "" ]; then
- stat_busy "Loading Keyboard Map: $KEYMAP"
- /bin/loadkeys -q $KEYMAP
- stat_done
+ status "Loading Keyboard Map: $KEYMAP" /bin/loadkeys -q $KEYMAP
fi
# Screen blanks after 15 minutes idle time