#! /bin/sh
#
# network.sample $Revision: 1.3 $ $Date: 2002/07/16 09:04:37 $ (David Hinds)
# $Id: pcmcia-cs-network.script,v 1.3 2002/07/16 09:04:37 misiek 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

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
