summaryrefslogtreecommitdiff
path: root/net/djbdns-run
diff options
context:
space:
mode:
authorschmonz <schmonz@pkgsrc.org>2004-09-01 20:13:04 +0000
committerschmonz <schmonz@pkgsrc.org>2004-09-01 20:13:04 +0000
commit01f641147d5488738a52c720e75c0548e39e443a (patch)
tree4543eb5d58802ce626b33cafbdfdceef81ab91b7 /net/djbdns-run
parent84bca927105f1bc6ba588f27659526767c1ef7a4 (diff)
downloadpkgsrc-01f641147d5488738a52c720e75c0548e39e443a.tar.gz
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.
Diffstat (limited to 'net/djbdns-run')
-rw-r--r--net/djbdns-run/DESCR3
-rw-r--r--net/djbdns-run/INSTALL26
-rw-r--r--net/djbdns-run/MESSAGE22
-rw-r--r--net/djbdns-run/Makefile68
-rw-r--r--net/djbdns-run/PLIST5
-rw-r--r--net/djbdns-run/files/README.pkgsrc11
-rw-r--r--net/djbdns-run/files/axfrdns.sh51
-rw-r--r--net/djbdns-run/files/dnscache-showctl.sh20
-rw-r--r--net/djbdns-run/files/dnscache.sh44
-rw-r--r--net/djbdns-run/files/tinydns-showctl.sh17
-rw-r--r--net/djbdns-run/files/tinydns.sh50
11 files changed, 317 insertions, 0 deletions
diff --git a/net/djbdns-run/DESCR b/net/djbdns-run/DESCR
new file mode 100644
index 00000000000..54f01c835bd
--- /dev/null
+++ b/net/djbdns-run/DESCR
@@ -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.
diff --git a/net/djbdns-run/INSTALL b/net/djbdns-run/INSTALL
new file mode 100644
index 00000000000..f7d35677258
--- /dev/null
+++ b/net/djbdns-run/INSTALL
@@ -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
diff --git a/net/djbdns-run/MESSAGE b/net/djbdns-run/MESSAGE
new file mode 100644
index 00000000000..40ae92caf7f
--- /dev/null
+++ b/net/djbdns-run/MESSAGE
@@ -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.
+
+===========================================================================
diff --git a/net/djbdns-run/Makefile b/net/djbdns-run/Makefile
new file mode 100644
index 00000000000..fef6ca85509
--- /dev/null
+++ b/net/djbdns-run/Makefile
@@ -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"
diff --git a/net/djbdns-run/PLIST b/net/djbdns-run/PLIST
new file mode 100644
index 00000000000..fb3029dfa57
--- /dev/null
+++ b/net/djbdns-run/PLIST
@@ -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
diff --git a/net/djbdns-run/files/README.pkgsrc b/net/djbdns-run/files/README.pkgsrc
new file mode 100644
index 00000000000..74280189c92
--- /dev/null
+++ b/net/djbdns-run/files/README.pkgsrc
@@ -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.
diff --git a/net/djbdns-run/files/axfrdns.sh b/net/djbdns-run/files/axfrdns.sh
new file mode 100644
index 00000000000..6ef582c1fc1
--- /dev/null
+++ b/net/djbdns-run/files/axfrdns.sh
@@ -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
diff --git a/net/djbdns-run/files/dnscache-showctl.sh b/net/djbdns-run/files/dnscache-showctl.sh
new file mode 100644
index 00000000000..693668f7949
--- /dev/null
+++ b/net/djbdns-run/files/dnscache-showctl.sh
@@ -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
diff --git a/net/djbdns-run/files/dnscache.sh b/net/djbdns-run/files/dnscache.sh
new file mode 100644
index 00000000000..82244e0eb9f
--- /dev/null
+++ b/net/djbdns-run/files/dnscache.sh
@@ -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
diff --git a/net/djbdns-run/files/tinydns-showctl.sh b/net/djbdns-run/files/tinydns-showctl.sh
new file mode 100644
index 00000000000..860c25febaf
--- /dev/null
+++ b/net/djbdns-run/files/tinydns-showctl.sh
@@ -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
diff --git a/net/djbdns-run/files/tinydns.sh b/net/djbdns-run/files/tinydns.sh
new file mode 100644
index 00000000000..a0202d4032a
--- /dev/null
+++ b/net/djbdns-run/files/tinydns.sh
@@ -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