core/dnssec-anchors/PKGBUILD
2014-10-08 11:55:50 -04:00

39 lines
1.2 KiB
Bash

#
# Maintainer: Weng Xuetian <wengxt@gmail.com>
# Contributor: Gaetan Bisson <bisson@archlinux.org>
# Contributor: Thomas Mudrunka <harvie@email.cz>
# Contributor: m4xm4n <max@maxfierke.com>
pkgname=dnssec-anchors
pkgver=20141008
pkgrel=1
pkgdesc='DNSSEC trust anchors for the root zone'
url='http://data.iana.org/root-anchors/'
license=('custom:NoCopyright')
arch=('any')
source=('LICENSE'
'trusted-key.key')
sha256sums=('dd37e92942d5a4024f1c77df49d61ca77fc6284691814903a741785df61f78cb'
'1fa004d34051182762f1f238268040170dc44c1c242ff7df35ffa39c845c58d9')
get_trusted-key() {
drill -z -s DNSKEY . > root.key
curl http://data.iana.org/root-anchors/root-anchors.xml |
awk 'BEGIN{ORS=" "}(NR>4){gsub(/<[^>]*>/,"");print tolower($0)}' |
sed 's/ /\n/' > root.ds
# Any of those tests failing is suspicious; check thoroughly!
[[ "$(<root.ds)" = '19036 8 2 49aac11d7b6f6446702e54a1607371607a1a41855200fd2ce1cdde32f24e8fb5' ]] &&
grep -Pq 'IN\tDS\t'"$(<root.ds)" root.key ||
return 1
sed '/DNSKEY/s/ ;{id = '"$(cut -d\ -f1<root.ds)"' .*//;t;d' root.key > trusted-key.key
}
package() {
cd "${srcdir}"
install -Dm644 trusted-key.key "${pkgdir}"/etc/trusted-key.key
install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}