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
This commit is contained in:
Colin Percival 2006-05-02 05:27:30 +00:00
parent b07d272da4
commit 96b468e33b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=158245

View file

@ -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