#! /bin/sh
#
# network.sample $Revision: 1.4 $ $Date: 2004/08/17 21:42:40 $ (David Hinds)
# $Id: pcmcia-cs-network.script,v 1.4 2004/08/17 21:42:40 arekm Exp $
#
# 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

if [ ! -f /var/lock/subsys/network ]; then
    exit 0
fi


case "${action:?}" in
'start')
	/sbin/ifup ${device} boot
    ;;
'stop')
	/sbin/ifdown ${device} boot
	# to be always sure that device is down in case when it was
	# configured and up and then iface configuration was deleted
	ip link set ${device} down > /dev/null 2>&1
	ip addr flush dev ${device} > /dev/null 2>&1
    ;;
'restart')
	$0 stop ${device}
	$0 start ${device}
    ;;
esac
