From owner-svn-ports-head@FreeBSD.ORG Mon Feb 25 21:59:12 2013 Return-Path: Delivered-To: svn-ports-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 97FB18E8; Mon, 25 Feb 2013 21:59:12 +0000 (UTC) (envelope-from beech@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 59813A43; Mon, 25 Feb 2013 21:59:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1PLxCtf037452; Mon, 25 Feb 2013 21:59:12 GMT (envelope-from beech@svn.freebsd.org) Received: (from beech@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1PLxCrA037451; Mon, 25 Feb 2013 21:59:12 GMT (envelope-from beech@svn.freebsd.org) Message-Id: <201302252159.r1PLxCrA037451@svn.freebsd.org> From: Beech Rintoul Date: Mon, 25 Feb 2013 21:59:12 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r312942 - head/dns/nsd/files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Feb 2013 21:59:12 -0000 Author: beech Date: Mon Feb 25 21:59:11 2013 New Revision: 312942 URL: http://svnweb.freebsd.org/changeset/ports/312942 Log: - Add multi-instance support PR: ports/176156 Submitted by: Darren Pilgrim Approved by: Jaap Akkerhuis (maintainer) Modified: head/dns/nsd/files/nsd.in (contents, props changed) Modified: head/dns/nsd/files/nsd.in ============================================================================== --- head/dns/nsd/files/nsd.in Mon Feb 25 21:21:37 2013 (r312941) +++ head/dns/nsd/files/nsd.in Mon Feb 25 21:59:11 2013 (r312942) @@ -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"