mirror of
https://github.com/moparisthebest/pi-hole
synced 2024-11-11 20:05:02 -05:00
Merge pull request #2 from dschaper/ConflictBreaker
Resolve merge conflicts
This commit is contained in:
commit
b895235ec1
16
gravity.sh
16
gravity.sh
@ -1,11 +1,18 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# http://pi-hole.net
|
# http://pi-hole.net
|
||||||
# Compiles a list of ad-serving domains by downloading them from multiple sources
|
# Compiles a list of ad-serving domains by downloading them from multiple sources
|
||||||
|
piholeIPfile=/tmp/piholeIP
|
||||||
# This script should only be run after you have a static IP address set on the Pi
|
if [[ -f $piholeIPfile ]];then
|
||||||
piholeIP=$(hostname -I)
|
# If the file exists, it means it was exported from the installation script and we should use that value instead of detecting it in this script
|
||||||
|
piholeIP=$(cat $piholeIPfile)
|
||||||
|
rm $piholeIPfile
|
||||||
|
else
|
||||||
|
# Otherwise, the IP address can be taken directly from the machine, which will happen when the script is run by the user and not the installation script
|
||||||
|
piholeIP=$(ip -4 addr show | awk '{match($0,/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/); ip = substr($0,RSTART,RLENGTH); print ip}' | sed '/^\s*$/d' | grep -v "127.0.0.1")
|
||||||
|
fi
|
||||||
|
|
||||||
# Ad-list sources--one per line in single quotes
|
# Ad-list sources--one per line in single quotes
|
||||||
|
# The mahakala source is commented out due to many users having issues with it blocking legitimate domains. Uncomment at your own risk
|
||||||
sources=('https://adaway.org/hosts.txt'
|
sources=('https://adaway.org/hosts.txt'
|
||||||
'http://adblock.gjtech.net/?format=unix-hosts'
|
'http://adblock.gjtech.net/?format=unix-hosts'
|
||||||
#'http://adblock.mahakala.is/'
|
#'http://adblock.mahakala.is/'
|
||||||
@ -129,8 +136,7 @@ function gravity_advanced() {
|
|||||||
|
|
||||||
# Format domain list as "192.168.x.x domain.com"
|
# Format domain list as "192.168.x.x domain.com"
|
||||||
echo "** Formatting domains into a HOSTS file..."
|
echo "** Formatting domains into a HOSTS file..."
|
||||||
awk '{print "'"$piholeIP"'" $1}' $origin/$eventHorizon > $origin/$accretionDisc
|
cat $origin/$eventHorizon | awk '{sub(/\r$/,""); print "'"$piholeIP"' " $0}' > $origin/$accretionDisc
|
||||||
|
|
||||||
# Copy the file over as /etc/pihole/gravity.list so dnsmasq can use it
|
# Copy the file over as /etc/pihole/gravity.list so dnsmasq can use it
|
||||||
sudo cp $origin/$accretionDisc $adList
|
sudo cp $origin/$accretionDisc $adList
|
||||||
kill -HUP $(pidof dnsmasq)
|
kill -HUP $(pidof dnsmasq)
|
||||||
|
Loading…
Reference in New Issue
Block a user