#!/bin/sh # udhcpc script # Store this as executable unix text file: /usr/share/udhcpc/default.script [ -z "$1" ] && echo "Error: should be called from udhcpc with one argument" && exit 1 RESOLV_CONF="/etc/resolv.conf" [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast" [ -n "$subnet" ] && NETMASK="netmask $subnet" case "$1" in leasefail) echo "$0 : leasefail" exit 1 ;; deconfig) /sbin/ifconfig $interface 0.0.0.0 ;; bound) echo "$0 $1, $interface $ip ..." /sbin/ifconfig $interface $ip $BROADCAST $NETMASK if route -n | egrep -q "^0.0.0.0"; then echo "$0 deleting default gw" route del default fi if [ -n "$router" ] ; then for i in $router ; do route add default gw $i dev $interface done 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 ;; renew) echo "$0 renew, $interface $ip ..." /sbin/ifconfig $interface $ip $BROADCAST $NETMASK ;; esac exit 0