diff options
author | beech <beech@FreeBSD.org> | 2013-02-26 05:59:11 +0800 |
---|---|---|
committer | beech <beech@FreeBSD.org> | 2013-02-26 05:59:11 +0800 |
commit | ea30813c6133a132db4179507e60d21ec9de1ec4 (patch) | |
tree | 4b9e1281a320350b0a836149d7b888d64149c8b2 /dns | |
parent | 828185b4011555684743b6b4f3d3c170c79f434c (diff) | |
download | freebsd-ports-gnome-ea30813c6133a132db4179507e60d21ec9de1ec4.tar.gz freebsd-ports-gnome-ea30813c6133a132db4179507e60d21ec9de1ec4.tar.zst freebsd-ports-gnome-ea30813c6133a132db4179507e60d21ec9de1ec4.zip |
- Add multi-instance support
PR: ports/176156
Submitted by: Darren Pilgrim <darren.pilgrim@gmail.com>
Approved by: Jaap Akkerhuis <jaap@NLnetLabs.nl> (maintainer)
Diffstat (limited to 'dns')
-rw-r--r-- | dns/nsd/files/nsd.in | 70 |
1 files changed, 48 insertions, 22 deletions
diff --git a/dns/nsd/files/nsd.in b/dns/nsd/files/nsd.in index 5021db398267..7f00215921a1 100644 --- a/dns/nsd/files/nsd.in +++ b/dns/nsd/files/nsd.in @@ -14,45 +14,71 @@ . /etc/rc.subr -name=nsd -rcvar=nsd_enable +case $0 in +/etc/rc*) + # during boot (shutdown) $0 is /etc/rc (/etc/rc.shutdown), + # so get the name of the script from $_file + name=$_file + ;; +*) + name=$0 + ;; +esac -required_files=%%PREFIX%%/etc/nsd/nsd.conf +name=${name##*/} -command=%%PREFIX%%/sbin/nsdc -command_args="start" -pidfile=`%%PREFIX%%/sbin/nsd-checkconf -o pidfile %%PREFIX%%/etc/nsd/nsd.conf` -procname=%%PREFIX%%/sbin/${name} +rcvar=${name}_enable load_rc_config ${name} -nsd_enable=${nsd_enable-"NO"} +eval ": \${${name}_conf:=\"%%PREFIX%%/etc/nsd/${name}.conf\"}" +eval "_conf=\${${name}_conf}" + +command=%%PREFIX%%/sbin/nsdc +procname=%%PREFIX%%/sbin/nsd + +required_files=${_conf} +pidfile=`%%PREFIX%%/sbin/nsd-checkconf -o pidfile ${_conf}` + +extra_commands="notify patch rebuild reload update" -extra_commands="reload" -start_precmd="nsd_precmd" -reload_cmd="nsd_reload" -stop_cmd="nsd_stop" +notify_cmd="nsd_nsdc_cmd notify" +patch_cmd="nsd_nsdc_cmd patch" +rebuild_cmd="nsd_nsdc_cmd rebuild" +reload_cmd="nsd_reload_cmd" +start_cmd="nsd_start_cmd" +stop_cmd="nsd_stop_cmd" +update_cmd="nsd_nsdc_cmd update" -nsd_precmd() +nsd_nsdc_cmd() { - db=`%%PREFIX%%/sbin/nsd-checkconf -o database %%PREFIX%%/etc/nsd/nsd.conf` - if [ ! -f "$db" ]; then - ${command} rebuild - fi + ${command} -c ${_conf} "$1" } -nsd_reload() +nsd_reload_cmd() { - ${command} rebuild && ${command} reload + nsd_nsdc_cmd rebuild && nsd_nsdc_cmd reload +} + +nsd_start_cmd() +{ + local _db + _db=`%%PREFIX%%/sbin/nsd-checkconf -o database ${_conf}` + if [ ! -f "${_db}" ]; then + nsd_nsdc_cmd rebuild + fi + + echo "Starting ${name}." + nsd_nsdc_cmd start } -nsd_stop() +nsd_stop_cmd() { echo "Merging nsd zone transfer changes to zone files." - ${command} patch + nsd_nsdc_cmd patch echo "Stopping ${name}." - ${command} stop + nsd_nsdc_cmd stop } run_rc_command "$1" |