#! /bin/sh
#
# network.sample 1.3 1994/11/12 02:36:09 (David Hinds)
#
# Initialize or shutdown a PCMCIA ethernet adapter
#
# This script should be invoked with two arguments.  The first is the
# action to be taken, either "start", "stop", or "restart".  The
# second is the network interface name.

action=$1
device=$2

# remote controlled by LISA via /etc/system.cnf
if [ -f /etc/system.cnf ]; then
	. /etc/system.cnf
fi

case "${action:?}" in
'start')
    /sbin/ifconfig ${device:?} up ${CONF_ETHER1_IP} broadcast ${CONF_ETHER1_BCAST} \
        netmask ${CONF_ETHER1_MASK}
    /sbin/route add -net ${CONF_ETHER1_NET} netmask ${CONF_ETHER1_MASK}
	if [ -n "$CONF_ROUTER1_IP" ]; then
    		/sbin/route add default gw ${CONF_ROUTER1_IP} metric 1
	fi
    ;;
'stop')
    /sbin/route del default
    /sbin/route del ${CONF_ETHER1_NET}
    /sbin/ifconfig ${device:?} down
    ;;
'restart')
    /sbin/ifconfig ${device:?} down up
    ;;
esac

