63 lines
1.3 KiB
Bash
Executable File
63 lines
1.3 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# udhcpc script edited by Tim Riker <Tim@Rikers.org>
|
|
# zcip integration idea from here: http://osdir.com/ml/network.zeroconf.workers/2005-06/msg00000.html
|
|
|
|
[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
|
|
|
|
RESOLV_CONF="/etc/resolv.conf"
|
|
[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
|
|
[ -n "$subnet" ] && NETMASK="netmask $subnet"
|
|
|
|
/usr/bin/logger "udhcpc_action $interface $1 ip=$ip"
|
|
|
|
do_config() {
|
|
killall zcip > /dev/null
|
|
/sbin/ifconfig $interface $ip $NETMASK
|
|
|
|
while route del default gw 0.0.0.0 dev $interface ; do
|
|
:
|
|
done
|
|
|
|
if [ -n "$router" ] ; then
|
|
metric=0
|
|
for i in $router ; do
|
|
route add default gw $i dev $interface metric $metric
|
|
metric=$metric+1
|
|
done
|
|
else
|
|
route add default dev $interface
|
|
fi
|
|
|
|
echo -n > $RESOLV_CONF
|
|
[ -n "$domain" ] && echo search $domain >> $RESOLV_CONF
|
|
for i in $dns ; do
|
|
echo adding dns $i
|
|
echo nameserver $i >> $RESOLV_CONF
|
|
done
|
|
}
|
|
|
|
|
|
case "$1" in
|
|
deconfig)
|
|
killall zcip > /dev/null
|
|
/sbin/ifconfig $interface 0.0.0.0
|
|
;;
|
|
|
|
fail|leasefail)
|
|
(ps | grep zcip | grep -q -v grep) || /sbin/zcip -v $interface /etc/network/zcip.script > /dev/null &
|
|
;;
|
|
|
|
bound)
|
|
/etc/init.d/S99octo stopoctoserve
|
|
do_config
|
|
/etc/init.d/S99octo startoctoserve
|
|
;;
|
|
|
|
renew)
|
|
do_config
|
|
;;
|
|
esac
|
|
|
|
exit 0
|