#!/bin/sh

if ! [ -e settings ]; then OUTFILE="settings"; else OUTFILE="settings.new"; fi

cat > $OUTFILE << EOF
# You need to enter the path to your (r)ndc binary and
# the filename which BIND logs statistics to.
#
# Extra BIND configuration should not be necessary, however
# BIND should NOT be automatically generating statistics
# (use the 'statisticsinterval 0' option in named.conf) since
# this module will be doing it anyhow.
#
# Example:
#   BINDPATH=/usr/local/bin/rndc
#   BINDSTAT=/var/named/named.stats
#
EOF

if [ "$OUTFILE" = "settings.new" ]; then
  cat settings | grep "^APP=" >> $OUTFILE
  fi

echo
echo "Please check the settings file and adapt it to satisfy your needs."
if [ "$OUTFILE" = "settings.new" ]; then
  mkdir -p backup
  NOW=`date +%Y%m%d-%H%M%S`
  mv -f settings backup/settings-$NOW
  mv -f settings.new settings
  echo "a backup of the previous settings has been saved."
  fi
echo

