Ubuntu

Comment 8 for bug 686265

Carl Karsten (carlfk) wrote :

So I don't have to go look it up again:

/usr/share/squid-deb-proxy-client/apt-avahi-discover
#!/bin/sh
#
# use avahi to find a _apt_proxy._tcp provider and return
# a http proxy string suitable for apt

SERVICE="_apt_proxy._tcp"

out=$(avahi-browse -kprt $SERVICE|grep '^=;.*;IPv4;.*'|head -n1)
IP=$(echo "$out"|cut -d';' -f8)
PORT=$(echo "$out"|cut -d';' -f9)
echo "http://$IP:$PORT/"