#! /bin/bash
#
# Written by Andrew McMillan, 10th November 1999
#  - styled on the pcmcia 'network' script by David Hinds (thanks)
#

DEVICE=whereami
RESOLV=/etc/resolv.conf


# Insert a section into the file in a manner similar to
# the entries inserted by the pcmcia package
if [ "$1" != "" ] ; then
    echo -n "# $DEVICE begin" > $RESOLV.N
    for PART in $@ ; do
        case "$PART" in
	    domain|search|nameserver)
	        echo -en "\n$PART" >> $RESOLV.N
		;;
	    *)
	        echo -en " $PART" >> $RESOLV.N
		;;
	esac
    done
    echo -e "\n# $DEVICE end" >> $RESOLV.N
    sed -e "/# $DEVICE begin/,/# $DEVICE end/d" $RESOLV >> $RESOLV.N
    mv $RESOLV.N $RESOLV
fi

