#!/bin/bash

. ${TOOLKIT}-functions.sh

set -e

$SOMETHING_CHANGED || exit 0

update-service --check dnslocal		|| update-service --add /etc/dnslocal
update-service --check dnscachex	|| update-service --add /etc/dnscachex


# rebuild links
#
cd /etc
updatelink dnslocal/root dns

cd /var/log
updatelink ../../dnslocal/log/main dnslocal
updatelink ../../dnscachex/log/main dnscachex


# rebuild dns
#
cd /etc/dns
if [ -f hosts.src ]
then
	rm -f data data.cdb
	make
else
	putwarning "DJBDNS hosts.src" \
		"go to /etc/dns directory, fill your dns entries into the " \
		"file 'hosts.src' and type the command 'make' to rebuild the db"
fi

exit 0
