#!/bin/sh # Sample udhcpc bound/renew script # Uncomment this to allow dhcpcd to set hostname of the host to the # hostname option supplied by DHCP server. #SET_HOSTNAME='yes' RESOLV_CONF="/etc/resolv.conf" [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast" [ -n "$subnet" ] && NETMASK="netmask $subnet" /sbin/ifconfig $interface $ip $BROADCAST $NETMASK if [ -n "$hostname" -a -n "$SET_HOSTNAME" ] then local current_hostname=$(hostname) if [ -z "$current_hostname" -o "$current_hostname" = "(none)" ]; then hostname "$hostname" fi fi if [ -n "$router" ] then echo "Resetting default routes" for i in `/sbin/route -n | grep ^default.*$interface` do route del default gw 0.0.0.0 dev $interface done for i in $router do /sbin/route add default gw $i dev $interface done fi # Update resolver configuration file R="" [ -n "$domain" ] && R="domain $domain " for i in $dns do echo adding dns $i R="${R}nameserver $i " done if [ -x /sbin/resolvconf ] ; then echo -n "$R" | resolvconf -a "${interface}.udhcpc" else echo -n "$R" > "$RESOLV_CONF" fi