pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/net/djbdns-run Catch up to qmail-run:



details:   https://anonhg.NetBSD.org/pkgsrc/rev/ad5cb042c484
branches:  trunk
changeset: 364295:ad5cb042c484
user:      schmonz <schmonz%pkgsrc.org@localhost>
date:      Fri Jun 23 15:39:44 2017 +0000

description:
Catch up to qmail-run:

- Wrap long command lines for readability
- Document where we set procname=${name} for rc.d
- Detach long-running processes from controlling terminal
- Configurable path to tcpserver
- Configurable user and group names:

DJBDNS_AXFR_USER?=      axfrdns
DJBDNS_CACHE_USER?=     dnscache
DJBDNS_RBL_USER?=       rbldns
DJBDNS_TINY_USER?=      tinydns
DJBDNS_DJBDNS_GROUP?=   djbdns

Bump version.

diffstat:

 net/djbdns-run/Makefile          |  26 +++++++++++++++++---------
 net/djbdns-run/files/axfrdns.sh  |  35 +++++++++++++++++++++++++----------
 net/djbdns-run/files/dnscache.sh |  21 ++++++++++++++-------
 net/djbdns-run/files/rbldns.sh   |  28 ++++++++++++++++++----------
 net/djbdns-run/files/tinydns.sh  |  28 ++++++++++++++++++----------
 5 files changed, 92 insertions(+), 46 deletions(-)

diffs (278 lines):

diff -r d27516b4acb5 -r ad5cb042c484 net/djbdns-run/Makefile
--- a/net/djbdns-run/Makefile   Fri Jun 23 14:05:19 2017 +0000
+++ b/net/djbdns-run/Makefile   Fri Jun 23 15:39:44 2017 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.26 2015/11/25 12:52:11 jperkin Exp $
+# $NetBSD: Makefile,v 1.27 2017/06/23 15:39:44 schmonz Exp $
 #
 
-DISTNAME=              djbdns-run-20141207
+DISTNAME=              djbdns-run-20170623
 CATEGORIES=            net
 MASTER_SITES=          # empty
 DISTFILES=             # empty
@@ -24,16 +24,24 @@
 MAKE_DIRS+=            ${PKG_SYSCONFDIR}/dnscache/servers
 MAKE_DIRS+=            ${PKG_SYSCONFDIR}/rbldns
 MAKE_DIRS+=            ${PKG_SYSCONFDIR}/tinydns
-PKG_GROUPS=            djbdns
-PKG_USERS+=            dnslog:djbdns
-PKG_USERS+=            axfrdns:djbdns
-PKG_USERS+=            dnscache:djbdns
-PKG_USERS+=            rbldns:djbdns
-PKG_USERS+=            tinydns:djbdns
-RCD_SCRIPTS=           axfrdns djbdns dnscache rbldns tinydns
+PKG_GROUPS=            ${DJBDNS_DJBDNS_GROUP}
+PKG_USERS+=            ${DJBDNS_AXFR_USER}:${DJBDNS_DJBDNS_GROUP}
+PKG_USERS+=            ${DJBDNS_CACHE_USER}:${DJBDNS_DJBDNS_GROUP}
+PKG_USERS+=            ${DJBDNS_LOG_USER}:${DJBDNS_DJBDNS_GROUP}
+PKG_USERS+=            ${DJBDNS_RBL_USER}:${DJBDNS_DJBDNS_GROUP}
+PKG_USERS+=            ${DJBDNS_TINY_USER}:${DJBDNS_DJBDNS_GROUP}
+RCD_SCRIPTS=           djbdns axfrdns dnscache rbldns tinydns
+FILES_SUBST+=          DJBDNS_AXFR_USER=${DJBDNS_AXFR_USER:Q}
+FILES_SUBST+=          DJBDNS_CACHE_USER=${DJBDNS_CACHE_USER:Q}
+FILES_SUBST+=          DJBDNS_LOG_USER=${DJBDNS_LOG_USER:Q}
+FILES_SUBST+=          DJBDNS_RBL_USER=${DJBDNS_RBL_USER:Q}
+FILES_SUBST+=          DJBDNS_TINY_USER=${DJBDNS_TINY_USER:Q}
 FILES_SUBST+=          PKGNAME=${PKGNAME:Q}
 
 INSTALLATION_DIRS=     share/doc/djbdns-run
+BUILD_DEFS+=           DJBDNS_AXFR_USER DJBDNS_CACHE_USER DJBDNS_LOG_USER
+BUILD_DEFS+=           DJBDNS_RBL_USER DJBDNS_TINY_USER
+BUILD_DEFS+=           DJBDNS_DJBDNS_GROUP
 
 .include "../../mk/bsd.prefs.mk"
 
diff -r d27516b4acb5 -r ad5cb042c484 net/djbdns-run/files/axfrdns.sh
--- a/net/djbdns-run/files/axfrdns.sh   Fri Jun 23 14:05:19 2017 +0000
+++ b/net/djbdns-run/files/axfrdns.sh   Fri Jun 23 15:39:44 2017 +0000
@@ -1,8 +1,8 @@
 #!@RCD_SCRIPTS_SHELL@
 #
-# $NetBSD: axfrdns.sh,v 1.7 2015/11/25 12:52:12 jperkin Exp $
+# $NetBSD: axfrdns.sh,v 1.8 2017/06/23 15:39:44 schmonz Exp $
 #
-# @PKGNAME@ script to control axfrdns (DNS zone-transfer and TCP service)
+# @PKGNAME@ script to control axfrdns (DNS zone-transfer and TCP service).
 #
 
 # PROVIDE: axfrdns named
@@ -17,6 +17,7 @@
 : ${axfrdns_tcpport:="53"}
 : ${axfrdns_datalimit:="300000"}
 : ${axfrdns_pretcpserver:=""}
+: ${axfrdns_tcpserver:="@PREFIX@/bin/tcpserver"}
 : ${axfrdns_log:="YES"}
 : ${axfrdns_logcmd:="logger -t nb${name} -p daemon.info"}
 : ${axfrdns_nologcmd:="@PREFIX@/bin/multilog -*"}
@@ -26,19 +27,32 @@
 fi
 
 rcvar=${name}
-required_files="@PKG_SYSCONFDIR@/axfrdns/tcp.cdb"
-command="@PREFIX@/bin/tcpserver"
+required_files="@PKG_SYSCONFDIR@/${name}/tcp.cdb"
+command="${axfrdns_tcpserver}"
 procname=${name}
 start_precmd="axfrdns_precmd"
-extra_commands="reload cdb"
-reload_cmd="axfrdns_cdb"; cdb_cmd=${reload_cmd}
+extra_commands="cdb reload"
+cdb_cmd="axfrdns_cdb"
+reload_cmd=${cdb_cmd}
 
 axfrdns_precmd()
 {
-       if [ -f /etc/rc.subr ]; then
-               checkyesno axfrdns_log || axfrdns_logcmd=${axfrdns_nologcmd}
+       if [ -f /etc/rc.subr ] && ! checkyesno axfrdns_log; then
+               axfrdns_logcmd=${axfrdns_nologcmd}
        fi
-       command="@SETENV@ - ${axfrdns_postenv} ROOT=@PKG_SYSCONFDIR@/tinydns IP=${tinydns_ip} @PREFIX@/bin/envuidgid axfrdns @PREFIX@/bin/softlimit -d ${axfrdns_datalimit} ${axfrdns_pretcpserver} 
@PREFIX@/bin/argv0 @PREFIX@/bin/tcpserver ${name} ${axfrdns_tcpflags} -x @PKG_SYSCONFDIR@/axfrdns/tcp.cdb -- ${tinydns_ip} ${axfrdns_tcpport} @PREFIX@/bin/axfrdns </dev/null 2>&1 | 
@PREFIX@/bin/setuidgid dnslog ${axfrdns_logcmd}"
+       # tcpserver(1) is akin to inetd(8), but runs one service per process.
+       # We want to signal only the tcpserver process responsible for this
+       # service. Use argv0(1) to set procname to "axfrdns".
+       command="@PREFIX@/bin/pgrphack @SETENV@ - ${axfrdns_postenv}
+ROOT=@PKG_SYSCONFDIR@/tinydns IP=${tinydns_ip}
+@PREFIX@/bin/envuidgid @DJBDNS_AXFR_USER@
+@PREFIX@/bin/softlimit -d ${axfrdns_datalimit} ${axfrdns_pretcpserver}
+@PREFIX@/bin/argv0 ${axfrdns_tcpserver} ${name}
+${axfrdns_tcpflags} -x @PKG_SYSCONFDIR@/${name}/tcp.cdb
+-- ${tinydns_ip} ${axfrdns_tcpport}
+@PREFIX@/bin/${name}
+</dev/null 2>&1 |
+@PREFIX@/bin/pgrphack @PREFIX@/bin/setuidgid @DJBDNS_LOG_USER@ ${axfrdns_logcmd}"
        command_args="&"
        rc_flags=""
 }
@@ -46,8 +60,9 @@
 axfrdns_cdb()
 {
        @ECHO@ "Reloading @PKG_SYSCONFDIR@/axfrdns/tcp."
-       cd @PKG_SYSCONFDIR@/axfrdns
+       cd @PKG_SYSCONFDIR@/${name}
        @PREFIX@/bin/tcprules tcp.cdb tcp.tmp < tcp
+       @CHMOD@ 644 tcp.cdb
 }
 
 if [ -f /etc/rc.subr ]; then
diff -r d27516b4acb5 -r ad5cb042c484 net/djbdns-run/files/dnscache.sh
--- a/net/djbdns-run/files/dnscache.sh  Fri Jun 23 14:05:19 2017 +0000
+++ b/net/djbdns-run/files/dnscache.sh  Fri Jun 23 15:39:44 2017 +0000
@@ -1,8 +1,8 @@
 #!@RCD_SCRIPTS_SHELL@
 #
-# $NetBSD: dnscache.sh,v 1.8 2015/11/25 12:52:12 jperkin Exp $
+# $NetBSD: dnscache.sh,v 1.9 2017/06/23 15:39:44 schmonz Exp $
 #
-# @PKGNAME@ script to control dnscache (caching DNS resolver)
+# @PKGNAME@ script to control dnscache (caching DNS resolver).
 #
 
 # PROVIDE: dnscache named
@@ -26,17 +26,24 @@
 fi
 
 rcvar=${name}
-required_dirs="@PKG_SYSCONFDIR@/dnscache/ip @PKG_SYSCONFDIR@/dnscache/servers"
-required_files="@PKG_SYSCONFDIR@/dnscache/servers/@"
+required_dirs="@PKG_SYSCONFDIR@/${name}/ip @PKG_SYSCONFDIR@/${name}/servers"
+required_files="@PKG_SYSCONFDIR@/${name}/servers/@"
 command="@PREFIX@/bin/${name}"
 start_precmd="dnscache_precmd"
 
 dnscache_precmd()
 {
-       if [ -f /etc/rc.subr ]; then
-               checkyesno dnscache_log || dnscache_logcmd=${dnscache_nologcmd}
+       if [ -f /etc/rc.subr ] && ! checkyesno dnscache_log; then
+               dnscache_logcmd=${dnscache_nologcmd}
        fi
-       command="@SETENV@ - ${dnscache_postenv} ROOT=@PKG_SYSCONFDIR@/dnscache IP=${dnscache_ip} IPSEND=${dnscache_ipsend} CACHESIZE=${dnscache_size} @PREFIX@/bin/envuidgid dnscache 
@PREFIX@/bin/softlimit -o250 -d ${dnscache_datalimit} @PREFIX@/bin/dnscache </dev/urandom 2>&1 | @PREFIX@/bin/setuidgid dnslog ${dnscache_logcmd}"
+       command="@PREFIX@/bin/pgrphack @SETENV@ - ${dnscache_postenv}
+ROOT=@PKG_SYSCONFDIR@/${name} IP=${dnscache_ip}
+IPSEND=${dnscache_ipsend} CACHESIZE=${dnscache_size}
+@PREFIX@/bin/envuidgid @DJBDNS_CACHE_USER@
+@PREFIX@/bin/softlimit -o250 -d ${dnscache_datalimit}
+@PREFIX@/bin/${name}
+</dev/urandom 2>&1 |
+@PREFIX@/bin/pgrphack @PREFIX@/bin/setuidgid @DJBDNS_LOG_USER@ ${dnscache_logcmd}"
        command_args="&"
        rc_flags=""
 }
diff -r d27516b4acb5 -r ad5cb042c484 net/djbdns-run/files/rbldns.sh
--- a/net/djbdns-run/files/rbldns.sh    Fri Jun 23 14:05:19 2017 +0000
+++ b/net/djbdns-run/files/rbldns.sh    Fri Jun 23 15:39:44 2017 +0000
@@ -1,8 +1,8 @@
 #!@RCD_SCRIPTS_SHELL@
 #
-# $NetBSD: rbldns.sh,v 1.5 2015/11/25 12:52:12 jperkin Exp $
+# $NetBSD: rbldns.sh,v 1.6 2017/06/23 15:39:44 schmonz Exp $
 #
-# @PKGNAME@ script to control rbldns (local RBL service)
+# @PKGNAME@ script to control rbldns (local RBL service).
 #
 
 # PROVIDE: rbldns named
@@ -25,27 +25,35 @@
 fi
 
 rcvar=${name}
-required_files="@PKG_SYSCONFDIR@/rbldns/data.cdb"
+required_files="@PKG_SYSCONFDIR@/${name}/data.cdb"
 command="@PREFIX@/bin/${name}"
 start_precmd="rbldns_precmd"
-extra_commands="reload cdb"
-reload_cmd="rbldns_cdb"; cdb_cmd=${reload_cmd}
+extra_commands="cdb reload"
+cdb_cmd="rbldns_cdb"
+reload_cmd=${cdb_cmd}
 
 rbldns_precmd()
 {
-       if [ -f /etc/rc.subr ]; then
-               checkyesno rbldns_log || rbldns_logcmd=${rbldns_nologcmd}
+       if [ -f /etc/rc.subr ] && ! checkyesno rbldns_log; then
+               rbldns_logcmd=${rbldns_nologcmd}
        fi
-       command="@SETENV@ - ${rbldns_postenv} ROOT=@PKG_SYSCONFDIR@/rbldns IP=${rbldns_ip} BASE=${rbldns_base} @PREFIX@/bin/envuidgid rbldns @PREFIX@/bin/softlimit -d ${rbldns_datalimit} 
@PREFIX@/bin/rbldns 2>&1 | @PREFIX@/bin/setuidgid dnslog ${rbldns_logcmd}"
+       command="@PREFIX@/bin/pgrphack @SETENV@ - ${rbldns_postenv}
+ROOT=@PKG_SYSCONFDIR@/${name} IP=${rbldns_ip} BASE=${rbldns_base}
+@PREFIX@/bin/envuidgid @DJBDNS_RBL_USER@
+@PREFIX@/bin/softlimit -d ${rbldns_datalimit}
+@PREFIX@/bin/${name}
+2>&1 |
+@PREFIX@/bin/pgrphack @PREFIX@/bin/setuidgid @DJBDNS_LOG_USER@ ${rbldns_logcmd}"
        command_args="&"
        rc_flags=""
 }
 
 rbldns_cdb()
 {
-       @ECHO@ "Reloading @PKG_SYSCONFDIR@/rbldns/data."
-       cd @PKG_SYSCONFDIR@/rbldns
+       @ECHO@ "Reloading @PKG_SYSCONFDIR@/${name}/data."
+       cd @PKG_SYSCONFDIR@/${name}
        @PREFIX@/bin/rbldns-data
+       @CHMOD@ 644 data.cdb
 }
 
 if [ -f /etc/rc.subr ]; then
diff -r d27516b4acb5 -r ad5cb042c484 net/djbdns-run/files/tinydns.sh
--- a/net/djbdns-run/files/tinydns.sh   Fri Jun 23 14:05:19 2017 +0000
+++ b/net/djbdns-run/files/tinydns.sh   Fri Jun 23 15:39:44 2017 +0000
@@ -1,8 +1,8 @@
 #!@RCD_SCRIPTS_SHELL@
 #
-# $NetBSD: tinydns.sh,v 1.7 2015/11/25 12:52:12 jperkin Exp $
+# $NetBSD: tinydns.sh,v 1.8 2017/06/23 15:39:44 schmonz Exp $
 #
-# @PKGNAME@ script to control tinydns (authoritative DNS service)
+# @PKGNAME@ script to control tinydns (authoritative DNS service).
 #
 
 # PROVIDE: tinydns named
@@ -24,27 +24,35 @@
 fi
 
 rcvar=${name}
-required_files="@PKG_SYSCONFDIR@/tinydns/data.cdb"
+required_files="@PKG_SYSCONFDIR@/${name}/data.cdb"
 command="@PREFIX@/bin/${name}"
 start_precmd="tinydns_precmd"
-extra_commands="reload cdb"
-reload_cmd="tinydns_cdb"; cdb_cmd=${reload_cmd}
+extra_commands="cdb reload"
+cdb_cmd="tinydns_cdb"
+reload_cmd=${cdb_cmd}
 
 tinydns_precmd()
 {
-       if [ -f /etc/rc.subr ]; then
-               checkyesno tinydns_log || tinydns_logcmd=${tinydns_nologcmd}
+       if [ -f /etc/rc.subr ] && ! checkyesno tinydns_log; then
+               tinydns_logcmd=${tinydns_nologcmd}
        fi
-       command="@SETENV@ - ${tinydns_postenv} ROOT=@PKG_SYSCONFDIR@/tinydns IP=${tinydns_ip} @PREFIX@/bin/envuidgid tinydns @PREFIX@/bin/softlimit -d ${tinydns_datalimit} @PREFIX@/bin/tinydns 
</dev/null 2>&1 | @PREFIX@/bin/setuidgid dnslog ${tinydns_logcmd}"
+       command="@PREFIX@/bin/pgrphack @SETENV@ - ${tinydns_postenv}
+ROOT=@PKG_SYSCONFDIR@/${name} IP=${tinydns_ip}
+@PREFIX@/bin/envuidgid @DJBDNS_TINY_USER@
+@PREFIX@/bin/softlimit -d ${tinydns_datalimit}
+@PREFIX@/bin/${name}
+</dev/null 2>&1 |
+@PREFIX@/bin/pgrphack @PREFIX@/bin/setuidgid @DJBDNS_LOG_USER@ ${tinydns_logcmd}"
        command_args="&"
        rc_flags=""
 }
 
 tinydns_cdb()
 {
-       @ECHO@ "Reloading @PKG_SYSCONFDIR@/tinydns/data."
-       cd @PKG_SYSCONFDIR@/tinydns
+       @ECHO@ "Reloading @PKG_SYSCONFDIR@/${name}/data."
+       cd @PKG_SYSCONFDIR@/${name}
        @PREFIX@/bin/tinydns-data
+       @CHMOD@ 644 data.cdb
 }
 
 if [ -f /etc/rc.subr ]; then



Home | Main Index | Thread Index | Old Index