3 # udhcpc script edited by Tim Riker <Tim@Rikers.org>
5 [ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
7 RESOLV_CONF
="/etc/resolv.conf"
8 [ -e $RESOLV_CONF ] ||
touch $RESOLV_CONF
9 [ -n "$broadcast" ] && BROADCAST
="broadcast $broadcast"
10 [ -n "$subnet" ] && NETMASK
="netmask $subnet"
14 /sbin
/ifconfig
$interface up
15 /sbin
/ifconfig
$interface 0.0.0.0
17 # drop info from this interface
18 # resolv.conf may be a symlink to /tmp/, so take care
20 grep -vE "# $interface\$" $RESOLV_CONF > $TMPFILE
21 cat $TMPFILE > $RESOLV_CONF
24 if [ -x /usr
/sbin
/avahi-autoipd
]; then
25 /usr
/sbin
/avahi-autoipd
-k $interface
30 if [ -x /usr
/sbin
/avahi-autoipd
]; then
31 /usr
/sbin
/avahi-autoipd
-wD $interface --no-chroot
36 if [ -x /usr
/sbin
/avahi-autoipd
]; then
37 /usr
/sbin
/avahi-autoipd
-k $interface
39 /sbin
/ifconfig
$interface $ip $BROADCAST $NETMASK
41 if [ -n "$router" ] ; then
42 echo "deleting routers"
43 while route del default gw
0.0.0.0 dev
$interface 2> /dev
/null
; do
48 route add default gw
$i dev
$interface
52 # drop info from this interface
53 # resolv.conf may be a symlink to /tmp/, so take care
55 grep -vE "# $interface\$" $RESOLV_CONF > $TMPFILE
56 cat $TMPFILE > $RESOLV_CONF
59 # prefer rfc3359 domain search list (option 119) if available
60 if [ -n "$search" ]; then
62 elif [ -n "$domain" ]; then
66 [ -n "$search_list" ] &&
67 echo "search $search_list # $interface" >> $RESOLV_CONF
71 echo "nameserver $i # $interface" >> $RESOLV_CONF
77 for hook
in "${HOOK_DIR}/"*; do
78 [ -f "${hook}" -a -x "${hook}" ] ||
continue