aboutsummaryrefslogtreecommitdiffstats
path: root/main/unbound/update-unbound-root-hints
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2011-12-02 15:01:25 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2011-12-02 15:01:25 +0000
commit47bb2a62b5d584ca4a2e7228aa72a58fe1919f15 (patch)
treee935195fd0f5041a7ddc3a584f634ac56def3ff0 /main/unbound/update-unbound-root-hints
parent6554dce65a5d32c68a77484323c0450df8a613a0 (diff)
downloadaports-47bb2a62b5d584ca4a2e7228aa72a58fe1919f15.tar.bz2
aports-47bb2a62b5d584ca4a2e7228aa72a58fe1919f15.tar.xz
main/unbound: update root.hints by default
ref #848
Diffstat (limited to 'main/unbound/update-unbound-root-hints')
-rw-r--r--main/unbound/update-unbound-root-hints30
1 files changed, 30 insertions, 0 deletions
diff --git a/main/unbound/update-unbound-root-hints b/main/unbound/update-unbound-root-hints
new file mode 100644
index 0000000000..ee127ded37
--- /dev/null
+++ b/main/unbound/update-unbound-root-hints
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+check_format() {
+ # check that we have some ipv4 addresses and some '.' hints
+ egrep -q '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]' "$1" \
+ && egrep -q '^\.[[:space:]]+' "$1"
+}
+
+ftphosts="FTP.INTERNIC.NET RS.INTERNIC.NET"
+roothints=domain/named.cache
+unbound_dir=/etc/unbound
+outfile=$unbound_dir/root.hints
+
+if [ "$1" = "--verify" ]; then
+ if check_format $outfile; then
+ echo "$outfile: ok"
+ exit 0
+ else
+ echo "$outfile: failed"
+ exit 1
+ fi
+fi
+
+for host in $ftphosts; do
+ url=ftp://$host/$roothints
+ if wget -q -O ${outfile}.new $url && check_format ${outfile}.new; then
+ mv ${outfile}.new $outfile && exit 0
+ fi
+done
+exit 1