#!/bin/sh
# /etc/pcmcia/network
# taken from gentoo package pcmcia-cs-3.2.5-r3
# and modified by Daniel Kozak (pleusicles@gmail.com)
# to handle both sysvinit and initng style starting
# of network services

if [ -r ./shared ] ; then . ./shared ; else . /etc/pcmcia/shared ; fi

# Get device attributes
get_info $DEVICE
HWADDR=`/sbin/ifconfig $DEVICE | sed -ne 's/.*\(..:..:..:..:..:..\).*/\1/p'`

# Load site-specific settings
ADDRESS="$SCHEME,$SOCKET,$INSTANCE,$HWADDR"

RESOLV=/etc/resolv.conf

# Now, run the specific script for Wireless LAN interfaces
# Note : we need the wireless parameters to be set up before IP parameters,
# so that we can perform DHCP over the Wireless link if needed. Jean II
O_INFO=$INFO ; INFO=
if [ -x ./wireless ] ; then
    . ./wireless
else
    . /etc/pcmcia/wireless
fi
INFO=$O_INFO


case "${ACTION}" in
	"start" | "resume" )
		if cat /proc/1/cmdline | grep -q initng
		then 
		    /sbin/ngc -u net/$DEVICE
		else
		    /etc/init.d/net.$DEVICE start
		fi
		;;
	"stop")
		if cat /proc/1/cmdline | grep -q initng
		then 
		    /sbin/ngc -d net/$DEVICE
		else
		    /etc/init.d/net.$DEVICE stop
		fi
		;;
	"check")
		;;
esac
