Initial import of djbdns-run, a package that provides NetBSD-style

rc.d scripts (inspired by Bennett Todd's Linux init.d scripts) to
run djbdns services. It also includes Jonathan de Boyne Pollard's
dnscache-showctl and tinydns-showctl scripts.
This commit is contained in:
schmonz 2004-09-01 20:13:04 +00:00
parent 84bca92710
commit 01f641147d
11 changed files with 317 additions and 0 deletions

3
net/djbdns-run/DESCR Normal file
View file

@ -0,0 +1,3 @@
This package creates all the needed basic config files to run djbdns
services, and provides NetBSD-style rc.d scripts. It also includes
Jonathan de Boyne Pollard's dnscache-showctl and tinydns-showctl.

26
net/djbdns-run/INSTALL Normal file
View file

@ -0,0 +1,26 @@
psmsg='#
# This file was auto-generated by pkgsrc.'
case ${STAGE} in
POST-INSTALL)
cd ${PKG_SYSCONFDIR}/axfrdns
if ! [ -s tcp ]; then
${ECHO} ':allow,AXFR=""' > tcp
${ECHO} "$psmsg" >> tcp
${CHMOD} 644 tcp
fi
${LOCALBASE}/bin/tcprules tcp.cdb tcp.tmp < tcp
${CHMOD} 644 tcp.cdb
cd ${PKG_SYSCONFDIR}/dnscache
${TOUCH} ip/127.0.0.1
${CHMOD} 644 ip/127.0.0.1
if ! [ -s servers/@ ]; then
${CP} ../dnsroots.global servers/@
fi
;;
esac

22
net/djbdns-run/MESSAGE Normal file
View file

@ -0,0 +1,22 @@
===========================================================================
$NetBSD: MESSAGE,v 1.1.1.1 2004/09/01 20:13:04 schmonz Exp $
Please read ${PREFIX}/share/doc/djbdns-run/README.pkgsrc.
To enable a DNS...
Cache for the local machine:
- Set dnscache=YES in /etc/rc.conf.
- Run "echo nameserver 127.0.0.1 > /etc/resolv.conf".
UDP name service:
- Set tinydns=YES in /etc/rc.conf.
- Set tinydns_ip to a suitable IP address of the local machine.
- Create ${PKG_SYSCONFDIR}/tinydns/data with suitable contents.
- Run "${RCD_SCRIPTS_DIR}/tinydns cdb".
TCP name service:
- Enable UDP name service.
- Set axfrdns=YES in /etc/rc.conf.
===========================================================================

68
net/djbdns-run/Makefile Normal file
View file

@ -0,0 +1,68 @@
# $NetBSD: Makefile,v 1.1.1.1 2004/09/01 20:13:04 schmonz Exp $
#
DISTNAME= djbdns-run-20040901
CATEGORIES= net
MASTER_SITES= # empty
DISTFILES= # empty
MAINTAINER= schmonz@NetBSD.org
COMMENT= Configures djbdns to cache and serve queries
DEPENDS_DJBDNS= djbdns>=1.05nb5:../../net/djbdns
DEPENDS+= ${DEPENDS_DJBDNS}
DEPENDS+= daemontools-[0-9]*:../../sysutils/daemontools
DEPENDS+= ucspi-tcp-[0-9]*:../../net/ucspi-tcp
CONFLICTS+= djbdns<=1.05nb4
PKG_INSTALLATION_TYPES= overwrite pkgviews
WRKSRC= ${WRKDIR}
NO_CHECKSUM= # defined
USE_PKGINSTALL= yes
INSTALL_EXTRA_TMPL+= ${PKGDIR}/INSTALL
MAKE_DIRS+= ${PKG_SYSCONFDIR}/axfrdns
MAKE_DIRS+= ${PKG_SYSCONFDIR}/dnscache/ip
MAKE_DIRS+= ${PKG_SYSCONFDIR}/dnscache/servers
MAKE_DIRS+= ${PKG_SYSCONFDIR}/tinydns
PKG_GROUPS= djbdns
PKG_USERS+= Gdnslog:djbdns::dnslog
PKG_USERS+= Gaxfrdns:djbdns::axfrdns
PKG_USERS+= Gdnscache:djbdns::dnscache
PKG_USERS+= Gtinydns:djbdns::tinydns
RCD_SCRIPTS= axfrdns dnscache tinydns
FILES_SUBST+= PKGNAME=${PKGNAME}
INSTALLATION_DIRS= bin share/doc/djbdns-run
.include "../../mk/bsd.prefs.mk"
# Detect the PKG_SYSCONFDIR of the installed djbdns, so we can create
# config files there and refer to them from rc.d scripts.
.if !empty(PHASES_AFTER_EXTRACT:M${PKG_PHASE})
INSTALLED_DJBDNS!= ${PKG_BEST_EXISTS} ${DEPENDS_DJBDNS:C/:.*$//:Q:S/\ / /g}
. if empty(INSTALLED_DJBDNS:M*_not_found_)
. if !defined(PKG_SYSCONFDIR.djbdns-run)
PKG_SYSCONFDIR.djbdns-run!= \
${PKG_INFO} -qB ${INSTALLED_DJBDNS} | \
${SED} -n '/^PKG_SYSCONFDIR=/s|^PKG_SYSCONFDIR=[ ]*||p'
. endif
. endif
.endif
do-build:
@${SED} ${FILES_SUBST_SED} ${FILESDIR}/README.pkgsrc \
> ${WRKDIR}/README.pkgsrc
@${SED} ${FILES_SUBST_SED} ${FILESDIR}/dnscache-showctl.sh \
> ${WRKDIR}/dnscache-showctl
@${SED} ${FILES_SUBST_SED} ${FILESDIR}/tinydns-showctl.sh \
> ${WRKDIR}/tinydns-showctl
do-install:
${INSTALL_SCRIPT} ${WRKDIR}/dnscache-showctl ${PREFIX}/bin
${INSTALL_SCRIPT} ${WRKDIR}/tinydns-showctl ${PREFIX}/bin
${INSTALL_DATA} ${WRKDIR}/README.pkgsrc ${PREFIX}/share/doc/djbdns-run
.include "../../mk/bsd.pkg.mk"

5
net/djbdns-run/PLIST Normal file
View file

@ -0,0 +1,5 @@
@comment $NetBSD: PLIST,v 1.1.1.1 2004/09/01 20:13:04 schmonz Exp $
bin/dnscache-showctl
bin/tinydns-showctl
share/doc/djbdns-run/README.pkgsrc
@dirrm share/doc/djbdns-run

View file

@ -0,0 +1,11 @@
Getting help
============
You've installed an automated and customized djbdns-run package.
If you're having trouble getting the djbdns daemons to run, ask
the package's maintainer:
<URL:mailto:schmonz-nbdjbdns@schmonz.com>
If you need to ask for help on the dns list, please mention that
you're using the djbdns-run package from pkgsrc.

View file

@ -0,0 +1,51 @@
#!@RCD_SCRIPTS_SHELL@
#
# $NetBSD: axfrdns.sh,v 1.1.1.1 2004/09/01 20:13:04 schmonz Exp $
#
# @PKGNAME@ script to control axfrdns (DNS zone-transfer and TCP service)
#
# PROVIDE: axfrdns named
# REQUIRE: SERVERS tinydns
# BEFORE: DAEMON
if [ -f /etc/rc.subr ]; then
. /etc/rc.subr
fi
name="axfrdns"
rcvar=${name}
required_files="@PKG_SYSCONFDIR@/axfrdns/tcp.cdb"
command="@LOCALBASE@/bin/tcpserver"
procname=${name}
start_precmd="axfrdns_precmd"
extra_commands="cdb"
cdb_cmd="axfrdns_cdb"
# User-settable rc.conf variables and their default values:
axfrdns_tcpflags=${axfrdns_tcpflags-"-vDRHl0"}
axfrdns_datalimit=${axfrdns_datalimit-"300000"}
axfrdns_logcmd=${axfrdns_logcmd-"@LOCALBASE@/bin/setuidgid Gdnslog logger -t nb${name} -p daemon.info"}
axfrdns_precmd()
{
command="@SETENV@ - ROOT=@PKG_SYSCONFDIR@/tinydns IP=${tinydns_ip} @LOCALBASE@/bin/envuidgid Gaxfrdns @LOCALBASE@/bin/softlimit -d ${axfrdns_datalimit} @LOCALBASE@/bin/argv0 @LOCALBASE@/bin/tcpserver ${name} ${axfrdns_tcpflags} -x @PKG_SYSCONFDIR@/axfrdns/tcp.cdb -- ${tinydns_ip} 53 @LOCALBASE@/bin/axfrdns </dev/null 2>&1 | ${axfrdns_logcmd}"
command_args="&"
rc_flags=""
}
axfrdns_cdb()
{
@ECHO@ "Reloading @PKG_SYSCONFDIR@/axfrdns/tcp."
cd @PKG_SYSCONFDIR@/axfrdns
@LOCALBASE@/bin/tcprules tcp.cdb tcp.tmp < tcp
}
if [ -f /etc/rc.subr ]; then
load_rc_config $name
run_rc_command "$1"
else
@ECHO_N@ " ${name}"
axfrdns_precmd
eval ${command} ${axfrdns_flags} ${command_args}
fi

View file

@ -0,0 +1,20 @@
#!@SH@
# (c) Copyright 2001-2002 Jonathan de Boyne Pollard. All rights reserved. "Moral" rights asserted.
# Permission is hereby granted to distribute this script unmodified.
for i do (
cd "$i"
echo "$i" | sed -e 's/./*/g'
echo "$i"
echo "$i" | sed -e 's/./*/g'
echo
echo '+++ Configuration options:'
egrep '[A-Za-z0-9_]+=' run
( cd env 2>/dev/null && grep "^" /dev/null * )
echo
echo '+++ Authorised client IP address prefixes:'
ls -1 root/ip
echo
echo '+++ Hardwired content server IP addresses:'
cd root/servers && grep "^" /dev/null *
echo
); done

View file

@ -0,0 +1,44 @@
#!@RCD_SCRIPTS_SHELL@
#
# $NetBSD: dnscache.sh,v 1.1.1.1 2004/09/01 20:13:04 schmonz Exp $
#
# @PKGNAME@ script to control dnscache (caching DNS resolver)
#
# PROVIDE: dnscache named
# REQUIRE: SERVERS
# BEFORE: DAEMON
if [ -f /etc/rc.subr ]; then
. /etc/rc.subr
fi
name="dnscache"
rcvar=${name}
required_dirs="@PKG_SYSCONFDIR@/dnscache/ip @PKG_SYSCONFDIR@/dnscache/servers"
required_files="@PKG_SYSCONFDIR@/dnscache/servers/@"
command="@LOCALBASE@/bin/${name}"
start_precmd="dnscache_precmd"
# User-settable rc.conf variables and their default values:
dnscache_ip=${dnscache_ip-"127.0.0.1"}
dnscache_ipsend=${dnscache_ipsend-"0.0.0.0"}
dnscache_size=${dnscache_size-"1000000"}
dnscache_datalimit=${dnscache_datalimit-"3000000"}
dnscache_logcmd=${dnscache_logcmd-"@LOCALBASE@/bin/setuidgid Gdnslog logger -t nb${name} -p daemon.info"}
dnscache_precmd()
{
command="@SETENV@ - ROOT=@PKG_SYSCONFDIR@/dnscache IP=${dnscache_ip} IPSEND=${dnscache_ipsend} CACHESIZE=${dnscache_size} @LOCALBASE@/bin/envuidgid Gdnscache @LOCALBASE@/bin/softlimit -o250 -d ${dnscache_datalimit} @LOCALBASE@/bin/dnscache </dev/random 2>&1 | ${dnscache_logcmd}"
command_args="&"
rc_flags=""
}
if [ -f /etc/rc.subr ]; then
load_rc_config $name
run_rc_command "$1"
else
@ECHO_N@ " ${name}"
dnscache_precmd
eval ${command} ${dnscache_flags} ${command_args}
fi

View file

@ -0,0 +1,17 @@
#!@SH@
# (c) Copyright 2001-2002 Jonathan de Boyne Pollard. All rights reserved. "Moral" rights asserted.
# Permission is hereby granted to distribute this script unmodified.
for i do (
cd "$i"
echo "$i" | sed -e 's/./*/g'
echo "$i"
echo "$i" | sed -e 's/./*/g'
echo
echo '+++ Configuration options:'
egrep '[A-Za-z0-9_]+=' run
( cd env 2>/dev/null && grep "^" /dev/null * )
echo
echo '+++ Apices of those parts of the namespace that will be served up:'
sed -ne '/^[Z.]/{s/^.//;s/:.*$//;s/\([^.]\)$/\1./;p;}' < root/data
echo
); done

View file

@ -0,0 +1,50 @@
#!@RCD_SCRIPTS_SHELL@
#
# $NetBSD: tinydns.sh,v 1.1.1.1 2004/09/01 20:13:04 schmonz Exp $
#
# @PKGNAME@ script to control tinydns (authoritative DNS service)
#
# PROVIDE: tinydns named
# REQUIRE: SERVERS
# BEFORE: DAEMON
if [ -f /etc/rc.subr ]; then
. /etc/rc.subr
fi
name="tinydns"
rcvar=${name}
required_files="@PKG_SYSCONFDIR@/tinydns/data.cdb"
command="@LOCALBASE@/bin/${name}"
start_precmd="tinydns_precmd"
extra_commands="cdb"
cdb_cmd="tinydns_cdb"
# User-settable rc.conf variables and their default values:
tinydns_ip=${tinydns_ip-"127.0.0.2"}
tinydns_datalimit=${tinydns_datalimit-"300000"}
tinydns_logcmd=${tinydns_logcmd-"@LOCALBASE@/bin/setuidgid Gdnslog logger -t nb${name} -p daemon.info"}
tinydns_precmd()
{
command="@SETENV@ - ROOT=@PKG_SYSCONFDIR@/tinydns IP=${tinydns_ip} @LOCALBASE@/bin/envuidgid Gtinydns @LOCALBASE@/bin/softlimit -d ${tinydns_datalimit} @LOCALBASE@/bin/tinydns </dev/null 2>&1 | ${tinydns_logcmd}"
command_args="&"
rc_flags=""
}
tinydns_cdb()
{
@ECHO@ "Reloading @PKG_SYSCONFDIR@/tinydns/data."
cd @PKG_SYSCONFDIR@/tinydns
@LOCALBASE@/bin/tinydns-data
}
if [ -f /etc/rc.subr ]; then
load_rc_config $name
run_rc_command "$1"
else
@ECHO_N@ " ${name}"
tinydns_precmd
eval ${command} ${tinydns_flags} ${command_args}
fi