Commit fbea38f9 authored by Timo Teräs's avatar Timo Teräs Committed by Natanael Copa

main/djbdns: periodic script to update zone hints

This also splits the djbdns to djbdns-common that contains the
few utilities needed by the periodic script. Minor fix to init.d
script included also.
Signed-off-by: Timo Teräs's avatarTimo Teras <timo.teras@iki.fi>
Signed-off-by: Natanael Copa's avatarNatanael Copa <ncopa@alpinelinux.org>
parent 236a35dd
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=djbdns
pkgver=1.05
pkgrel=32
pkgrel=33
pkgdesc="Excellent high-performance DNS services"
url="http://cr.yp.to/djbdns.html"
license="public-domain"
depends=
subpackages="tinydns dnscache"
subpackages="djbdns-common tinydns dnscache"
source="http://cr.yp.to/djbdns/$pkgname-$pkgver.tar.gz
headtail.patch
dnsroots.patch
......@@ -20,6 +20,7 @@ source="http://cr.yp.to/djbdns/$pkgname-$pkgver.tar.gz
dnscache.pre-install
dnscache.initd
dnscache.confd
dnscache.monthly
"
build() {
......@@ -44,9 +45,19 @@ build() {
mkdir -p "$pkgdir"/usr/share/doc/djbdns
}
common() {
pkgdesc="Base utilities of djbdns"
replaces="djbdns"
mkdir -p "$subpkgdir"/usr/bin
mv "$pkgdir"/usr/bin/dnsq "$subpkgdir"/usr/bin
mv "$pkgdir"/usr/bin/dnsip "$subpkgdir"/usr/bin
}
tinydns() {
pkgdesc="A small and secure DNS server"
install=tinydns.pre-install
mkdir -p "$subpkgdir"/usr/bin "$subpkgdir"/etc/tinydns \
"$subpkgdir"/var/cache/tinydns
mv "$pkgdir"/usr/bin/tinydns* "$subpkgdir"/usr/bin
......@@ -59,6 +70,8 @@ tinydns() {
dnscache() {
pkgdesc="A recursive resolver"
install=dnscache.pre-install
depends=djbdns-common
mkdir -p "$subpkgdir"/usr/bin \
"$subpkgdir"/etc/dnscache/ip \
"$subpkgdir"/etc/dnscache/servers
......@@ -71,8 +84,10 @@ dnscache() {
"$subpkgdir"/etc/init.d/dnscache
install -D -m644 "$srcdir"/dnscache.confd \
"$subpkgdir"/etc/conf.d/dnscache
install -D -m755 "$srcdir"/dnscache.monthly \
"$subpkgdir"/etc/periodic/monthly/dnscache-hints-refresh
}
md5sums="3147c5cd56832aa3b41955c7a51cbeb2 djbdns-1.05.tar.gz
0d2adaf9f1626043e8702b825cdccdd6 headtail.patch
7565048ebc981238879122c7f88cc143 dnsroots.patch
......@@ -81,8 +96,9 @@ adb6745606cae593eb5ea6870fc27bd4 djbdns-1.05-jumbo-josb.patch
c7be73fe2fb4ae02d5096fa2c1f55a68 1.05-errno.patch
1292500c04baba3995d9753fe40fdc94 1.05-response.patch
7695bf50559c09798ec852b578ac8698 tinydns.pre-install
3f4cd61c41f760c3007a8b09a4da091f tinydns.initd
fe48165a920cf843ceb9a4ee50bf74c0 tinydns.initd
7dcf6674c07d46c736b3c25d9c92384a tinydns.confd
e09c3a6ba6917e16f4736ab5c070dbe9 dnscache.pre-install
ec15af30819b9e146f86223753b367a0 dnscache.initd
e2938593277d7a87806e70e145a90c3f dnscache.confd"
e5cada3b032da84c4a0e41ef8b3108cb dnscache.initd
2b3d02e88f70603c760bf368ab3ed636 dnscache.confd
6253f44f042fc5aa31fd182780d9853c dnscache.monthly"
......@@ -20,4 +20,6 @@ IP=127.0.0.1
# FORWARDONLY - servers/@ are parent caches, not root servers
#FORWARDONLY=
# UPDATEHINTS - refresh zone hints
UPDATEHINTS=1
......@@ -17,8 +17,8 @@ depend() {
# Main program
start() {
UID=$( grep dnscache /etc/passwd | cut -f3 -d: )
GID=$( grep dnscache /etc/group | cut -f3 -d: )
UID=$(id -u dnscache)
GID=$(id -g dnscache)
ebegin "Starting dnscache"
if [ -z "$UID" ] || [ -z "$GID" ]; then
......
#!/bin/sh
if [ -f ./etc/conf.d/dnscache ]; then
. /etc/conf.d/dnscache
fi
if [ -z "$UPDATEHINTS" ]; then
exit 0
fi
cd /etc/dnscache/servers
NEEDRESTART=
ZONES=`ls /etc/dnscache/servers`
for ZONEFILE in $ZONES; do
# Convert symlinks to copies, so we can update it
ZONE="$ZONEFILE"
if [ -L $ZONEFILE ]; then
DST="`readlink "$ZONEFILE"`"
cp -f "$DST" "$ZONEFILE"
fi
if [ "$ZONE" == "@" ]; then
ZONE="."
fi
if [ "$ZONE" != "." -o "$FORWARDONLY" = "" ]; then
TMPF=`mktemp -t`
# Refresh zone info
dnsqr ns $ZONE | awk '/^answer: ./ { print $5 }' | sort -u | xargs dnsip > $TMPF
grep "^$" $TMPF 1> /dev/null
if [ $? != 0 ]; then
cmp -s $ZONEFILE $TMPF
if [ "$?" != 0 ]; then
NEEDRESTART=yes
cat $TMPF > $ZONEFILE
fi
fi
rm $TMPF
fi
done
if [ "$NEEDRESTART" ] && /etc/init.d/dnscache --quiet status; then
/etc/init.d/dnscache restart
fi
exit 0
......@@ -29,8 +29,8 @@ fi
# Main program
reload() {
local rc opwd="$opwd"
UID=$( grep tinydns /etc/passwd | cut -f3 -d: )
GID=$( grep tinydns /etc/group | cut -f3 -d: )
UID=$(id -u tinydns)
GID=$(id -g tinydns)
# Create the $ROOT directory if necessary
if [ ! -d "$ROOT" ]; then
......
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