#!/bin/sh # udhcpc script edited by Tim Riker RESOLV_CONF="/etc/resolv.conf" [ -n "$1" ] || { echo "Error: should be called from udhcpc"; exit 1; } NETMASK="" [ -n "$subnet" ] && NETMASK="netmask $subnet" BROADCAST="broadcast +" [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast" case "$1" in deconfig) if [ -z "$TEMP_IP_ADDRESS" ]; then TEMP_IP_ADDRESS="192.168.0.3" fi echo "1 Setting IP address $TEMP_IP_ADDRESS on $interface" ifconfig $interface 0.0.0.0 ifconfig $interface $TEMP_IP_ADDRESS route add -net 239.0.0.0 netmask 255.0.0.0 gw $TEMP_IP_ADDRESS $interface ;; renew|bound) echo "2 Setting IP address $ip on $interface" ifconfig $interface $ip $NETMASK $BROADCAST echo $ip > /tmp/ip if [ -n "$router" ] ; then echo "Deleting routers" while route del default gw 0.0.0.0 dev $interface ; do : done metric=0 for i in $router ; do echo "Adding router $i" route add default gw $i dev $interface metric $((metric++)) done fi echo "Recreating $RESOLV_CONF" echo -n > $RESOLV_CONF-$$ [ -n "$domain" ] && echo "search $domain" >> $RESOLV_CONF-$$ for i in $dns ; do echo " Adding DNS server $i" echo "nameserver $i" >> $RESOLV_CONF-$$ done mv $RESOLV_CONF-$$ $RESOLV_CONF ;; esac exit 0