mirror of
https://github.com/pi-hole/pi-hole
synced 2024-12-22 23:08:07 +00:00
using loopback
This commit is contained in:
parent
a2575dabf0
commit
32246e2e15
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Address to send ads to (the RPi)
|
# Address to send ads to (the RPi)
|
||||||
piholeIP="192.168.1.101"
|
piholeIP="127.0.0.1"
|
||||||
# Config file to hold URL rules
|
# Config file to hold URL rules
|
||||||
eventHorizion="/etc/dnsmasq.d/adList.conf"
|
eventHorizion="/etc/dnsmasq.d/adList.conf"
|
||||||
|
|
||||||
@ -29,9 +29,29 @@ echo "Getting someone who cares ad list..."
|
|||||||
curl -s http://someonewhocares.org/hosts/hosts | grep -v "#" | sed '/^$/d' | sed 's/\ /\\ /g' | awk '{print $2}' >> /tmp/matter.txt
|
curl -s http://someonewhocares.org/hosts/hosts | grep -v "#" | sed '/^$/d' | sed 's/\ /\\ /g' | awk '{print $2}' >> /tmp/matter.txt
|
||||||
|
|
||||||
# Sort the aggregated results and remove any duplicates
|
# Sort the aggregated results and remove any duplicates
|
||||||
|
<<<<<<< Updated upstream
|
||||||
echo "removing duplicates and formatting to address=/<ad domain>/"$piholeIP
|
echo "removing duplicates and formatting to address=/<ad domain>/"$piholeIP
|
||||||
cat /tmp/matter.txt | sort | uniq | sed '/^$/d' | awk -v "IP=$piholeIP" '{sub(/\r$/,""); print "address=/"$0"/"IP}' > /tmp/andLight.txt
|
cat /tmp/matter.txt | sort | uniq | sed '/^$/d' | awk -v "IP=$piholeIP" '{sub(/\r$/,""); print "address=/"$0"/"IP}' > /tmp/andLight.txt
|
||||||
mv /tmp/andLight.txt $eventHorizion
|
mv /tmp/andLight.txt $eventHorizion
|
||||||
|
=======
|
||||||
|
echo "Sorting and removing duplicates..."
|
||||||
|
cat /tmp/matter.txt | sort | uniq | sed '/^$/d' > /tmp/andLight.txt
|
||||||
|
|
||||||
|
# Read the file, prepend "address=/", and append the IP of the Raspberry Pi
|
||||||
|
# This creates a correctly-formatted config file
|
||||||
|
while read fermion
|
||||||
|
do
|
||||||
|
boson=$(echo "$fermion" | tr -d '\r')
|
||||||
|
# WHITELSISTING
|
||||||
|
case $boson in
|
||||||
|
# Change these domains below to whitelist a site (will show ads)
|
||||||
|
jacobsalmela.com) echo "--------WHITELISTED $boson";;
|
||||||
|
lifehacker.com) echo "--------WHITELISTED $boson";;
|
||||||
|
*) echo "address=/$boson/$piholeIP" >> $eventHorizion;
|
||||||
|
echo "Added $boson...";;
|
||||||
|
esac
|
||||||
|
done </tmp/andLight.txt
|
||||||
|
>>>>>>> Stashed changes
|
||||||
|
|
||||||
# Restart DNS
|
# Restart DNS
|
||||||
service dnsmasq restart
|
service dnsmasq restart
|
||||||
|
Loading…
Reference in New Issue
Block a user