freebsd-dev/etc/pccard_ether
dougb 6f80654ae4 Apply a more consistent style to the echo statements in /etc/ scripts.
* Put quotes around each line
* Single quotes for lines with no variable interpolation
* Double quotes if there is
* Capitalize each word that begins a line
* Make echo -n 'Doing foo:' ... echo '.' more of a standard

No functionality changes
2000-12-17 08:16:06 +00:00

108 lines
1.9 KiB
Bash
Executable File

#!/bin/sh -
#
# $FreeBSD$
#
# pccard_ether interfacename [start|stop] [ifconfig option]
#
# example: pccard_ether ep0 start -link0
#
stop_dhcp() {
if [ -r /sbin/dhclient ]; then
pidfile="/var/run/dhclient.${interface}.pid"
if [ -s ${pidfile} ]; then
kill `cat ${pidfile}`
rm ${pidfile}
fi
elif [ -r /usr/local/sbin/dhcpc ]; then
pidfile="/var/run/dhcpc.${interface}.pid"
if [ -s ${pidfile} ]; then
kill `cat ${pidfile}`
rm ${pidfile}
fi
fi
}
start_dhcp() {
stop_dhcp
if [ -r /sbin/dhclient ]; then
pidfile="/var/run/dhclient.${interface}.pid"
/sbin/dhclient -pf ${pidfile} $interface
elif [ -r /usr/local/sbin/dhcpc ]; then
/usr/local/sbin/dhcpc $interface
else
echo 'DHCP client software not available (isc-dhcp2)'
fi
}
# Suck in the configuration variables
#
if [ -r /etc/defaults/rc.conf ]; then
. /etc/defaults/rc.conf
source_rc_confs
elif [ -r /etc/rc.conf ]; then
. /etc/rc.conf
fi
interface=$1
shift
startstop=$1
shift
case ${startstop} in
[Ss][Tt][Aa][Rr][Tt] | '')
case ${pccard_ifconfig} in
[Nn][Oo] | '')
;;
[Dd][Hh][Cc][Pp])
start_dhcp
;;
*)
ifconfig ${interface} ${pccard_ifconfig} $*
;;
esac
case ${defaultrouter} in
[Nn][Oo] | '')
;;
*)
static_routes="default ${static_routes}"
route_default="default ${defaultrouter}"
;;
esac
# Set up any static routes.
#
if [ -n "${static_routes}" ]; then
# flush beforehand, just in case....
route -n flush
arp -d -a
for i in ${static_routes}; do
eval route_args=\$route_${i}
route add ${route_args}
done
fi
# IPv6 setup
case ${ipv6_enable} in
[Yy][Ee][Ss])
case ${ipv6_gateway_enable} in
[Yy][Ee][Ss])
;;
*)
sysctl -w net.inet6.ip6.forwarding=0
sysctl -w net.inet6.ip6.accept_rtadv=1
ifconfig ${interface} up
rtsol ${interface}
;;
esac
;;
esac
;;
# Stop the interface
*)
/sbin/ifconfig ${interface} delete
stop_dhcp
;;
esac