1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-12-22 23:08:07 +00:00

added echoes

Since this script takes a while to run, I added a bunch of echoes so you can see where it is in the process.
This commit is contained in:
Jacob Salmela 2014-10-12 11:56:43 -05:00
parent 6a8f262cc3
commit 4472885191

View File

@ -5,6 +5,7 @@ piholeIP="192.168.1.101"
eventHorizion="/etc/dnsmasq.d/adList.conf" eventHorizion="/etc/dnsmasq.d/adList.conf"
# Download the original URL to a text file for easier parsing # Download the original URL to a text file for easier parsing
echo "Getting yoyo ad list..."
curl -o /tmp/yoyo.txt -s http://pgl.yoyo.org/adservers/serverlist.php?hostformat=unixhosts&mimetype=plaintext curl -o /tmp/yoyo.txt -s http://pgl.yoyo.org/adservers/serverlist.php?hostformat=unixhosts&mimetype=plaintext
if [ -f /tmp/yoyo.txt ];then if [ -f /tmp/yoyo.txt ];then
cat /tmp/yoyo.txt | grep -v "<" | sed '/^$/d' | sed 's/\ /\\ /g' | sort > /tmp/matter.txt cat /tmp/yoyo.txt | grep -v "<" | sed '/^$/d' | sed 's/\ /\\ /g' | sort > /tmp/matter.txt
@ -13,21 +14,28 @@ else
fi fi
# Download and append other ad URLs from different sources # Download and append other ad URLs from different sources
echo "Getting winhelp2002 ad list..."
curl -s http://winhelp2002.mvps.org/hosts.txt | grep -v "#" | grep -v "127.0.0.1" | sed '/^$/d' | sed 's/\ /\\ /g' | awk '{print $2}' | sort >> /tmp/matter.txt curl -s http://winhelp2002.mvps.org/hosts.txt | grep -v "#" | grep -v "127.0.0.1" | sed '/^$/d' | sed 's/\ /\\ /g' | awk '{print $2}' | sort >> /tmp/matter.txt
echo "Getting adaway ad list..."
curl -s https://adaway.org/hosts.txt | grep -v "#" | grep -v "::1" | sed '/^$/d' | sed 's/\ /\\ /g' | awk '{print $2}' | sort >> /tmp/matter.txt curl -s https://adaway.org/hosts.txt | grep -v "#" | grep -v "::1" | sed '/^$/d' | sed 's/\ /\\ /g' | awk '{print $2}' | sort >> /tmp/matter.txt
echo "Getting hosts-file ad list..."
curl -s http://hosts-file.net/.%5Cad_servers.txt | grep -v "#" | grep -v "::1" | sed '/^$/d' | sed 's/\ /\\ /g' | awk '{print $2}' | sort >> /tmp/matter.txt curl -s http://hosts-file.net/.%5Cad_servers.txt | grep -v "#" | grep -v "::1" | sed '/^$/d' | sed 's/\ /\\ /g' | awk '{print $2}' | sort >> /tmp/matter.txt
echo "Getting malwaredomainlist ad list..."
curl -s http://www.malwaredomainlist.com/hostslist/hosts.txt | grep -v "#" | sed '/^$/d' | sed 's/\ /\\ /g' | awk '{print $2}' | sort >> /tmp/matter.txt curl -s http://www.malwaredomainlist.com/hostslist/hosts.txt | grep -v "#" | sed '/^$/d' | sed 's/\ /\\ /g' | awk '{print $2}' | sort >> /tmp/matter.txt
echo "Getting adblock.gjtech ad list..."
curl -s http://adblock.gjtech.net/?format=unix-hosts | grep -v "#" | sed '/^$/d' | sed 's/\ /\\ /g' | awk '{print $2}' | sort >> /tmp/matter.txt curl -s http://adblock.gjtech.net/?format=unix-hosts | grep -v "#" | sed '/^$/d' | sed 's/\ /\\ /g' | awk '{print $2}' | sort >> /tmp/matter.txt
# Sort the aggregated results and remove any duplicates # Sort the aggregated results and remove any duplicates
echo "Sorting and removing duplicates..."
cat /tmp/matter.txt | sort | uniq | sed '/^$/d' > /tmp/andLight.txt cat /tmp/matter.txt | sort | uniq | sed '/^$/d' > /tmp/andLight.txt
# Read the file, prepend "address=/", and append the IP of the Raspberry Pi # Read the file, prepend "address=/", and append the IP of the Raspberry Pi
# This creates a correctly-formatted config file # This creates a correctly-formatted config file
while read fermion while read fermion
do do
boson=$(echo "$fermion" | tr -d '\r') boson=$(echo "$fermion" | tr -d '\r')
echo "address=/$boson/$piholeIP" >> $eventHorizion echo "address=/$boson/$piholeIP" >> $eventHorizion
echo "Added $boson..."
done </tmp/andLight.txt done </tmp/andLight.txt
# Restart DNS # Restart DNS