tinydns/update6_djbdns_roots.sh
2017-02-21 02:35:57 +01:00

32 lines
800 B
Bash
Executable File

#!/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ipv6=false
[ -n "`which dnsip6`" ] && ipv6=true
if [ -f /etc/dnsroots.global ] ; then
if [ ! -f /etc/dnsroots.global.ORIG ] ; then
cp /etc/dnsroots.global /etc/dnsroots.global.ORIG
fi
fi
root_servers=`dnsqr ns . | awk '/answer:/ { print $5; }' | sort`
> /etc/dnsroots.global
for server in $root_servers ; do
echo "`dnsip $server`" >> /etc/dnsroots.global
if $ipv6 ; then
ip6=`dnsqr aaaa $server | awk '/answer:/ { print $5; }'`
if [ -n "$ip6" ] ; then
echo "$ip6" >> /etc/dnsroots.global
fi
fi
done
cp /etc/dnsroots.global /service/dnscache/root/servers/@
cp /etc/dnsroots.global /service/dnscache6/root/servers/@
svc -du /service/dnscache
svc -du /service/dnscache6