#! /bin/sh

# Place this file in /etc. Will be called by dhclient when it receives
# new information.

# The directory and file radns writes to.
radns_dir="/usr/local/etc/radns"
radns_resolv="${radns_dir}/radns-resolv.conf"

# The real resolv.conf.
resolvconf="/etc/resolv.conf"

if [ -f $radns_resolv ]
then
    > $resolvconf
    [ "$new_domain_search" ] && echo search $new_domain_search >> $resolvconf
    [ "$new_domain_name" ] && echo domain $new_domain_name >> $resolvconf
    cat $radns_resolv >> $resolvconf

    if [ -n "$new_domain_name_servers" ]
    then
        for nameserver in $new_domain_name_servers
        do
            echo "nameserver $nameserver" >> $resolvconf
        done
    fi
fi
