diff options
author | Judd Vinet <judd@archlinux.org> | 2002-04-15 06:41:16 +0000 |
---|---|---|
committer | Judd Vinet <judd@archlinux.org> | 2002-04-15 06:41:16 +0000 |
commit | 5b61b6c2bf49d75df992a4dc39757e66a536dbcd (patch) | |
tree | 70c94a870d661f34cdbdc66aae3ad846d4b3b997 | |
parent | 91fd2beff99c9e623a201c8221964353c8669044 (diff) |
Updated initscripts for multiple ethernet interfaces
-rwxr-xr-x | network | 37 | ||||
-rw-r--r-- | rc.conf | 14 | ||||
-rwxr-xr-x | rc.multi | 8 | ||||
-rwxr-xr-x | rc.shutdown | 16 |
4 files changed, 29 insertions, 46 deletions
@@ -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 @@ -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= @@ -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 |