summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimo Teras <timo.teras@iki.fi>2010-04-19 11:24:45 +0300
committerNatanael Copa <ncopa@alpinelinux.org>2010-04-22 09:45:35 +0000
commit6afcbebe2296d04c6929a2f6806f7e9dc199919f (patch)
tree38b3d6a8c4469f49a3ac95ee7baa7b62cca8d518
parent530f484d3f86d1864b2ad9bb6c1ca6a7238fce0f (diff)
downloadaports-6afcbebe2296d04c6929a2f6806f7e9dc199919f.tar.bz2
aports-6afcbebe2296d04c6929a2f6806f7e9dc199919f.tar.xz
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 Teras <timo.teras@iki.fi> Signed-off-by: Natanael Copa <ncopa@alpinelinux.org> (cherry picked from commit fbea38f9a65456f1e7e08630201c5e8caea72ed2)
-rw-r--r--main/djbdns/APKBUILD28
-rw-r--r--main/djbdns/dnscache.confd2
-rwxr-xr-xmain/djbdns/dnscache.initd4
-rwxr-xr-xmain/djbdns/dnscache.monthly48
-rwxr-xr-xmain/djbdns/tinydns.initd4
5 files changed, 76 insertions, 10 deletions
diff --git a/main/djbdns/APKBUILD b/main/djbdns/APKBUILD
index cfb71005..a9895c23 100644
--- a/main/djbdns/APKBUILD
+++ b/main/djbdns/APKBUILD
@@ -1,12 +1,12 @@
# 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"
diff --git a/main/djbdns/dnscache.confd b/main/djbdns/dnscache.confd
index f456bf8d..e5312812 100644
--- a/main/djbdns/dnscache.confd
+++ b/main/djbdns/dnscache.confd
@@ -20,4 +20,6 @@ IP=127.0.0.1
# FORWARDONLY - servers/@ are parent caches, not root servers
#FORWARDONLY=
+# UPDATEHINTS - refresh zone hints
+UPDATEHINTS=1
diff --git a/main/djbdns/dnscache.initd b/main/djbdns/dnscache.initd
index 3e88e3a4..37d9d9ba 100755
--- a/main/djbdns/dnscache.initd
+++ b/main/djbdns/dnscache.initd
@@ -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
diff --git a/main/djbdns/dnscache.monthly b/main/djbdns/dnscache.monthly
new file mode 100755
index 00000000..0bd5a853
--- /dev/null
+++ b/main/djbdns/dnscache.monthly
@@ -0,0 +1,48 @@
+#!/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
diff --git a/main/djbdns/tinydns.initd b/main/djbdns/tinydns.initd
index ab15ffe3..8dfc5393 100755
--- a/main/djbdns/tinydns.initd
+++ b/main/djbdns/tinydns.initd
@@ -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