1
0
mirror of https://github.com/moparisthebest/pi-hole synced 2024-11-05 00:45:08 -05:00

Merge remote-tracking branch 'upstream/master'

This commit is contained in:
rmceoin 2015-07-13 09:55:53 -07:00
commit f6ccb4b658
3 changed files with 27 additions and 5 deletions

View File

@ -17,6 +17,16 @@ On a clean installation of Raspbian, you can run this command to **auto-install
## Gravity
The [gravity.sh](https://github.com/jacobsalmela/pi-hole/blob/master/gravity.sh) does most of the magic. The script pulls in ad domains from many sources and compiles them into a single list of [over 900,000 entries](http://jacobsalmela.com/block-millions-ads-network-wide-with-a-raspberry-pi-hole-2-0).
## Custom Config File
If you want to use your own variables for the gravity script (i.e. storing the files in a different location) and don't want to have to change them every time there is an update to the script, create a file called `/etc/pihole/pihole.conf`. In it, you should add your own variables in a similar fashion as shown below:
```
origin=/var/run/pihole
adList=/etc/dnsmasq.d/adList
```
See [this PR](https://github.com/jacobsalmela/pi-hole/pull/20) for more details.
## Whitelist and blacklist
You can add a `whitelist.txt` or `blacklist.txt` in `/etc/pihole/` and the script will apply those files automatically.

View File

@ -24,6 +24,19 @@ echo " Press Enter when ready "
echo " "
read
if [[ -f /etc/dnsmasq.d/adList.conf ]];then
echo "Original Pi-hole detected. Initiating sub space transport..."
sudo mkdir -p /etc/pihole/original/
mv /etc/dnsmasq.d/adList.conf /etc/pihole/original/adList.conf.$(date "+%Y-%m-%d")
mv /etc/dnsmasq.conf /etc/pihole/original/dnsmasq.conf.$(date "+%Y-%m-%d")
mv /etc/resolv.conf /etc/pihole/original/resolv.conf.$(date "+%Y-%m-%d")
mv /etc/lighttpd/lighttpd.conf /etc/pihole/original/lighttpd.conf.$(date "+%Y-%m-%d")
mv /var/www/pihole/index.html /etc/pihole/original/index.html.$(date "+%Y-%m-%d")
mv /usr/local/bin/gravity.sh /etc/pihole/original/gravity.sh.$(date "+%Y-%m-%d")
else
:
fi
echo "Updating the Pi..."
sudo apt-get update
sudo apt-get -y upgrade

View File

@ -19,10 +19,9 @@ sources=('https://adaway.org/hosts.txt'
adList=/etc/hosts
origin=/etc/pihole
piholeDir=/etc/pihole
if [[ -f $piholeDir/pihole.conf ]]; then
if [[ -f $piholeDir/pihole.conf ]];then
. $piholeDir/pihole.conf
fi
justDomainsExtension=domains
matter=pihole.0.matter.txt
andLight=pihole.1.andLight.txt
@ -55,7 +54,7 @@ do
saveLocation=$origin/"list"."$i"."$domain"
# Use a case statement to download lists that need special cURL commands to complete properly
case "$domain" in
case "$domain" in
"adblock.mahakala.is") data=$(curl -s -A 'Mozilla/5.0 (X11; Linux x86_64; rv:30.0) Gecko/20100101 Firefox/30.0' -e http://forum.xda-developers.com/ -z $saveLocation."$justDomainsExtension" "${sources[$i]}");;
"pgl.yoyo.org") data=$(curl -s -d mimetype=plaintext -d hostformat=hosts -z $saveLocation."$justDomainsExtension" "${sources[$i]}");;
@ -75,7 +74,7 @@ do
fi
done
# Find all files with the .domains extension and compile them into one file
# Find all files with the .domains extension and compile them into one file and remove CRs
echo "** Aggregating list of domains..."
find $origin/ -type f -name "*.$justDomainsExtension" -exec cat {} \; | tr -d '\r' > $origin/$matter
@ -106,7 +105,7 @@ function gravity_advanced()
echo "::1 localhost" | cat - $origin/$accretionDisc > $origin/latent.$accretionDisc && mv $origin/latent.$accretionDisc $origin/$accretionDisc
echo "255.255.255.255 broadcasthost" | cat - $origin/$accretionDisc > $origin/latent.$accretionDisc && mv $origin/latent.$accretionDisc $origin/$accretionDisc
echo "127.0.0.1 localhost" | cat - $origin/$accretionDisc > $origin/latent.$accretionDisc && mv $origin/latent.$accretionDisc $origin/$accretionDisc
echo "127.0.0.1 raspberrypi" | cat - $origin/$accretionDisc > $origin/latent.$accretionDisc && mv $origin/latent.$accretionDisc $origin/$accretionDisc
echo "127.0.0.1 $(hostname)" | cat - $origin/$accretionDisc > $origin/latent.$accretionDisc && mv $origin/latent.$accretionDisc $origin/$accretionDisc
# Copy the file so dnsmasq can use it
sudo cp $origin/$accretionDisc $adList
}