summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Hendrikx (whyscream) <tom@whyscream.net>2009-01-18 18:38:55 +0000
committerTom Hendrikx (whyscream) <tom@whyscream.net>2009-01-18 18:38:55 +0000
commit2d142c0e667ecf9516c6f7eada86ed9e30b09db0 (patch)
treed31c4bbc32e3858fbb07490114343c93c118f12e /net-dns/nsd/files
parentmedia-sound/basicdsp: Drop XPM file. Gets compiled in. (diff)
downloadsunrise-2d142c0e667ecf9516c6f7eada86ed9e30b09db0.tar.gz
sunrise-2d142c0e667ecf9516c6f7eada86ed9e30b09db0.tar.bz2
sunrise-2d142c0e667ecf9516c6f7eada86ed9e30b09db0.zip
net-dns/nsd: improved ebuild and initd script
svn path=/sunrise/; revision=7668
Diffstat (limited to 'net-dns/nsd/files')
-rw-r--r--net-dns/nsd/files/nsd.confd2
-rw-r--r--net-dns/nsd/files/nsd.cron9
-rw-r--r--net-dns/nsd/files/nsd.initd71
3 files changed, 52 insertions, 30 deletions
diff --git a/net-dns/nsd/files/nsd.confd b/net-dns/nsd/files/nsd.confd
new file mode 100644
index 000000000..f6c365244
--- /dev/null
+++ b/net-dns/nsd/files/nsd.confd
@@ -0,0 +1,2 @@
+# Location of the nsd configuration file. Leave empty for the default.
+#config_file="/etc/nsd/nsd.conf"
diff --git a/net-dns/nsd/files/nsd.cron b/net-dns/nsd/files/nsd.cron
index 1174d407a..36aaf32b0 100644
--- a/net-dns/nsd/files/nsd.cron
+++ b/net-dns/nsd/files/nsd.cron
@@ -1,7 +1,10 @@
#!/bin/sh
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
#
-NSDC_BIN="/usr/sbin/nsdc"
+my_nsdc="/usr/sbin/nsdc"
-if [[ -x ${NSDC_BIN} ]]; then
- ${NSDC_BIN} update >>/dev/null 2>&1
+if [[ -x ${my_nsdc} ]]; then
+ ${my_nsdc} patch 1>/dev/null
fi
diff --git a/net-dns/nsd/files/nsd.initd b/net-dns/nsd/files/nsd.initd
index 6295e018e..a2ad26a73 100644
--- a/net-dns/nsd/files/nsd.initd
+++ b/net-dns/nsd/files/nsd.initd
@@ -1,16 +1,17 @@
#!/sbin/runscript
-# Copyright 1999-2008 Gentoo Foundation
+# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
#
-opts="${opts} reload configtest"
+opts="${opts} reload"
description="NSD is an authoritative only, high performance, open source name server"
description_start="Start the server"
description_stop="Stop the server"
-description_configtest="Check the syntax of the configuration file"
-description_reload="Reload the database file"
+description_reload="Rebuild zone database and reload it"
-CONTROL="/usr/sbin/nsdc"
+config_file=${config_file:-/etc/nsd/nsd.conf}
+my_nsdc="/usr/sbin/nsdc"
+my_nsd_checkconf="/usr/sbin/nsd-checkconf"
depend() {
need net
@@ -18,40 +19,56 @@ depend() {
provide auth-dns
}
-configtest() {
- ebegin "Checking config"
- if [ ! -e "/etc/nsd/nsd.conf" ]; then
- eerror "You need to create an appropriate config file"
- eerror "in /etc/nsd/ . An example can be found in /etc/nsd/nsd.conf.sample"
- return 1
- fi
-
- if ! nsd-checkconf "/etc/nsd/nsd.conf"; then
- eerror "You have errors in your configfile"
- return 1
- fi
- eend
+_checkconf() {
+ if [ ! -e "${config_file}" ]; then
+ eerror "You need to create an appropriate config file."
+ eerror "An example can be found in /etc/nsd/nsd.conf.sample"
+ return 1
+ fi
+
+ if ! ${my_nsd_checkconf} "${config_file}"; then
+ eerror "You have errors in your configfile (${config_file})"
+ return 1
+ fi
+ return 0
}
-start() {
- configtest || return 1
+_patch() {
+ local difffile=`${my_nsd_checkconf} -o difffile ${config_file}`
+ if test -s ${difffile}; then
+ ebegin "Patching NSD zone files"
+ ${my_nsdc} patch > /dev/null
+ eend $?
+ fi
+}
+_rebuild() {
+ if ! ${my_nsdc} rebuild > /dev/null; then
+ eerror "There was an error rebuilding the database. Please review your zone files."
+ return 1
+ fi
+ return 0
+}
+
+start() {
ebegin "Starting NSD"
- ${CONTROL} start
- ${CONTROL} running
+ _checkconf || return 1
+ ${my_nsdc} start
+ ${my_nsdc} running
eend $?
}
stop() {
ebegin "Stopping NSD"
- ${CONTROL} patch
- ${CONTROL} stop
+ _patch
+ ${my_nsdc} stop
eend $?
}
reload() {
- configtest || return 1
- ebegin "Reloading NSD"
- ${CONTROL} reload
+ ebegin "Rebuilding and reloading NSD zone database"
+ _checkconf || return 1
+ _rebuild || return 1
+ ${my_nsdc} reload
eend $?
}