Skip to content

Instantly share code, notes, and snippets.

@Weeker
Created September 17, 2013 14:02
Show Gist options
  • Select an option

  • Save Weeker/6594726 to your computer and use it in GitHub Desktop.

Select an option

Save Weeker/6594726 to your computer and use it in GitHub Desktop.
#!/bin/sh
logger WAN up script executing
if test -s /tmp/dnsmasq.ads
then
rm /tmp/dnsmasq.ads
fi
logger Downloading China Lazy List
wget -O - http://adblock-chinalist.googlecode.com/svn/trunk/adblock-lazy.txt |
grep ^\|\|[^\*]*\^$ |
sed -e 's:||:address\=\/:' -e 's:\^:/127\.0\.0\.1:' > /tmp/dnsmasq.ads
grep conf-file /tmp/dnsmasq.conf ||
echo -e "\nconf-file=/tmp/dnsmasq.ads" >> /tmp/dnsmasq.conf
logger Restarting dnsmasq
killall dnsmasq
dnsmasq --conf-file=/tmp/dnsmasq.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment