#!/bin/sh

debug=0;

chown -R www /home/genesis
sudo -u www svn up /home/genesis
sh /home/dns_generator/run.sh clean
sh /home/dns_generator/run.sh gendns
if [ ! $? = 0 ]; then
	echo "ERRORS in GENESIS FILES"
	exit 1
fi

sh /home/dns_generator/run.sh validate
if [ $? = 0 ]; then
  if [ $debug = 0 ]; then
    cp /home/dns_generator/*.in-addr.arpa /home/dns/master
    cp /home/dns_generator/*.NET.* /home/dns/master
    /etc/rc.d/named restart
  fi
else
  if [ $debug = 1 ]; then
    echo "CONFIG ERRORS"
  fi
fi
