Bug 185163 - [UPDATE] dns/knot: update to 1.3.4 and many fixes
[UPDATE] dns/knot: update to 1.3.4 and many fixes
Status: Closed FIXED
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s)
Latest
Any Any
: Normal Affects Only Me
Assigned To: Mark Felder
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-12-24 16:10 UTC by Mark Felder
Modified: 2014-02-13 13:30 UTC (History)
0 users

See Also:


Attachments
file.diff (7.16 KB, patch)
2013-12-24 16:10 UTC, Mark Felder
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Felder freebsd_committer 2013-12-24 16:10:01 UTC
- 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!

Fix: Patch attached with submission follows:
Comment 1 Mark Felder freebsd_committer 2013-12-24 16:36:11 UTC
Responsible Changed
From-To: freebsd-bugs->feld

I'll take it.
Comment 2 dfilter freebsd_committer 2014-02-13 13:26:12 UTC
Author: feld
Date: Thu Feb 13 13:26:03 2014
New Revision: 344100
URL: http://svnweb.freebsd.org/changeset/ports/344100
QAT: https://qat.redports.org/buildarchive/r344100/

Log:
  Update Knot to 1.4.2
  Major improvements to the rc script
  
  PR:		ports/181716
  PR:		ports/185163

Added:
  head/dns/knot/files/knot.in
     - copied, changed from r341444, head/dns/knot/files/knotd.in
Deleted:
  head/dns/knot/files/knotd.in
Modified:
  head/GIDs
  head/UIDs
  head/dns/knot/Makefile
  head/dns/knot/distinfo
  head/dns/knot/files/pkg-message.in
  head/dns/knot/pkg-plist

Modified: head/GIDs
==============================================================================
--- head/GIDs	Thu Feb 13 13:23:05 2014	(r344099)
+++ head/GIDs	Thu Feb 13 13:26:03 2014	(r344100)
@@ -172,6 +172,7 @@ pgbouncer:*:534:
 redis:*:535:
 _flowd:*:542:
 ejabberd:*:543:
+knot:*:553:
 qtss:*:554:
 ircdru:*:555:
 messagebus:*:556:

Modified: head/UIDs
==============================================================================
--- head/UIDs	Thu Feb 13 13:23:05 2014	(r344099)
+++ head/UIDs	Thu Feb 13 13:26:03 2014	(r344100)
@@ -180,6 +180,7 @@ pgbouncer:*:534:534::0:0:Pgbouncer Daemo
 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 Server:/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

Modified: head/dns/knot/Makefile
==============================================================================
--- head/dns/knot/Makefile	Thu Feb 13 13:23:05 2014	(r344099)
+++ head/dns/knot/Makefile	Thu Feb 13 13:26:03 2014	(r344100)
@@ -2,8 +2,7 @@
 # $FreeBSD$
 
 PORTNAME=	knot
-DISTVERSION=	1.3.3
-PORTREVISION=	1
+DISTVERSION=	1.4.2
 CATEGORIES=	dns ipv6
 MASTER_SITES=	https://secure.nic.cz/files/knot-dns/ \
 		http://dns-lab.com/downloads/knot-dns/
@@ -20,27 +19,37 @@ LIB_DEPENDS=	liburcu.so:${PORTSDIR}/sysu
 USE_AUTOTOOLS=	libtool
 
 USE_LDCONFIG=	yes
+
 USE_OPENSSL=	yes
+WITH_OPENSSL_PORT=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-patch:
+	${REINPLACE_CMD} 's|$$(INSTALL) -d $$(DESTDIR)/\@run_dir\@|#$$(INSTALL) -d $$(DESTDIR)/\@run_dir\@|' \
+		${WRKSRC}/src/Makefile.in
+	${REINPLACE_CMD} 's|$$(INSTALL) -d $$(DESTDIR)/\@storage_dir\@|#$$(INSTALL) -d $$(DESTDIR)/\@storage_dir\@|' \
+		${WRKSRC}/src/Makefile.in
 
 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}/
-	@${MKDIR} ${PREFIX}/var/lib/knot
-	@${MKDIR} ${PREFIX}/var/run/knot
-	@${CHOWN} 53:53 ${PREFIX}/var/lib/knot
-	@${CHOWN} 53:53 ${PREFIX}/var/run/knot
 
 .include <bsd.port.mk>

Modified: head/dns/knot/distinfo
==============================================================================
--- head/dns/knot/distinfo	Thu Feb 13 13:23:05 2014	(r344099)
+++ head/dns/knot/distinfo	Thu Feb 13 13:26:03 2014	(r344100)
@@ -1,2 +1,2 @@
-SHA256 (knot-1.3.3.tar.gz) = 70f5237871a92cd8a777c73b80b6ac339212ea084d4adfaf314388be704027b4
-SIZE (knot-1.3.3.tar.gz) = 1148233
+SHA256 (knot-1.4.2.tar.gz) = 9476111662220935a824c1fa53cbd1673440825e40a2c4a9282539ced4af4687
+SIZE (knot-1.4.2.tar.gz) = 1365873

Copied and modified: head/dns/knot/files/knot.in (from r341444, head/dns/knot/files/knotd.in)
==============================================================================
--- head/dns/knot/files/knotd.in	Mon Jan 27 19:31:17 2014	(r341444, copy source)
+++ head/dns/knot/files/knot.in	Thu Feb 13 13:26:03 2014	(r344100)
@@ -10,7 +10,7 @@
 #
 # knot_enable="YES":	Set to NO by default.
 #			Set it to YES to enable knot.
-# knot_config="":	Set to %%PREFIX%%/etc/knot/knot.conf
+# knot_config="":	Set to /usr/local/etc/knot/knot.conf
 #			by default.
 
 . /etc/rc.subr
@@ -18,22 +18,35 @@
 name=knot
 rcvar=knot_enable
 
-extra_commands="reload"
-reload_cmd="${name}_x reload"
-status_cmd="${name}_x status"
-stop_cmd="  ${name}_x stop"
-
 load_rc_config ${name}
 
-: ${knot_enable:="NO"}
+: ${knot_enable:=NO}
 : ${knot_config="%%PREFIX%%/etc/knot/knot.conf"}
 
-command=%%PREFIX%%/sbin/${name}d
+command=%%PREFIX%%/sbin/knotd
 command_args="-c ${knot_config} -d"
+control=%%PREFIX%%/sbin/knotc
+pidfile=/var/run/knot/knot.pid
+
 required_files=${knot_config}
 
-knot_x() {
-	%%PREFIX%%/sbin/${name}c -c ${knot_config} "$1"
+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
+	grep -v '#' ${knot_config} | grep -q -E 'knot.knot;|bind.bind;'
+	if [ $? -ne 0 ]; then
+		echo "Notice: not running as uid.gid knot.knot or bind.bind"
+	fi
+	${control} -c ${knot_config} checkconf
 	}
 
-run_rc_command "$1"
+knot_reload() {
+	echo "Reloading ${name}."

Modified: head/dns/knot/files/pkg-message.in
==============================================================================
--- head/dns/knot/files/pkg-message.in	Thu Feb 13 13:23:05 2014	(r344099)
+++ head/dns/knot/files/pkg-message.in	Thu Feb 13 13:26:03 2014	(r344100)
@@ -1,21 +1,11 @@
-
 ####################################################################
 #
-# To get Knot DNS started:
+# To start using Knot DNS, you should complete the following tasks:
 #
-  cp %%ETCDIR%%/knot.sample.conf %%ETCDIR%%/knot.conf
-  $EDITOR %%ETCDIR%%/knot.conf
-  echo knot_enable=\"YES\" >> /etc/rc.conf
+# cp %%ETCDIR%%/knot.sample.conf %%ETCDIR%%/knot.conf
+# $EDITOR %%ETCDIR%%/knot.conf
+# echo knot_enable=\"YES\" >> /etc/rc.conf
 # echo knot_config=\"%%PREFIX%%/etc/knot/knot.conf\" >> /etc/rc.conf
-  %%PREFIX%%/etc/rc.d/knotd start
+# %%PREFIX%%/etc/rc.d/knot start
 #
 ####################################################################
-
-  When upgrading from version of before 1.3.0-RC1:
-  mind the default config file location has changed.
-
-  When upgrading from version of 1.3.1-RC1 or before:
-  the startup script has changed due to parameter changes.
-  That problem reapeared in port 1.3.3 and was fixed in 1.3.3_1.
-
-====================================================================

Modified: head/dns/knot/pkg-plist
==============================================================================
--- head/dns/knot/pkg-plist	Thu Feb 13 13:23:05 2014	(r344099)
+++ head/dns/knot/pkg-plist	Thu Feb 13 13:26:03 2014	(r344100)
@@ -1,21 +1,19 @@
-@unexec if cmp -s %B/knot.sample.conf %B/knot.conf; then rm -f %B/knot.conf; fi
+@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
 man/man1/kdig.1.gz
 man/man1/khost.1.gz
+man/man1/knsec3hash.1.gz
 man/man1/knsupdate.1.gz
 man/man5/knot.conf.5.gz
 man/man8/knotc.8.gz
 man/man8/knotd.8.gz
 @dirrmtry %%ETCDIR%%
-@dirrmtry var/run/knot
-@dirrmtry var/run
-@dirrmtry var/lib/knot
-@dirrmtry var/lib
-@dirrmtry var
 bin/kdig
 bin/khost
+bin/knsec3hash
 bin/knsupdate
+info/dir
 sbin/knotc
 sbin/knotd
_______________________________________________
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 Mark Felder freebsd_committer 2014-02-13 13:27:42 UTC
State Changed
From-To: open->closed

Committed. Thanks!