From owner-svn-ports-head@freebsd.org Thu Feb 11 02:40:58 2016 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EB718AA46C7; Thu, 11 Feb 2016 02:40:58 +0000 (UTC) (envelope-from pi@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C2649157C; Thu, 11 Feb 2016 02:40:58 +0000 (UTC) (envelope-from pi@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u1B2evRv087826; Thu, 11 Feb 2016 02:40:57 GMT (envelope-from pi@FreeBSD.org) Received: (from pi@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u1B2evPT087824; Thu, 11 Feb 2016 02:40:57 GMT (envelope-from pi@FreeBSD.org) Message-Id: <201602110240.u1B2evPT087824@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pi set sender to pi@FreeBSD.org using -f From: Kurt Jaeger Date: Thu, 11 Feb 2016 02:40:57 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r408674 - in head/dns/knot2: . 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.20 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: Thu, 11 Feb 2016 02:40:59 -0000 Author: pi Date: Thu Feb 11 02:40:57 2016 New Revision: 408674 URL: https://svnweb.freebsd.org/changeset/ports/408674 Log: dns/knot2: enable multiple instances in rc.d script PR: 203931 Submitted by: Chad J. Milios Approved by: Leo Vandewoestijne (maintainer) Modified: head/dns/knot2/Makefile head/dns/knot2/files/knot.in Modified: head/dns/knot2/Makefile ============================================================================== --- head/dns/knot2/Makefile Thu Feb 11 01:33:06 2016 (r408673) +++ head/dns/knot2/Makefile Thu Feb 11 02:40:57 2016 (r408674) @@ -3,7 +3,7 @@ PORTNAME= knot DISTVERSION= 2.0.2 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= dns ipv6 MASTER_SITES= https://secure.nic.cz/files/knot-dns/ \ http://dns-lab.com/downloads/knot-dns/ Modified: head/dns/knot2/files/knot.in ============================================================================== --- head/dns/knot2/files/knot.in Thu Feb 11 01:33:06 2016 (r408673) +++ head/dns/knot2/files/knot.in Thu Feb 11 02:40:57 2016 (r408674) @@ -12,43 +12,91 @@ # Set it to YES to enable knot. # knot_config="": Set to %%PREFIX%%/etc/knot/knot.conf # by default. +# +# ----------------------------------------------------------------------------- +# +# This script supports running multiple instances of knot. +# To run additional instances link this script to something like +# % ln -s knot knot_foo +# and define additional knot_foo_* variables in one of +# /etc/rc.conf, /etc/rc.conf.local or /etc/rc.conf.d/knot_foo +# +# Below NAME should be substituted with the name of this script. By default +# it is knot, so read as knot_enable. If you linked the script to +# knot_foo, then read as knot_foo_enable etc. +# +# The following variables are supported (defaults are shown). +# You can place them in any of +# /etc/rc.conf, /etc/rc.conf.local or /etc/rc.conf.d/NAME +# +# NAME_enable="NO" # set to YES to enable knot +# +# # optional: +# NAME_config="%%PREFIX%%/etc/knot/NAME.conf" # (-c)onfig file +# NAME_diruser="%%USERS%%" # /var/db/NAME and /var/run/NAME are created if they +# NAME_dirgroup="%%GROUPS%%" # don't exist. These don't control the user/group knot +# # runs as, the config file has a setting for that. +# +# You also need to set the rundir directive in the server section of the +# config file to /var/run/NAME (if using a NAME other than the default) +# and you will want the storage directive(s) declared in the zone section +# to point to /var/db/NAME overriding the default of /var/db/knot. +# +# For further documentation, please see knot.conf(5). . /etc/rc.subr -name=knot -rcvar=knot_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 + +name="${name##*/}" +rcvar=${name}_enable load_rc_config ${name} -: ${knot_enable:=NO} -: ${knot_config="%%PREFIX%%/etc/knot/knot.conf"} +eval ": \${${name}_enable:=\"NO\"}" +eval ": \${${name}_diruser:=\"%%USERS%%\"}" +eval ": \${${name}_dirgroup:=\"%%GROUPS%%\"}" +eval ": \${${name}_config:=\"%%PREFIX%%/etc/knot/${name}.conf\"}" + +configfile="$(eval echo \${${name}_config})" +diruser="$(eval echo \${${name}_diruser})" +dirgroup="$(eval echo \${${name}_dirgroup})" command=%%PREFIX%%/sbin/knotd -command_args="-c ${knot_config} -d" +command_args="-c ${configfile} -d" control=%%PREFIX%%/sbin/knotc -pidfile=/var/run/knot/knot.pid +pidfile=/var/run/${name}/knot.pid -required_files=${knot_config} +required_files=${configfile} extra_commands=reload -reload_cmd="${name}_reload" -start_precmd="${name}_prestart" +reload_cmd="knot_reload" +start_precmd="knot_prestart" knot_prestart() { - if [ ! -d /var/run/knot ]; then - install -d -o %%USERS%% -g %%GROUPS%% /var/run/knot + if [ ! -d /var/run/${name} ]; then + install -d -o ${diruser} -g ${dirgroup} /var/run/${name} fi - if [ ! -d /var/db/knot ]; then - install -d -o %%USERS%% -g %%GROUPS%% /var/db/knot + if [ ! -d /var/db/${name} ]; then + install -d -o ${diruser} -g ${dirgroup} /var/db/${name} fi - ${control} -c ${knot_config} checkconf + ${control} -c ${configfile} checkconf } knot_reload() { echo "Reloading ${name}." - ${control} -c ${knot_config} reload + ${control} -c ${configfile} reload } run_rc_command "$1"