misc/185163: [UPDATE] dns/knot: update to 1.3.4 and many fixes

Mark Felder feld at FreeBSD.org
Tue Dec 24 16:10:02 UTC 2013


>Number:         185163
>Category:       misc
>Synopsis:       [UPDATE] dns/knot: update to 1.3.4 and many fixes
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Dec 24 16:10:01 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Mark Felder
>Release:        
>Organization:
>Environment:
>Description:
- update knot to 1.3.4
- rc script wasn't working at all
- rc script has many improvements, including checking config before starting
- fix rc script to pass Clint
- rename rc script "knotd" to "knot"; it should match PROVIDES and be consistent -- knot_enable="YES", service knot, /usr/local/etc/rc.d/knot, etc
- add a knot user/group to run under, UID/GID of 553
- build with rundir and datadir defined to /var/run/knot and /var/db/knot
- don't let knot install datadir and rundir itself; our rc script does this for us
- fix comparison syntax in pkg-plist for knot.conf and knot.sample.conf


now knot is ready to be used in production.


Thanks!
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

Index: UIDs
===================================================================
--- UIDs	(revision 335567)
+++ UIDs	(working copy)
@@ -179,6 +179,7 @@
 redis:*:535:535::0:0:Redis Daemon:/nonexistent:/usr/sbin/nologin
 _flowd:*:542:542::0:0:flowd privilege separation user:/var/empty:/usr/sbin/nologin
 ejabberd:*:543:543::0:0:ejabberd pseudo user:/var/spool/ejabberd:/bin/sh
+knot:*:553:553::0:0:Knot DNS:/nonexistent:/usr/sbin/nologin
 qtss:*:554:554::0:0:Darwin Streaming Server:/nonexistent:/usr/sbin/nologin
 ircdru:*:555:555::0:0:Russian hybrid IRC server:/nonexistent:/bin/sh
 messagebus:*:556:556::0:0:D-BUS Daemon User:/nonexistent:/usr/sbin/nologin
Index: GIDs
===================================================================
--- GIDs	(revision 335567)
+++ GIDs	(working copy)
@@ -171,6 +171,7 @@
 redis:*:535:
 _flowd:*:542:
 ejabberd:*:543:
+knot:*:553:
 qtss:*:554:
 ircdru:*:555:
 messagebus:*:556:
Index: dns/knot/Makefile
===================================================================
--- dns/knot/Makefile	(revision 335567)
+++ dns/knot/Makefile	(working copy)
@@ -2,7 +2,7 @@
 # $FreeBSD$
 
 PORTNAME=	knot
-DISTVERSION=	1.3.3
+DISTVERSION=	1.3.4
 CATEGORIES=	dns ipv6
 MASTER_SITES=	https://secure.nic.cz/files/knot-dns/ \
 		http://dns-lab.com/downloads/knot-dns/
@@ -22,20 +22,26 @@
 USE_OPENSSL=	yes
 GNU_CONFIGURE=	yes
 
+CONFIGURE_ARGS+=--with-storage=/var/db/knot
+CONFIGURE_ARGS+=--with-rundir=/var/run/knot
+
 SUB_FILES=	pkg-message
 
-USE_RC_SUBR=	${PORTNAME}d
+USE_RC_SUBR=	${PORTNAME}
 
 INFO=		knot
 
 PORTDOCS=	AUTHORS COPYING ChangeLog INSTALL NEWS README THANKS
 
-OPTIONS_DEFINE=	DOCS
+USERS=	knot
+GROUPS=	knot
 
+SUB_LIST+=	USERS="${USERS}" GROUPS="${GROUPS}"
+
 post-install:
-	@${MKDIR} ${STAGEDIR}${ETCDIR}
+	${MKDIR} ${STAGEDIR}${ETCDIR}
 	${INSTALL_DATA} ${WRKSRC}/samples/knot.sample.conf ${STAGEDIR}${ETCDIR}
-	@${MKDIR} ${STAGEDIR}${DOCSDIR}
+	${MKDIR} ${STAGEDIR}${DOCSDIR}
 	${INSTALL_DATA} ${PORTDOCS:S,^,${WRKSRC}/,} ${STAGEDIR}${DOCSDIR}/
 
 .include <bsd.port.mk>
Index: dns/knot/distinfo
===================================================================
--- dns/knot/distinfo	(revision 335567)
+++ dns/knot/distinfo	(working copy)
@@ -1,2 +1,2 @@
-SHA256 (knot-1.3.3.tar.gz) = 70f5237871a92cd8a777c73b80b6ac339212ea084d4adfaf314388be704027b4
-SIZE (knot-1.3.3.tar.gz) = 1148233
+SHA256 (knot-1.3.4.tar.gz) = 0e15fb93de9eb2b8cb5d25c2239566462858125cb1b8455fc744835589212399
+SIZE (knot-1.3.4.tar.gz) = 1208147
Index: dns/knot/files/knot.in
===================================================================
--- dns/knot/files/knot.in	(revision 335567)
+++ dns/knot/files/knot.in	(working copy)
@@ -18,33 +18,39 @@
 name=knot
 rcvar=knot_enable
 
-extra_commands="reload"
-reload_cmd="${name}_reload"
-status_cmd="${name}_status"
-stop_cmd="${name}_stop"
-
 load_rc_config ${name}
 
-: ${knot_enable:="NO"}
+: ${knot_enable:=NO}
 : ${knot_config="%%PREFIX%%/etc/knot/knot.conf"}
 
-command=%%PREFIX%%/sbin/${name}c
-procname=%%PREFIX%%/sbin/${name}d
-pidfile=/var/run/${name}.pid
+command=%%PREFIX%%/sbin/knotd
+command_args="-c ${knot_config} -d"
+control=%%PREFIX%%/sbin/knotc
+pidfile=/var/run/knot/knot.pid
 
-command_args="-c ${knot_config} -w start"
 required_files=${knot_config}
 
-knot_reload() {
+extra_commands=reload
+reload_cmd="${name}_reload"
+start_precmd="${name}_prestart"
+
+knot_prestart()
+{
+	if [ ! -d /var/run/knot ]; then
+		install -d -o %%USERS%% -g %%GROUPS%% /var/run/knot
+	fi
+	
+	if [ ! -d /var/db/knot ]; then
+		install -d -o %%USERS%% -g %%GROUPS%% /var/db/knot
+	fi
+
+	${control} -c ${knot_config} checkconf
+}
+
+knot_reload()
+{
 	echo "Reloading ${name}."
-	${command} -c ${knot_config} reload
-	}
-knot_status() {
-	${command} -c ${knot_config} status
-	}
-knot_stop() {
-	echo "Stopping ${name}."
-	${command} -c ${knot_config} stop
-	}
+	${control} -c ${knot_config} reload
+}
 
 run_rc_command "$1"
Index: dns/knot/files/knotd.in
===================================================================
--- dns/knot/files/knotd.in	(revision 335567)
+++ dns/knot/files/knotd.in	(working copy)
@@ -1,50 +0,0 @@
-#!/bin/sh
-#
-# $FreeBSD$
-#
-# PROVIDE: knot
-# REQUIRE: SERVERS cleanvar
-# KEYWORD: shutdown
-#
-# Add the following lines to /etc/rc.conf to enable knot:
-#
-# knot_enable="YES":	Set to NO by default.
-#			Set it to YES to enable knot.
-# knot_config="":	Set to %%PREFIX%%/etc/knot/knot.conf
-#			by default.
-
-. /etc/rc.subr
-
-name=knot
-rcvar=knot_enable
-
-extra_commands="reload"
-reload_cmd="${name}_reload"
-status_cmd="${name}_status"
-stop_cmd="${name}_stop"
-
-load_rc_config ${name}
-
-: ${knot_enable:="NO"}
-: ${knot_config="%%PREFIX%%/etc/knot/knot.conf"}
-
-command=%%PREFIX%%/sbin/${name}c
-procname=%%PREFIX%%/sbin/${name}d
-pidfile=/var/run/${name}.pid
-
-command_args="-c ${knot_config} -w start"
-required_files=${knot_config}
-
-knot_reload() {
-	echo "Reloading ${name}."
-	${command} -c ${knot_config} reload
-	}
-knot_status() {
-	${command} -c ${knot_config} status
-	}
-knot_stop() {
-	echo "Stopping ${name}."
-	${command} -c ${knot_config} stop
-	}
-
-run_rc_command "$1"
Index: dns/knot/files/patch-src-Makefile.in
===================================================================
--- dns/knot/files/patch-src-Makefile.in	(revision 0)
+++ dns/knot/files/patch-src-Makefile.in	(working copy)
@@ -0,0 +1,11 @@
+--- src/Makefile.in.orig	2013-12-24 09:39:02.671817934 -0600
++++ src/Makefile.in	2013-12-24 09:39:11.577816555 -0600
+@@ -1979,8 +1979,6 @@
+ # Create storage and run-time directories
+ install-data-hook:
+ 	$(INSTALL) -d $(DESTDIR)/@config_dir@
+-	$(INSTALL) -d $(DESTDIR)/@run_dir@
+-	$(INSTALL) -d $(DESTDIR)/@storage_dir@
+ 
+ # Tell versions [3.59,3.63) of GNU make to not export all variables.
+ # Otherwise a system limit (for SysV at least) may be exceeded.

Property changes on: dns/knot/files/patch-src-Makefile.in
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: fbsd:nokeywords
## -0,0 +1 ##
+yes
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: dns/knot/files/pkg-message.in
===================================================================
--- dns/knot/files/pkg-message.in	(revision 335567)
+++ dns/knot/files/pkg-message.in	(working copy)
@@ -17,7 +17,7 @@
 #
 # ----- startup ----------------------------------------------------
 #
-  %%PREFIX%%/etc/rc.d/knotd start
+  %%PREFIX%%/etc/rc.d/knot start
 #
 ####################################################################
 
Index: dns/knot/pkg-plist
===================================================================
--- dns/knot/pkg-plist	(revision 335567)
+++ dns/knot/pkg-plist	(working copy)
@@ -1,4 +1,4 @@
- at unexec if cmp -s %B/knot.sample.conf %B/knot.conf; then rm -f %B/knot.conf; fi
+ at unexec if cmp -s %D/%%ETCDIR%%/knot.sample.conf %D/%%ETCDIR%%/knot.conf; then rm -f %D/%%ETCDIR%%/knot.conf; fi
 %%ETCDIR%%/knot.sample.conf
 @exec [ -f %B/knot.conf ] || cp %B/%f %B/knot.conf
 %%ETCDIR%%/example.com.zone
@@ -9,11 +9,6 @@
 man/man8/knotc.8.gz
 man/man8/knotd.8.gz
 @dirrmtry %%ETCDIR%%
- at dirrmtry var/run/knot
- at dirrmtry var/run
- at dirrmtry var/lib/knot
- at dirrmtry var/lib
- at dirrmtry var
 bin/kdig
 bin/khost
 bin/knsupdate


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list