Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Sep 2015 23:09:32 +0000 (UTC)
From:      =?UTF-8?Q?Dag-Erling_Sm=c3=b8rgrav?= <des@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r287880 - head/usr.sbin/unbound/local-setup
Message-ID:  <201509162309.t8GN9Wsw044820@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: des
Date: Wed Sep 16 23:09:31 2015
New Revision: 287880
URL: https://svnweb.freebsd.org/changeset/base/287880

Log:
  If forwarders were specified on the command line, create an empty
  resolvconf.conf so that resolvconf won't replace the manually configured
  forwarders with dynamically configured ones the next time the lease is
  renewed.

Modified:
  head/usr.sbin/unbound/local-setup/local-unbound-setup.sh

Modified: head/usr.sbin/unbound/local-setup/local-unbound-setup.sh
==============================================================================
--- head/usr.sbin/unbound/local-setup/local-unbound-setup.sh	Wed Sep 16 23:01:16 2015	(r287879)
+++ head/usr.sbin/unbound/local-setup/local-unbound-setup.sh	Wed Sep 16 23:09:31 2015	(r287880)
@@ -172,13 +172,18 @@ do_not_edit() {
 # the libc resolver will try unbound first.
 #
 gen_resolvconf_conf() {
+	local style="$1"
 	do_not_edit
 	echo "resolv_conf=\"/dev/null\" # prevent updating ${resolv_conf}"
-	echo "unbound_conf=\"${forward_conf}\""
-	echo "unbound_pid=\"${pidfile}\""
-	echo "unbound_service=\"${service}\""
-	# resolvconf(8) likes to restart rather than reload
-	echo "unbound_restart=\"service ${service} reload\""
+	if [ "${style}" = "dynamic" ] ; then
+		echo "unbound_conf=\"${forward_conf}\""
+		echo "unbound_pid=\"${pidfile}\""
+		echo "unbound_service=\"${service}\""
+		# resolvconf(8) likes to restart rather than reload
+		echo "unbound_restart=\"service ${service} reload\""
+	else
+		echo "# Static DNS configuration"
+	fi
 }
 
 #
@@ -379,6 +384,9 @@ main() {
 	if [ -z "$forwarders" ] ; then
 		echo "Extracting forwarders from ${resolv_conf}."
 		forwarders=$(get_nameservers <"${resolv_conf}")
+		style=dynamic
+	else
+		style=static
 	fi
 
 	#
@@ -440,7 +448,7 @@ main() {
 	# instead of resolv.conf.
 	#
 	local tmp_resolvconf_conf=$(mktemp -u "${resolvconf_conf}.XXXXX")
-	gen_resolvconf_conf | unexpand >"${tmp_resolvconf_conf}"
+	gen_resolvconf_conf "${style}" | unexpand >"${tmp_resolvconf_conf}"
 	replace "${resolvconf_conf}" "${tmp_resolvconf_conf}"
 
 	#



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