]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - etc/pccard_ether
Grammar and formatting touch-ups to comments.
[FreeBSD/FreeBSD.git] / etc / pccard_ether
1 #!/bin/sh -
2 #
3 #       $Id: pccard_ether,v 1.10 1999/02/10 18:08:16 jkh Exp $
4 #
5 # pccard_ether interfacename [ifconfig option]
6 #
7 # example: pccard_ether ep0 -link0
8 #
9
10 # Suck in the configuration variables
11 if [ -f /etc/defaults/rc.conf ]; then
12         . /etc/defaults/rc.conf
13 elif [ -f /etc/rc.conf ]; then
14         . /etc/rc.conf
15 fi
16
17 if [ "x$pccard_ifconfig" != "xNO" ] ; then
18         if [ "x$pccard_ifconfig" = "xDHCP" ] ; then
19                 if [ -f /sbin/dhclient ] ; then
20                     if [ -s /var/run/dhclient.pid ] ; then
21                         kill `cat /var/run/dhclient.pid`
22                         rm /var/run/dhclient.pid
23                     fi
24                     /sbin/dhclient
25                 elif [ -f /usr/local/sbin/dhcpc ] ; then
26                     if [ -s /var/run/dhcpc.pid ] ; then
27                         kill `cat /var/run/dhcpc.pid`
28                         rm /var/run/dhcpc.pid
29                     fi
30                     /usr/local/sbin/dhcpc $* 
31                 else
32                     echo "DHCP client software not available (isc-dhcp2)"
33                 fi
34         else
35                 interface=$1
36                 shift
37                 ifconfig $interface $pccard_ifconfig $*
38         fi
39 fi
40
41 if [ "x$defaultrouter" != "xNO" ] ; then
42         static_routes="default ${static_routes}"
43         route_default="default ${defaultrouter}"
44 fi
45     
46 # Set up any static routes.
47 if [ "x${static_routes}" != "x" ]; then
48         # flush beforehand, just in case....
49         route -n flush
50         arp -d -a
51         for i in ${static_routes}; do
52                 eval route_args=\$route_${i}
53                 route add ${route_args}
54         done
55 fi