dd-wrt adblock startup script


#ww-wrt gui Administration-Commands-Save as StartUp

#!/bin/sh
logger WAN up script executing
if test -s /tmp/hosts0
then
        rm /tmp/hosts0
fi

logger Downloading hosts file
curl -k https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts | grep 0.0.0.0 |
 sed 's/[[:space:]]*#.*$//g;' |
 grep -v localhost | tr ' ' '\t' |
 tr -s '\t' | tr -d '\015' | sort -u >/tmp/hosts0
grep addn-hosts /tmp/dnsmasq.conf ||
 echo "addn-hosts=/tmp/hosts0" >>/tmp/dnsmasq.conf
logger Restarting dnsmasq
killall dnsmasq
dnsmasq --conf-file=/tmp/dnsmasq.conf

Comments

Popular posts from this blog

Uploading Firmware to "bricked" Netgear WNDR3800 from Linux with atftp after botched DD-WRT Firmware Upgrade.

VMware Remote Console detected; unable to proceed with VMware Workstation installation.

zabbix agent on gentoo