Bug 184159 - dns/bind* rc.d script variable override
Summary: dns/bind* rc.d script variable override
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Erwin Lansing
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-22 03:20 UTC by Pawel Biernacki
Modified: 2013-11-22 13:50 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pawel Biernacki freebsd_committer 2013-11-22 03:20:01 UTC
After removing bind from base the rc.d script was moved to ports. The problem is that it overrides variables from rc.conf.

Fix: 

-named_enable="NO"             # Run named, the DNS server (or NO).
-named_program="/usr/local/sbin/named"  # Path to named, if you want a different one.
-named_conf="/usr/local/etc/namedb/named.conf"  # Path to the configuration file
-#named_flags=""                        # Use this for flags OTHER than -u and -c
-named_uid="bind"               # User to run named as
-named_wait="NO"                        # Wait for working name service before exiting
-named_wait_host="localhost"    # Hostname to check if named_wait is enabled
-named_auto_forward="NO"                # Set up forwarders from /etc/resolv.conf
-named_auto_forward_only="NO"   # Do "forward only" instead of "forward first"
+# defaults
+named_enable=${named_enable:-"NO"}             # Run named, the DNS server (or NO).
+named_program=${named_program:-"/usr/local/sbin/named"}        # Path to named, if you want a different one.
+named_conf=${named_conf:-"/usr/local/etc/namedb/named.conf"}   # Path to the configuration file
+named_flags=${named_flags:-""}                 # Use this for flags OTHER than -u and -c
+named_uid=${named_uid:-"bind"}         # User to run named as
+named_wait=${named_wait:-"NO"}                 # Wait for working name service before exiting
+named_wait_host=${named_wait_host:-"localhost"}        # Hostname to check if named_wait is enabled
+named_auto_forward=${named_auto_forward:-"NO"}         # Set up forwarders from /etc/resolv.conf
+named_auto_forward_only=${named_auto_forward_only:-"NO"}       # Do "forward only" instead of "forward first"

 named_poststart() {
        if checkyesno named_wait; then--VX8jAN7aAmogDsCdgtpamObhRrsDxOnyuctIhztkkIWqj3TF
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

--- named.orig  2013-11-22 02:34:38.587664008 +0000
+++ named       2013-11-22 02:46:13.550134631 +0000
@@ -19,15 +19,16 @@
 reload_cmd="named_reload"
 stop_cmd="named_stop"
How-To-Repeat: I installed bind from ports, add enable_named="YES" to /etc/rc.conf and did a reboot. During my tests with rc_debug="YES" I discovered:
/etc/rc: DEBUG: checkyesno: named_enable is set to NO.
and in effect named was not started.
Attached patch fixes the problem.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2013-11-22 05:30:15 UTC
Responsible Changed
From-To: freebsd-ports-bugs->erwin

Over to maintainer.
Comment 2 dfilter service freebsd_committer 2013-11-22 13:41:43 UTC
Author: erwin
Date: Fri Nov 22 13:41:34 2013
New Revision: 334593
URL: http://svnweb.freebsd.org/changeset/ports/334593

Log:
  Fix startup script.
  
  PR:		184159 [1]
  Submitted by:	Pawel Biernacki <pawel.biernacki@gmail.com> [1],
  		Trond Endrestoel <Trond.Endrestol@ximalas.info> (private email)

Modified:
  head/dns/bind96/Makefile
  head/dns/bind96/files/named
  head/dns/bind98/Makefile
  head/dns/bind98/files/named
  head/dns/bind99/Makefile
  head/dns/bind99/files/named

Modified: head/dns/bind96/Makefile
==============================================================================
--- head/dns/bind96/Makefile	Fri Nov 22 13:34:33 2013	(r334592)
+++ head/dns/bind96/Makefile	Fri Nov 22 13:41:34 2013	(r334593)
@@ -2,6 +2,7 @@
 
 PORTNAME=	bind96
 PORTVERSION=	9.6.3.2.ESV.R10
+PORTREVISION=	1
 CATEGORIES=	dns net ipv6
 MASTER_SITES=	${MASTER_SITE_ISC}
 MASTER_SITE_SUBDIR=	bind9/${ISCVERSION}

Modified: head/dns/bind96/files/named
==============================================================================
--- head/dns/bind96/files/named	Fri Nov 22 13:34:33 2013	(r334592)
+++ head/dns/bind96/files/named	Fri Nov 22 13:41:34 2013	(r334593)
@@ -19,15 +19,15 @@ start_postcmd="named_poststart"
 reload_cmd="named_reload"
 stop_cmd="named_stop"
 
-named_enable="NO"		# Run named, the DNS server (or NO).
-named_program="/usr/local/sbin/named"	# Path to named, if you want a different one.
-named_conf="/usr/local/etc/namedb/named.conf"	# Path to the configuration file
-#named_flags=""			# Use this for flags OTHER than -u and -c
-named_uid="bind"		# User to run named as
-named_wait="NO"			# Wait for working name service before exiting
-named_wait_host="localhost"	# Hostname to check if named_wait is enabled
-named_auto_forward="NO"		# Set up forwarders from /etc/resolv.conf
-named_auto_forward_only="NO"	# Do "forward only" instead of "forward first"
+named_enable=${named_enable:-"NO"}		# Run named, the DNS server (or NO).
+named_program=${named_program:-"/usr/local/sbin/named"}		# Path to named, if you want a different one.
+named_conf=${named_conf:-"/usr/local/etc/namedb/named.conf"}	# Path to the configuration file
+named_flags=${named_flags:-""}			# Use this for flags OTHER than -u and -c
+named_uid=${named_uid:-"bind"}			# User to run named as
+named_wait=${named_wait:-"NO"}			# Wait for working name service before exiting
+named_wait_host=${named_wait_host:-"localhost"}	# Hostname to check if named_wait is enabled
+named_auto_forward=${named_auto_forward:-"NO"}	# Set up forwarders from /etc/resolv.conf
+named_auto_forward_only=${named_auto_forward_only:-"NO"}	# Do "forward only" instead of "forward first"
 
 named_poststart() {
 	if checkyesno named_wait; then

Modified: head/dns/bind98/Makefile
==============================================================================
--- head/dns/bind98/Makefile	Fri Nov 22 13:34:33 2013	(r334592)
+++ head/dns/bind98/Makefile	Fri Nov 22 13:41:34 2013	(r334593)
@@ -2,6 +2,7 @@
 
 PORTNAME=	bind98
 PORTVERSION=	9.8.6
+PORTREVISION=	1
 CATEGORIES=	dns net ipv6
 MASTER_SITES=	${MASTER_SITE_ISC}
 MASTER_SITE_SUBDIR=	bind9/${ISCVERSION}

Modified: head/dns/bind98/files/named
==============================================================================
--- head/dns/bind98/files/named	Fri Nov 22 13:34:33 2013	(r334592)
+++ head/dns/bind98/files/named	Fri Nov 22 13:41:34 2013	(r334593)
@@ -19,15 +19,15 @@ start_postcmd="named_poststart"
 reload_cmd="named_reload"
 stop_cmd="named_stop"
 
-named_enable="NO"		# Run named, the DNS server (or NO).
-named_program="%%PREFIX%%/sbin/named"	# Path to named, if you want a different one.
-named_conf="%%BIND_DESTETC%%/named.conf"	# Path to the configuration file
-#named_flags=""			# Use this for flags OTHER than -u and -c
-named_uid="bind"		# User to run named as
-named_wait="NO"			# Wait for working name service before exiting
-named_wait_host="localhost"	# Hostname to check if named_wait is enabled
-named_auto_forward="NO"		# Set up forwarders from /etc/resolv.conf
-named_auto_forward_only="NO"	# Do "forward only" instead of "forward first"
+named_enable=${named_enable:-"NO"}		# Run named, the DNS server (or NO).
+named_program=${named_program:-"/usr/local/sbin/named"}		# Path to named, if you want a different one.
+named_conf=${named_conf:-"/usr/local/etc/namedb/named.conf"}	# Path to the configuration file
+named_flags=${named_flags:-""}			# Use this for flags OTHER than -u and -c
+named_uid=${named_uid:-"bind"}			# User to run named as
+named_wait=${named_wait:-"NO"}			# Wait for working name service before exiting
+named_wait_host=${named_wait_host:-"localhost"}	# Hostname to check if named_wait is enabled
+named_auto_forward=${named_auto_forward:-"NO"}	# Set up forwarders from /etc/resolv.conf
+named_auto_forward_only=${named_auto_forward_only:-"NO"}	# Do "forward only" instead of "forward first"
 
 named_poststart() {
 	if checkyesno named_wait; then

Modified: head/dns/bind99/Makefile
==============================================================================
--- head/dns/bind99/Makefile	Fri Nov 22 13:34:33 2013	(r334592)
+++ head/dns/bind99/Makefile	Fri Nov 22 13:41:34 2013	(r334593)
@@ -2,7 +2,7 @@
 
 PORTNAME?=	bind99
 PORTVERSION=	9.9.4
-PORTREVISION?=	0
+PORTREVISION?=	1
 CATEGORIES=	dns net ipv6
 MASTER_SITES=	${MASTER_SITE_ISC}
 MASTER_SITE_SUBDIR=	bind9/${ISCVERSION}

Modified: head/dns/bind99/files/named
==============================================================================
--- head/dns/bind99/files/named	Fri Nov 22 13:34:33 2013	(r334592)
+++ head/dns/bind99/files/named	Fri Nov 22 13:41:34 2013	(r334593)
@@ -19,15 +19,15 @@ start_postcmd="named_poststart"
 reload_cmd="named_reload"
 stop_cmd="named_stop"
 
-named_enable="NO"		# Run named, the DNS server (or NO).
-named_program="%%PREFIX%%/sbin/named"	# Path to named, if you want a different one.
-named_conf="%%BIND_DESTETC%%/named.conf"	# Path to the configuration file
-#named_flags=""			# Use this for flags OTHER than -u and -c
-named_uid="bind"		# User to run named as
-named_wait="NO"			# Wait for working name service before exiting
-named_wait_host="localhost"	# Hostname to check if named_wait is enabled
-named_auto_forward="NO"		# Set up forwarders from /etc/resolv.conf
-named_auto_forward_only="NO"	# Do "forward only" instead of "forward first"
+named_enable=${named_enable:-"NO"}		# Run named, the DNS server (or NO).
+named_program=${named_program:-"/usr/local/sbin/named"}		# Path to named, if you want a different one.
+named_conf=${named_conf:-"/usr/local/etc/namedb/named.conf"}	# Path to the configuration file
+named_flags=${named_flags:-""}			# Use this for flags OTHER than -u and -c
+named_uid=${named_uid:-"bind"}			# User to run named as
+named_wait=${named_wait:-"NO"}			# Wait for working name service before exiting
+named_wait_host=${named_wait_host:-"localhost"}	# Hostname to check if named_wait is enabled
+named_auto_forward=${named_auto_forward:-"NO"}	# Set up forwarders from /etc/resolv.conf
+named_auto_forward_only=${named_auto_forward_only:-"NO"}	# Do "forward only" instead of "forward first"
 
 named_poststart() {
 	if checkyesno named_wait; then
@@ -92,6 +92,12 @@ named_prestart()
 		warn 'named_pidfile: now determined from the conf file'
 	fi
 
+	echo ${pidfile%/pid}
+	if [ ! -d ${pidfile%/pid} ]; then
+		mkdir -p ${pidfile%/pid}
+		chown ${named_uid}:${named_uid} ${pidfile%/pid}
+	fi
+
 	command_args="-u ${named_uid:=root}"
 
 	if [ ! "$named_conf" = '/etc/namedb/named.conf' ]; then
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 3 Erwin Lansing freebsd_committer 2013-11-22 13:42:06 UTC
State Changed
From-To: open->closed

Committed, thanks!