diff options
author | cperciva <cperciva@FreeBSD.org> | 2006-05-02 05:27:30 +0000 |
---|---|---|
committer | cperciva <cperciva@FreeBSD.org> | 2006-05-02 05:27:30 +0000 |
commit | d8e06a4a6ad69000a6a4f92a0bbeec479ad69115 (patch) | |
tree | ce36823a117939f76517b4f4d0d69648a8207131 /usr.sbin | |
parent | de96782b7f89ef0cdaea440795046179c7aab9ed (diff) | |
download | FreeBSD-src-d8e06a4a6ad69000a6a4f92a0bbeec479ad69115.zip FreeBSD-src-d8e06a4a6ad69000a6a4f92a0bbeec479ad69115.tar.gz |
Teach portsnap to parse the output of the host(1) in BIND 8 as well as
the host(1) from BIND 9. This doesn't matter for HEAD, but will help
people who install portsnap from the ports tree onto older versions of
FreeBSD.
PR: ports/93901
Sponsored by: FreeBSD security development fundraiser
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/portsnap/portsnap/portsnap.sh | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.sbin/portsnap/portsnap/portsnap.sh b/usr.sbin/portsnap/portsnap/portsnap.sh index d70d7b3..bcf2efc 100644 --- a/usr.sbin/portsnap/portsnap/portsnap.sh +++ b/usr.sbin/portsnap/portsnap/portsnap.sh @@ -326,9 +326,13 @@ fetch_pick_server() { echo -n "Looking up ${SERVERNAME} mirrors..." # Issue the SRV query and pull out the Priority, Weight, and Target fields. - host -t srv "_http._tcp.${SERVERNAME}" | - grep -E "^_http._tcp.${SERVERNAME} has SRV record" | - cut -f 5,6,8 -d ' ' | sed -e 's/\.$//' > serverlist +# BIND 9 prints "$name has SRV record ..." while BIND 8 prints +# "$name server selection ..."; we allow either format. + MLIST="_http._tcp.${SERVERNAME}" + host -t srv "${MLIST}" | + sed -nE "s/${MLIST} (has SRV record|server selection) //p" | + cut -f 1,2,4 -d ' ' | + sed -e 's/\.$//' > serverlist # If no records, give up -- we'll just use the server name we were given. if [ `wc -l < serverlist` -eq 0 ]; then |