pccard_ether revision 57144
1#!/bin/sh -
2#
3# $FreeBSD: head/etc/pccard_ether 57144 2000-02-11 14:49:42Z nsayer $
4#
5# pccard_ether interfacename [ifconfig option]
6#
7# example: pccard_ether ep0 -link0
8#
9
10# Suck in the configuration variables
11#
12if [ -r /etc/defaults/rc.conf ]; then
13	. /etc/defaults/rc.conf
14elif [ -r /etc/rc.conf ]; then
15	. /etc/rc.conf
16fi
17
18interface=$1
19shift
20
21case ${pccard_ifconfig} in
22[Nn][Oo] | '')
23        ;;
24[Dd][Hh][Cc][Pp])
25	if [ -r /sbin/dhclient ]; then
26		if [ -s /var/run/dhclient.pid ]; then
27			kill `cat /var/run/dhclient.pid`
28			rm /var/run/dhclient.pid
29		fi
30		/sbin/dhclient $interface
31	elif [ -r /usr/local/sbin/dhcpc ]; then
32		if [ -s /var/run/dhcpc.pid ]; then
33			kill `cat /var/run/dhcpc.pid`
34			rm /var/run/dhcpc.pid
35		fi
36		/usr/local/sbin/dhcpc $interface $*
37	else
38		echo "DHCP client software not available (isc-dhcp2)"
39	fi
40	;;
41*)
42	ifconfig ${interface} ${pccard_ifconfig} $*
43	;;
44esac
45
46case ${defaultrouter} in
47[Nn][Oo] | '')
48        ;;
49*)
50	static_routes="default ${static_routes}"
51	route_default="default ${defaultrouter}"
52	;;
53esac
54
55# Set up any static routes.
56#
57if [ -n "${static_routes}" ]; then
58	# flush beforehand, just in case....
59        route -n flush
60	arp -d -a
61	for i in ${static_routes}; do
62		eval route_args=\$route_${i}
63		route add ${route_args}
64	done
65fi
66