2 # Copyright 1999-2012 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
6 extra_commands="rebuild"
7 extra_started_commands="reload"
8 description="NSD is an authoritative only, high performance, open source name server"
9 description_rebuild="Rebuild zone database"
10 description_reload="Rebuild zone database and reload it"
12 config_file=${config_file:-/etc/nsd/nsd.conf}
13 my_nsdc="/usr/sbin/nsdc"
14 my_nsd_checkconf="/usr/sbin/nsd-checkconf"
23 if ! test -e "${config_file}"; then
24 eerror "You need to create an appropriate config file."
25 eerror "An example can be found in /etc/nsd/nsd.conf.sample"
29 if ! ${my_nsd_checkconf} "${config_file}"; then
30 eerror "You have errors in your configfile (${config_file})"
37 local database=$(${my_nsd_checkconf} -o database ${config_file})
38 if ! test -f $database; then
39 eerror "You have no database file in ${database}, will try to rebuild"
46 local difffile=$(${my_nsd_checkconf} -o difffile ${config_file})
47 if test -s ${difffile}; then
48 ebegin "Patching NSD zone files"
49 ${my_nsdc} patch > /dev/null
55 ebegin "Rebuilding NSD zone database"
56 if ! ${my_nsdc} rebuild > /dev/null; then
57 eerror "There was an error rebuilding the database. Please review your zone files."
65 _checkconf || return 1
80 _checkconf || return 1
82 ebegin "Reloading NSD zone database"