summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xnetwork37
-rw-r--r--rc.conf14
-rwxr-xr-xrc.multi8
-rwxr-xr-xrc.shutdown16
4 files changed, 29 insertions, 46 deletions
diff --git a/network b/network
index 981cc2d..66f0a60 100755
--- a/network
+++ b/network
@@ -6,32 +6,23 @@
case "$1" in
start)
stat_busy "Starting Network"
- /sbin/ifconfig lo 127.0.0.1 netmask 255.255.255.255
- ret=$?
- if [ "$IPADDR" != "" -a "$NETMASK" != "" ]; then
- /sbin/ifconfig eth0 $IPADDR netmask $NETMASK
- ret=$?
- if [ "$GATEWAY" != "" ]; then
- /sbin/route add default gw $GATEWAY
- fi
- fi
- if [ $? -gt 0 -o $ret -gt 0 ]; then
- stat_fail
- else
- stat_done
- fi
+ for ifline in ${IF_UP[@]}; do
+ /sbin/ifconfig $ifline || stat_fail && exit 1
+ done
+ for rtline in ${ROUTE_UP[@]}; do
+ /sbin/route $rtline || stat_fail && exit 1
+ done
+ stat_done
;;
stop)
stat_busy "Stopping Network"
- /sbin/ifconfig lo down
- if [ ! `/sbin/ifconfig eth0 | egrep '^ *UP' &>/dev/null` ]; then
- /sbin/ifconfig eth0 down
- fi
- if [ $? -gt 0 ]; then
- stat_fail
- else
- stat_done
- fi
+ for rtline in ${ROUTE_DN[@]}; do
+ /sbin/route $rtline || stat_fail && exit 1
+ done
+ for ifline in ${IF_DN[@]}; do
+ /sbin/ifconfig $ifline || stat_fail && exit 1
+ done
+ stat_done
;;
restart)
$0 stop
diff --git a/rc.conf b/rc.conf
index 5585646..c6b3800 100644
--- a/rc.conf
+++ b/rc.conf
@@ -12,20 +12,20 @@ TIMEZONE=Canada/Pacific
# Networking
#
HOSTNAME="myhost"
-IPADDR="192.168.0.2"
-NETMASK="255.255.255.0"
-GATEWAY="192.168.0.1"
+IF_UP=("lo 127.0.0.1" "eth0 192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.255")
+IF_DN=("lo down" "eth0 down")
+ROUTE_UP=("add default gw 192.168.0.1")
+ROUTE_DN=("del default gw 192.168.0.1")
#
-# Daemons to start at boot-up
+# Daemons to start at boot-up (in this order)
+# (prefix a daemon with a ! to disable it)
#
-DAEMONS=(crond inetd)
+DAEMONS=(!pcmcia network crond inetd)
#
# PCMCIA
#
-# Set to "yes" to use PCMCIA Services
-PCMCIA=no
# Should be either i82365 or tcic
PCIC=i82365
PCIC_OPTS=
diff --git a/rc.multi b/rc.multi
index cb6def7..c68252a 100755
--- a/rc.multi
+++ b/rc.multi
@@ -6,14 +6,6 @@
. /etc/rc.conf
. /etc/rc.d/functions
-# Start pcmcia
-if [ "$PCMCIA" = "yes" -a -f /etc/rc.d/pcmcia ]; then
- /etc/rc.d/pcmcia start
-fi
-
-# Start network
-/etc/rc.d/network start
-
# Start daemons
for daemon in "${DAEMONS[@]}"; do
/etc/rc.d/$daemon start
diff --git a/rc.shutdown b/rc.shutdown
index c0f9655..4688a6b 100755
--- a/rc.shutdown
+++ b/rc.shutdown
@@ -14,19 +14,19 @@ echo " ]"
if [ "$PREVLEVEL" = "3" -o "$PREVLEVEL" = "5" ]; then
# Shutdown daemons
+ let i=${#DAEMONS[@]}
+ while [[ i -gt 0 ]]; do
+ if [[ `echo ${DAEMONS[$i]} | grep '^[^\!]' | wc -l` -eq 1 ]]; then
+ /etc/rc.d/${DAEMONS[$i]} stop
+ fi
+ let i=i-1
+ done
+ # find any leftover daemons and shut them down
if [ -d /var/run/daemons ]; then
for daemon in `ls /var/run/daemons`; do
/etc/rc.d/$daemon stop
done
fi
-
- # Shutdown network
- /etc/rc.d/network stop
-
- # Shutdown pcmcia
- if [ "$PCMCIA" = "yes" -a -f /etc/rc.d/pcmcia ]; then
- /etc/rc.d/pcmcia stop
- fi
fi
# Terminate all processes