Skip to content

Instantly share code, notes, and snippets.

@stickystyle
Created March 31, 2015 20:47
Show Gist options
  • Save stickystyle/31d3e26a813f8413a8ee to your computer and use it in GitHub Desktop.
Save stickystyle/31d3e26a813f8413a8ee to your computer and use it in GitHub Desktop.
lookup the apt-proxy server by its zeroconf srv record
#!/bin/sh
dig +nocmd +noall +answer @224.0.0.251 -p 5353 -t ptr _apt_proxy._tcp.local > /tmp/aptproxy
APTPROXY_HOST=$(grep "IN\sA\s" /tmp/aptproxy | awk '{print $5}')
APTPROXY_PORT=$(grep "IN\sSRV" /tmp/aptproxy | awk '{print $7}')
echo "Acquire::http::Proxy \"http://$APTPROXY_HOST:$APTPROXY_PORT\";" > /etc/apt/apt.conf.d/30proxy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment