#!/bin/sh

config_file () {
    local NEW="$1.new"
    [ -f "$NEW" ] || { echo "$NEW does not exist!"; return; }

    if [ -f "$1" ] ; then
	if cmp -s "$1" "$NEW" ; then
	    rm "$NEW"
	else
	    echo
	    echo "You might want to check $NEW"
	    echo
	fi
    else
	mv $NEW $1
    fi
}

config_file etc/nas/nasd.conf

config_file etc/rc.d/rc.nasd

# Add to rc.local
grep dnsmasq etc/rc.d/rc.local > /dev/null 2>/dev/null
if [ $? -ne 0 ]; then
  cat <<EOF >> etc/rc.d/rc.local

if [ -x /etc/rc.d/rc.nasd ] ; then
  /etc/rc.d/rc.nasd start
fi
EOF
fi
