Commit e534cb5e authored by Natanael Copa's avatar Natanael Copa

extra/djbdns: new aport

Excellent high-performance DNS services
http://cr.yp.to/djbdns.html
parent a69c6d19
--- a/error.h 2001-02-11 15:11:45.000000000 -0600
+++ b/error.h 2003-02-26 02:10:21.000000000 -0600
@@ -1,7 +1,7 @@
#ifndef ERROR_H
#define ERROR_H
-extern int errno;
+#include <errno.h>
extern int error_intr;
extern int error_nomem;
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=djbdns
pkgver=1.05
pkgrel=21
pkgdesc="Excellent high-performance DNS services"
url="http://cr.yp.to/djbdns.html"
license="public-domain"
depends="uclibc"
subpackages="tinydns dnscache"
source="http://cr.yp.to/djbdns/$pkgname-$pkgver.tar.gz
headtail.patch
dnsroots.patch
dnstracesort.patch
$pkgver-errno.patch
tinydns.install
tinydns.initd
tinydns.confd
dnscache.install
dnscache.initd
dnscache.confd
"
build() {
cd "$srcdir"/$pkgname-$pkgver
for i in ../*.patch; do
msg "Applying $i..."
patch -p1 < $i || return 1
done
echo "${CC:-"gcc"} ${CFLAGS}" > conf-cc
echo "${CC:-"gcc"} ${LDFLAGS}" > conf-ld
echo "/usr" > conf-home
make -j1 || return 1
mkdir -p "$pkgdir"/etc/
cp dnsroots.global "$pkgdir"/etc/
mkdir -p "$pkgdir"/usr/bin
cp *-conf dnscache tinydns walldns rbldns pickdns axfrdns \
*-get *-data *-edit dnsip dnsipq dnsname dnstxt dnsmx \
dnsfilter random-ip dnsqr dnsq dnstrace dnstracesort \
"$pkgdir"/usr/bin/
mkdir -p "$pkgdir"/usr/share/doc/djbdns
}
tinydns() {
pkgdesc="A small and secure DNS server"
install=tinydns.install
mkdir -p "$subpkgdir"/usr/bin "$subpkgdir"/etc/tinydns \
"$subpkgdir"/var/cache/tinydns
mv "$pkgdir"/usr/bin/tinydns* "$subpkgdir"/usr/bin
install -D -m755 "$srcdir"/tinydns.initd \
"$subpkgdir"/etc/init.d/tinydns
install -D -m644 "$srcdir"/tinydns.confd \
"$subpkgdir"/etc/conf.d/tinydns
}
dnscache() {
pkgdesc="A recursive resolver"
install=dnscache.install
mkdir -p "$subpkgdir"/usr/bin "$subpkgdir"/etc/dnscache
mv "$pkgdir"/usr/bin/dnscache* "$subpkgdir"/usr/bin
install -D -m755 "$srcdir"/dnscache.initd \
"$subpkgdir"/etc/init.d/dnscache
install -D -m644 "$srcdir"/dnscache.confd \
"$subpkgdir"/etc/conf.d/dnscache
}
md5sums="3147c5cd56832aa3b41955c7a51cbeb2 djbdns-1.05.tar.gz
0d2adaf9f1626043e8702b825cdccdd6 headtail.patch
dfd675b2775efcbb604413a84db8bf1a dnsroots.patch
6fe7f473233f1c86b76261afd8345bf0 dnstracesort.patch
c7be73fe2fb4ae02d5096fa2c1f55a68 1.05-errno.patch
2e1cd0923248120f8d066967781538be tinydns.install
d7be449f5f90457ba785aebb1cadbf88 tinydns.initd
7dcf6674c07d46c736b3c25d9c92384a tinydns.confd
6f42e0c25d35ccf7b0af5f26aea04f55 dnscache.install
e368a86ddc320937d663dd47684ba410 dnscache.initd
e2938593277d7a87806e70e145a90c3f dnscache.confd"
# DNSCACHE configuration variables:
# IPSEND - ip address to use for requests use 0.0.0.0 for default route
IPSEND=0.0.0.0
# CACHESIZE - Num bytes to use for the cache
CACHESIZE=1000000
# IP - IP addr to listen on
IP=127.0.0.1
#------------------------------------------------------------------------
# The following are flags. Setting them to ANY value
# (even "false" or "off") will turn the feature on.
#------------------------------------------------------------------------
# HIDETTL - always return TTL as 0
#HIDETTL=
# FORWARDONLY - servers/@ are parent caches, not root servers
#FORWARDONLY=
#!/sbin/runscript
# control n instances of dnscache, without daemontools
# written for alpine linux - NBA April 2007
# -- Statrup variables
UID=$( grep dnscache /etc/passwd | cut -f3 -d: )
GID=$( grep dnscache /etc/group | cut -f3 -d: )
ROOT=/etc/dnscache
DAEMON=/usr/bin/dnscache
VARRUN=/var/run/dnscache
#-----------------------------------------------------------------
# Main program
start() {
ebegin "Starting dnscache"
if [ -z "$UID" ] || [ -z "$GID" ]; then
eend 1 "dnscache user or group missing"
return 1
fi
# if its already running, just report it is
if [ -e ${VARRUN}.pid ] && [ -d /proc/$( cat ${VARRUN}.pid ) ]; then
eend 0
return 0
fi
(
export UID GID ROOT
[ -n "$IPSEND" ] && export IPSEND
[ -n "$IP" ] && export IP
[ -n "$HIDETTL" ] && export HIDETTL
[ -n "$IPSEND" ] && export IPSEND
[ -n "$CACHESIZE" ] && export CACHESIZE
[ -n "$FORWARDONLY" ] && export FORWARDONLY
$DAEMON </dev/urandom >/dev/null 2>/dev/null &
pid=$!
sleep 1
# Check if its still running
if ! [ -d /proc/$pid ]; then
$DAEMON </dev/urandom
return 1
fi
echo $pid > ${VARRUN}.pid
eend $?
return 0
)
}
stop() {
ebegin "Stopping dnscache"
start-stop-daemon --stop -m --pidfile ${VARRUN}.pid --oknodo \
--exec $DAEMON && rm ${VARRUN}.pid
eend $?
}
#!/bin/sh
case "$1" in
pre_install)
adduser -h /etc/dnscache -g dnscache -s /bin/false -H -D \
dnscache 2>/dev/null
;;
esac
exit 0
--- djbdns-1.05.old/dnsroots.global.old Fri May 31 19:42:37 2002
+++ djbdns-1.05/dnsroots.global Thu Jan 29 21:41:56 2004
@@ -1,5 +1,5 @@
198.41.0.4
-128.9.0.107
+192.228.79.201
192.33.4.12
128.8.10.90
192.203.230.10
@@ -7,7 +7,7 @@
192.112.36.4
128.63.2.53
192.36.148.17
-198.41.0.10
+192.58.128.30
193.0.14.129
198.32.64.12
202.12.27.33
--- djbdns-1.05/dnstracesort.sh.orig 2006-04-26 21:52:54.000000000 +0200
+++ djbdns-1.05/dnstracesort.sh 2006-04-26 21:53:02.000000000 +0200
@@ -12,7 +12,7 @@
}
print
}
-' | sort -t: +0 -2 +4 +3 -4 +2 -3 | uniq | awk -F: '
+' | sort -t: -k 1,3 -k 5 -k 4,5 -k 3,4 | uniq | awk -F: '
{
type = $1
q = $2
diff -Naur /tmp/djbdns-1.05/Makefile djbdns-1.05/Makefile
--- a/Makefile 2003-11-16 20:33:41.000000000 +0100
+++ b/Makefile 2003-11-16 20:35:15.000000000 +0100
@@ -31,7 +31,7 @@
auto_home.c: \
auto-str conf-home
- ./auto-str auto_home `head -1 conf-home` > auto_home.c
+ ./auto-str auto_home `head -n 1 conf-home` > auto_home.c
auto_home.o: \
compile auto_home.c
@@ -205,14 +205,14 @@
choose: \
warn-auto.sh choose.sh conf-home
cat warn-auto.sh choose.sh \
- | sed s}HOME}"`head -1 conf-home`"}g \
+ | sed s}HOME}"`head -n 1 conf-home`"}g \
> choose
chmod 755 choose
compile: \
warn-auto.sh conf-cc
( cat warn-auto.sh; \
- echo exec "`head -1 conf-cc`" '-c $${1+"$$@"}' \
+ echo exec "`head -n 1 conf-cc`" '-c $${1+"$$@"}' \
) > compile
chmod 755 compile
@@ -449,7 +449,7 @@
dnstracesort: \
warn-auto.sh dnstracesort.sh conf-home
cat warn-auto.sh dnstracesort.sh \
- | sed s}HOME}"`head -1 conf-home`"}g \
+ | sed s}HOME}"`head -n 1 conf-home`"}g \
> dnstracesort
chmod 755 dnstracesort
@@ -570,7 +570,7 @@
warn-auto.sh conf-ld
( cat warn-auto.sh; \
echo 'main="$$1"; shift'; \
- echo exec "`head -1 conf-ld`" \
+ echo exec "`head -n 1 conf-ld`" \
'-o "$$main" "$$main".o $${1+"$$@"}' \
) > load
chmod 755 load
@@ -758,7 +758,7 @@
rts: \
warn-auto.sh rts.sh conf-home
cat warn-auto.sh rts.sh \
- | sed s}HOME}"`head -1 conf-home`"}g \
+ | sed s}HOME}"`head -n 1 conf-home`"}g \
> rts
chmod 755 rts
@@ -901,8 +901,8 @@
systype: \
find-systype.sh conf-cc conf-ld trycpp.c x86cpuid.c
( cat warn-auto.sh; \
- echo CC=\'`head -1 conf-cc`\'; \
- echo LD=\'`head -1 conf-ld`\'; \
+ echo CC=\'`head -n 1 conf-cc`\'; \
+ echo LD=\'`head -n 1 conf-ld`\'; \
cat find-systype.sh; \
) | sh > systype
# IP is the ip address to listen on
IP=127.0.0.1
#!/sbin/runscript
# control an instance of tinydns, without daemontools
# written for alpine linux - NBA April 2007
opts="reload"
# -- Statrup variables
UID=$( grep tinydns /etc/passwd | cut -f3 -d: )
GID=$( grep tinydns /etc/group | cut -f3 -d: )
DAEMON=/usr/bin/tinydns
COMPILER=/usr/bin/tinydns-data
IFACE="${SVCNAME#*.}"
if [ -n "$IFACE" ] && [ "${SVCNAME}" != "tinydns" ]; then
ROOT=${ROOT:-/var/cache/tinydns.$IFACE}
VARRUN=${VARRUN:-/var/run/tinydns.$IFACE}
DATADIR=${DATADIR:-/etc/tinydns.$IFACE}
else
ROOT=${ROOT:-/var/cache/tinydns}
VARRUN=${VARRUN:-/var/run/tinydns}
DATADIR=${DATADIR:-/etc/tinydns}
fi
#-----------------------------------------------------------------
# Main program
reload() {
local rc opwd="$opwd"
# Create the $ROOT directory if necessary
if [ ! -d "$ROOT" ]; then
mkdir -p "$ROOT"
chown $UID:$GID "$ROOT"
fi
# If a file named "data" exists in the $ROOT dir
# Then we just use it and ignore anything else
# If the "data" file does not exist, we attempt
# to build one out of the "zone files".
ebegin "Generating tinydns cache"
rm -f "$ROOT/data"
if [ -e $DATADIR/data ]; then
ln -sf "$DATADIR/data" "$ROOT/data"
else
set -- $( find $DATADIR -type f )
if [ $# -eq 0 ]; then
eend 1 "Missing data or zone files in $DATADIR"
return 1
fi
cat "$@" > "$ROOT/data"
fi
cd "$ROOT" || return 1
[ -e data ] || rm -f data.cdb
$COMPILER
rc=$?
cd "$opwd"
eend $rc
return $rc
}
start() {
# Always do a reload on start
reload || return 1
ebegin "Starting tinydns"
if [ -z "$UID" ] || [ -z "$GID" ]; then
eend 1 "tinydns user or group missing"
return 1
fi
# if its already running, just report it is
if [ -e ${VARRUN}.pid ] && [ -d /proc/$( cat ${VARRUN}.pid ) ]; then
eend 0
return 0
fi
if [ -z "$IP" ]; then
eend 1 "IP is not specified in /etc/conf.d/$SVCNAME"
return 1
fi
(
export UID GID ROOT IP
$DAEMON >/dev/null 2>/dev/null &
pid=$!
sleep 1
# Check if its still running
if ! [ -d /proc/$pid ]; then
rm ${VARRUN}.pid
$DAEMON
return 1
fi
echo $pid > ${VARRUN}.pid
)
eend $?
return 0
}
stop() {
ebegin "Stopping tinydns"
start-stop-daemon --stop -m --pidfile ${VARRUN}.pid --oknodo \
--exec $DAEMON && rm ${VARRUN}.pid
eend $?
}
#!/bin/sh
case "$1" in
pre_install)
adduser -h /etc/tinydns -g tinydns -s /bin/false -H -D \
tinydns 2>/dev/null
;;
esac
exit 0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment