#!/bin/sh # Sample udhcpc renew script RESOLV_CONF="/tmp/resolv.conf" ADDRESSES="/tmp/addresses" MSG="DHCPc renew:" echo -ne "$MSG configuring $interface: address $ip" echo LOOPADDR=127.0.0.1 >$ADDRESSES echo ROUTADDR=192.168.1.1 >>$ADDRESSES echo PROVADDR=$ip >>$ADDRESSES chmod 755 $ADDRESSES if test -n "$broadcast"; then echo -ne ", broadcast $broadcast" BROADCAST="broadcast $broadcast" fi if test -n "$subnet"; then echo -ne ", netmask $subnet" NETMASK="netmask $subnet" fi echo /sbin/ifconfig $interface $ip $BROADCAST $NETMASK if test -n "$router"; then echo "$MSG deleting routers" while /sbin/route del default gw 0.0.0.0 dev $interface 2>&1 >/dev/null do : done echo -ne "$MSG adding routers: " for i in $router; do echo -ne "$i, " /sbin/route add default gw $i dev $interface done echo fi echo -n > $RESOLV_CONF if test -n "$domain"; then echo "$MSG adding domain $domain" echo domain $domain >> $RESOLV_CONF fi if test -n "$dns"; then echo -ne "$MSG adding dns servers: " for i in $dns; do echo -ne "$i, " echo nameserver $i >> $RESOLV_CONF done echo fi next_options="timezone timesvr namesvr logsvr cookiesvr lprsvr bootsize swapsvr rootpath ipttl mtu wins ntpsrv tftp bootfile" for opt in $next_options; do opt_name=$opt opt_val=`eval echo $"$opt_name"` if [ x"$opt_val"x != xx ]; then echo "$MSG ignored $opt=\"$opt_val\" parameter" fi done