Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Sep 2019 16:31:02 +0000 (UTC)
From:      Steve Wills <swills@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r510824 - in head/dns/unbound: . files
Message-ID:  <201909021631.x82GV2Aq073972@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: swills
Date: Mon Sep  2 16:31:02 2019
New Revision: 510824
URL: https://svnweb.freebsd.org/changeset/ports/510824

Log:
  dns/unbound: update to 1.9.3
  
  Whil here, improve rc script
  
  PR:		240163
  Submitted by:	Jaap Akkerhuis <jaap@NLnetLabs.nl> (maintainer)

Modified:
  head/dns/unbound/Makefile   (contents, props changed)
  head/dns/unbound/distinfo   (contents, props changed)
  head/dns/unbound/files/unbound.in
  head/dns/unbound/pkg-plist   (contents, props changed)

Modified: head/dns/unbound/Makefile
==============================================================================
--- head/dns/unbound/Makefile	Mon Sep  2 16:28:20 2019	(r510823)
+++ head/dns/unbound/Makefile	Mon Sep  2 16:31:02 2019	(r510824)
@@ -2,8 +2,7 @@
 # $FreeBSD$
 
 PORTNAME=	unbound
-PORTVERSION=	1.9.2
-PORTREVISION=	1
+PORTVERSION=	1.9.3
 CATEGORIES=	dns
 MASTER_SITES=	https://www.nlnetlabs.nl/downloads/unbound/ \
 		https://distfiles.crux.guru/

Modified: head/dns/unbound/distinfo
==============================================================================
--- head/dns/unbound/distinfo	Mon Sep  2 16:28:20 2019	(r510823)
+++ head/dns/unbound/distinfo	Mon Sep  2 16:31:02 2019	(r510824)
@@ -1,3 +1,3 @@
-TIMESTAMP = 1560919473
-SHA256 (unbound-1.9.2.tar.gz) = 6f7acec5cf451277fcda31729886ae7dd62537c4f506855603e3aa153fcb6b95
-SIZE (unbound-1.9.2.tar.gz) = 5676395
+TIMESTAMP = 1566901338
+SHA256 (unbound-1.9.3.tar.gz) = 1b55dd9170e4bfb327fb644de7bbf7f0541701149dff3adf1b63ffa785f16dfa
+SIZE (unbound-1.9.3.tar.gz) = 5686017

Modified: head/dns/unbound/files/unbound.in
==============================================================================
--- head/dns/unbound/files/unbound.in	Mon Sep  2 16:28:20 2019	(r510823)
+++ head/dns/unbound/files/unbound.in	Mon Sep  2 16:31:02 2019	(r510824)
@@ -2,41 +2,64 @@
 #
 # $FreeBSD$
 #
-# unbound freebsd startup rc.d script, modified from the named script.
+# unbound freebsd startup rc.d script
 # uses the default unbound installation path and pidfile location.
-# copy this to /etc/rc.d/unbound
+# copy this to %%PREFIX%%/etc/rc.d/unbound
 # and put unbound_enable="YES" into rc.conf
 #
 # unbound_anchorflags can be used to allow you to pass a custom flags to
 # unbound-anchor.  Examples include a custom resolv.conf (-f) or a custom
 # root.hints (-r).  Useful for when /etc/resolv.conf only contains 127.0.0.1
-
+#
 # PROVIDE: unbound
 # REQUIRE: SERVERS cleanvar
 # KEYWORD: shutdown
+#
+# Add the following line to /etc/rc.conf to enable unbound:
+#
+# unbound_enable="YES"
+#
+# You could set alternative config with
+# unbound_config="/path/to/config"
+#
+#
+# Multiple profiles are supported with
+#
+# unbound_profiles="name1 name2"
+# unbound_name1_enable="YES"
+# unbound_name1_config="/path/to/config1"
+# unbound_name2_enable="YES"
+# unbound_name2_config="/path/to/config2"
+#
+# A fib can be set for each profile as in
+# unbound_name1_fib=1
+#
 
 . /etc/rc.subr
 
-name="unbound"
+name=unbound
 rcvar=unbound_enable
 
-command="%%PREFIX%%/sbin/unbound"
-extra_commands="reload"
-start_precmd="start_precmd"
+# setfib
+unbound_startfib() {
+	${SYSCTL} net.fibs  >/dev/null 2>&1 || return 0
 
-load_rc_config $name
+	unbound_fib=${unbound_fib:-"NONE"}
+	case "$unbound_fib" in
+	[Nn][Oo][Nn][Ee])
+		;;
+	*)
+		echo "Using fib #: " $unbound_fib .
+		command="setfib -F ${unbound_fib} ${command}"
+			;;
+	esac
+}
 
-pidfile=`%%PREFIX%%/sbin/unbound-checkconf -o pidfile ${unbound_conf}`
-unbound_enable=${unbound_enable:-"NO"}
-unbound_anchorflags=${unbound_anchorflags:-""}
-unbound_conf=${unbound_conf:-"%%ETCDIR%%/unbound.conf"}
-unbound_flags=${unbound_flags:-" -c ${unbound_conf}"}
-
-reload_precmd="%%PREFIX%%/sbin/unbound-checkconf ${unbound_conf} >/dev/null"
-
 start_precmd()
 {
-	echo -n "Obtaining a trust anchor:"
+	unbound_startfib
+
+	echo -n "Obtaining a trust anchor.."
 	if [ "${unbound_anchorflags}T" = "T" ]; then
 		su -m unbound -c %%PREFIX%%/sbin/unbound-anchor
 	else
@@ -46,5 +69,84 @@ start_precmd()
 	%%PREFIX%%/sbin/unbound-checkconf ${unbound_conf} > /dev/null
 	return $?
 }
+
+# read settings, set default values
+load_rc_config "${name}"
+: ${unbound_enable:="NO"}
+: ${unbound_config:=%%PREFIX%%/etc/unbound/unbound.conf}
+
+# Set PID file
+pidfile=$(%%PREFIX%%/sbin/unbound-checkconf -o pidfile %%PREFIX%%/etc/unbound/unbound.conf)
+
+required_files=${unbound_config}
+command="%%PREFIX%%/sbin/${name}"
+command_args="-c ${unbound_config}"
+unbound_anchorflags=${unbound_anchorflags:-""}
+extra_commands="reload"
+start_precmd="start_precmd"
+reload_precmd="%%PREFIX%%/sbin/unbound-checkconf ${unbound_conf} >/dev/null"
+
+load_rc_config "${name}"
+
+if [ -n "$2" ]; then
+	profile="$2"
+	if [ "x${unbound_profiles}" != "x" ]; then
+		eval unbound_config="\${unbound_${profile}_config:-%%PREFIX%%/etc/unbound/unbound-${profile}.conf}"
+		eval unbound_fib="\${unbound_${profile}_fib:-${unbound_fib}}"
+		if [ "x${unbound_config}" = "x" ]; then
+			echo "You must define a configuration file (unbound_${profile}_config)"
+			exit 1
+		fi
+
+		# Replace default value with profile-based (defined in the config file)
+		_cfgpidfile=$(%%PREFIX%%/sbin/unbound-checkconf -o pidfile ${unbound_config})
+		_defaultpidfile=$(%%PREFIX%%/sbin/unbound-checkconf -o pidfile /dev/null)
+
+		if [ "x${_cfgpidfile}" = "x" -o "x${_cfgpidfile}" = "x${_defaultpidfile}" ] ; then
+			pidfile=${_defaultpidfile}
+		else
+			pidfile=${_cfgpidfile}
+		fi
+		required_files="${unbound_config}"
+		eval unbound_enable="\${unbound_${profile}_enable:-${unbound_enable}}"
+		command_args="-c ${unbound_config}"
+	else
+		echo "$0: extra argument ignored"
+	fi
+else
+	if [ "x${unbound_profiles}" != "x" -a "x$1" != "x" ]; then
+		for profile in ${unbound_profiles}; do
+			eval _enable="\${unbound_${profile}_enable}"
+			case "x${_enable:-${unbound_enable}}" in
+			x|x[Nn][Oo]|x[Nn][Oo][Nn][Ee])
+				continue
+				;;
+			x[Yy][Ee][Ss])
+				;;
+			*)
+				if test -z "$_enable"; then
+					_var=unbound_enable
+				else
+					_var=unbound_"${profile}"_enable
+				fi
+				echo "Bad value" \
+				    "'${_enable:-${unbound_enable}}'" \
+				    "for ${_var}. " \
+				    "Profile ${profile} skipped."
+				continue
+				;;
+			esac
+			echo "===> unbound profile: ${profile}"
+			%%PREFIX%%/etc/rc.d/unbound $1 ${profile}
+			retcode="$?"
+			if [ "0${retcode}" -ne 0 ]; then
+				failed="${profile} (${retcode}) ${failed:-}"
+			else
+				success="${profile} ${success:-}"
+			fi
+		done
+		exit 0
+	fi
+fi
 
 run_rc_command "$1"

Modified: head/dns/unbound/pkg-plist
==============================================================================
--- head/dns/unbound/pkg-plist	Mon Sep  2 16:28:20 2019	(r510823)
+++ head/dns/unbound/pkg-plist	Mon Sep  2 16:31:02 2019	(r510824)
@@ -5,7 +5,7 @@ libdata/pkgconfig/libunbound.pc
 lib/libunbound.a
 lib/libunbound.so
 lib/libunbound.so.8
-lib/libunbound.so.8.1.2
+lib/libunbound.so.8.1.3
 %%PYTHON%%%%PYTHON_SITELIBDIR%%/_unbound.so
 %%PYTHON%%%%PYTHON_SITELIBDIR%%/unbound.py
 %%PYTHON%%%%PYTHON_SITELIBDIR%%/unboundmodule.py



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201909021631.x82GV2Aq073972>