Merge branch 'development'

Conflicts:
	automated install/uninstall.sh
This commit is contained in:
nate 2016-03-31 20:25:54 -05:00
commit 28f2a1309e
8 changed files with 29 additions and 17 deletions

View File

@ -8,4 +8,4 @@ Changes proposed in this pull request:
- -
@pihole/gravity @pi-hole/gravity

View File

@ -29,6 +29,7 @@ reddit: [/r/pihole](https://www.reddit.com/r/pihole/)
[![Pi-hole exlplained](http://i.imgur.com/qNybJDX.png)](https://vimeo.com/135965232) [![Pi-hole exlplained](http://i.imgur.com/qNybJDX.png)](https://vimeo.com/135965232)
## Pi-hole Projects ## Pi-hole Projects
- [Get LED alerts for each blocked ad](http://www.stinebaugh.info/get-led-alerts-for-each-blocked-ad-using-pi-hole/)
- [Pi-hole on Ubuntu 14.04 on VirtualBox](http://hbalagtas.blogspot.com/2016/02/adblocking-with-pi-hole-and-ubuntu-1404.html) - [Pi-hole on Ubuntu 14.04 on VirtualBox](http://hbalagtas.blogspot.com/2016/02/adblocking-with-pi-hole-and-ubuntu-1404.html)
- [x86 Docker container that runs Pi-hole](https://hub.docker.com/r/diginc/pi-hole/) - [x86 Docker container that runs Pi-hole](https://hub.docker.com/r/diginc/pi-hole/)
- [Splunk: Pi-hole Visualizser](https://splunkbase.splunk.com/app/3023/) - [Splunk: Pi-hole Visualizser](https://splunkbase.splunk.com/app/3023/)
@ -41,6 +42,7 @@ reddit: [/r/pihole](https://www.reddit.com/r/pihole/)
- [Minibian Pi-hole](http://munkjensen.net/wiki/index.php/See_my_Pi-Hole#Minibian_Pi-hole) - [Minibian Pi-hole](http://munkjensen.net/wiki/index.php/See_my_Pi-Hole#Minibian_Pi-hole)
## Coverage ## Coverage
- [TekThing: 5 fun, easy projects for a Raspberry Pi](https://youtu.be/QwrKlyC2kdM?t=1m42s)
- [Pi-hole on Adafruit's blog](https://blog.adafruit.com/2016/03/04/pi-hole-is-a-black-hole-for-internet-ads-piday-raspberrypi-raspberry_pi/) - [Pi-hole on Adafruit's blog](https://blog.adafruit.com/2016/03/04/pi-hole-is-a-black-hole-for-internet-ads-piday-raspberrypi-raspberry_pi/)
- [The Defrag Show - MSDN/Channel 9](https://channel9.msdn.com/Shows/The-Defrag-Show/Defrag-Endoscope-USB-Camera-The-Final-HoloLens-Vote-Adblock-Pi-and-more?WT.mc_id=dlvr_twitter_ch9#time=20m39s) - [The Defrag Show - MSDN/Channel 9](https://channel9.msdn.com/Shows/The-Defrag-Show/Defrag-Endoscope-USB-Camera-The-Final-HoloLens-Vote-Adblock-Pi-and-more?WT.mc_id=dlvr_twitter_ch9#time=20m39s)
- [MacObserver Podcast 585](http://www.macobserver.com/tmo/podcast/macgeekgab-585) - [MacObserver Podcast 585](http://www.macobserver.com/tmo/podcast/macgeekgab-585)

6
advanced/Scripts/piholeDebug.sh Normal file → Executable file
View File

@ -118,7 +118,7 @@ function testNslookup {
### Check Pi internet connections ### ### Check Pi internet connections ###
# Log the IP addresses of this Pi # Log the IP addresses of this Pi
IPADDR=$(ifconfig | perl -nle 's/dr:(\S+)/print $1/e') IPADDR=$($SUDO ifconfig | perl -nle 's/dr:(\S+)/print $1/e')
echo "::: Writing local IPs to debug log" echo "::: Writing local IPs to debug log"
echo "IP Addresses of this Pi:" >> $DEBUG_LOG echo "IP Addresses of this Pi:" >> $DEBUG_LOG
echo "$IPADDR" >> $DEBUG_LOG echo "$IPADDR" >> $DEBUG_LOG
@ -258,8 +258,8 @@ then
cat "$ADLISTSFILE" >> $DEBUG_LOG cat "$ADLISTSFILE" >> $DEBUG_LOG
echo >> $DEBUG_LOG echo >> $DEBUG_LOG
else else
echo "No adlists.list file found!" >> $DEBUG_LOG echo "No adlists.list file found... using adlists.default!" >> $DEBUG_LOG
printf ":::\tNo adlists.list file found!\n" printf ":::\tNo adlists.list file found... using adlists.default!\n"
fi fi

1
advanced/index.js Normal file
View File

@ -0,0 +1 @@
var x = "Pi-hole: A black hole for Internet advertisements."

View File

@ -53,4 +53,6 @@ $HTTP["url"] =~ "^/admin/" {
$HTTP["url"] =~ "^(?!/admin)/.*" { $HTTP["url"] =~ "^(?!/admin)/.*" {
# Create a response header for debugging using curl -I # Create a response header for debugging using curl -I
setenv.add-response-header = ( "X-Pi-hole" => "A black hole for Internet advertisements." ) setenv.add-response-header = ( "X-Pi-hole" => "A black hole for Internet advertisements." )
# rewrite only js requests
url.rewrite = ("(.*).js" => "pihole/index.js")
} }

View File

@ -115,12 +115,12 @@ welcomeDialogs() {
verifyFreeDiskSpace() { verifyFreeDiskSpace() {
# 25MB is the minimum space needed (20MB install + 5MB one day of logs.) # 50MB is the minimum space needed (45MB install (includes web admin bootstrap/jquery libraries etc) + 5MB one day of logs.)
requiredFreeBytes=51200 requiredFreeBytes=51200
existingFreeBytes=$(df -lk / 2>&1 | awk '{print $4}' | head -2 | tail -1) existingFreeBytes=`df -lk / 2>&1 | awk '{print $4}' | head -2 | tail -1`
if ! [[ "$existingFreeBytes" =~ ^([0-9])+$ ]]; then if ! [[ "$existingFreeBytes" =~ ^([0-9])+$ ]]; then
existingFreeBytes=$(df -lk /dev 2>&1 | awk '{print $4}' | head -2 | tail -1) existingFreeBytes=`df -lk /dev 2>&1 | awk '{print $4}' | head -2 | tail -1`
fi fi
if [[ $existingFreeBytes -lt $requiredFreeBytes ]]; then if [[ $existingFreeBytes -lt $requiredFreeBytes ]]; then
@ -633,8 +633,8 @@ installPiholeWeb() {
else else
printf "\n:::\tNo default index.lighttpd.html file found... not backing up" printf "\n:::\tNo default index.lighttpd.html file found... not backing up"
fi fi
$SUDO cp /etc/.pihole/advanced/index.html /var/www/html/pihole/index.html $SUDO cp /etc/.pihole/advanced/index.* /var/www/html/pihole/.
$SUDO echo "::: done!" $SUDO echo " done!"
fi fi
} }

10
automated install/uninstall.sh Executable file → Normal file
View File

@ -114,7 +114,17 @@ function removeNoPurge {
$SUDO mv /etc/lighttpd/lighttpd.conf.orig /etc/lighttpd/lighttpd.conf $SUDO mv /etc/lighttpd/lighttpd.conf.orig /etc/lighttpd/lighttpd.conf
fi fi
fi fi
$SUDO rm /usr/local/bin/gravity.sh &> /dev/null
$SUDO rm /usr/local/bin/chronometer.sh &> /dev/null
$SUDO rm /usr/local/bin/whitelist.sh &> /dev/null
$SUDO rm /usr/local/bin/blacklist.sh &> /dev/null
$SUDO rm /usr/local/bin/piholeLogFlush.sh &> /dev/null
$SUDO rm /usr/local/bin/piholeDebug.sh &> /dev/null
$SUDO rm /usr/local/bin/updateDashboard.sh &> /dev/null
$SUDO rm /usr/local/bin/uninstall.sh &> /dev/null
$SUDO rm /etc/dnsmasq.d/adList.conf &> /dev/null $SUDO rm /etc/dnsmasq.d/adList.conf &> /dev/null
$SUDO rm /etc/dnsmasq.d/01-pihole.conf &> /dev/null
$SUDO rm -rf /var/log/*pihole* &> /dev/null $SUDO rm -rf /var/log/*pihole* &> /dev/null
$SUDO rm -rf /etc/pihole/ &> /dev/null $SUDO rm -rf /etc/pihole/ &> /dev/null
$SUDO rm -rf /etc/.pihole/ &> /dev/null $SUDO rm -rf /etc/.pihole/ &> /dev/null

View File

@ -170,9 +170,6 @@ function gravity_transport() {
fi fi
# Silently curl url # Silently curl url
curl -s $cmd_ext $heisenbergCompensator -A "$agent" $url > $patternBuffer
# Check for list updates
gravity_patternCheck $patternBuffer
curl -s "$cmd_ext" "$heisenbergCompensator" -A "$agent" "$url" > "$patternBuffer" curl -s "$cmd_ext" "$heisenbergCompensator" -A "$agent" "$url" > "$patternBuffer"
# Check for list updates # Check for list updates
gravity_patternCheck "$patternBuffer" gravity_patternCheck "$patternBuffer"
@ -225,7 +222,7 @@ function gravity_Schwarzchild() {
truncate -s 0 $piholeDir/$matterandlight & spinner $! truncate -s 0 $piholeDir/$matterandlight & spinner $!
for i in "${activeDomains[@]}" for i in "${activeDomains[@]}"
do do
"$i" |tr -d '\r' >> $piholeDir/$matterandlight cat "$i" | tr -d '\r' >> $piholeDir/$matterandlight
done done
echo " done!" echo " done!"
@ -285,12 +282,12 @@ function gravity_hostFormat() {
if [[ -n $piholeIPv6 ]];then if [[ -n $piholeIPv6 ]];then
#Add dummy domain Pi-Hole.IsWorking.OK to the top of gravity.list to make ping result return a friendlier looking domain! #Add dummy domain Pi-Hole.IsWorking.OK to the top of gravity.list to make ping result return a friendlier looking domain!
echo -e "$piholeIP Pi-Hole.IsWorking.OK \n$piholeIPv6 Pi-Hole.IsWorking.OK" > $piholeDir/$accretionDisc echo -e "$piholeIP Pi-Hole.IsWorking.OK \n$piholeIPv6 Pi-Hole.IsWorking.OK" > $piholeDir/$accretionDisc
$piholeDir/$eventHorizon | awk -v ipv4addr="$piholeIP" -v ipv6addr="$piholeIPv6" '{sub(/\r$/,""); print ipv4addr" "$0"\n"ipv6addr" "$0}' >> $piholeDir/$accretionDisc cat $piholeDir/$eventHorizon | awk -v ipv4addr="$piholeIP" -v ipv6addr="$piholeIPv6" '{sub(/\r$/,""); print ipv4addr" "$0"\n"ipv6addr" "$0}' >> $piholeDir/$accretionDisc
else else
# Otherwise, just create gravity.list as normal using IPv4 # Otherwise, just create gravity.list as normal using IPv4
#Add dummy domain Pi-Hole.IsWorking.OK to the top of gravity.list to make ping result return a friendlier looking domain! #Add dummy domain Pi-Hole.IsWorking.OK to the top of gravity.list to make ping result return a friendlier looking domain!
echo -e "$piholeIP Pi-Hole.IsWorking.OK" > $piholeDir/$accretionDisc echo -e "$piholeIP Pi-Hole.IsWorking.OK" > $piholeDir/$accretionDisc
$piholeDir/$eventHorizon | awk -v ipv4addr="$piholeIP" '{sub(/\r$/,""); print ipv4addr" "$0}' >> $piholeDir/$accretionDisc cat $piholeDir/$eventHorizon | awk -v ipv4addr="$piholeIP" '{sub(/\r$/,""); print ipv4addr" "$0}' >> $piholeDir/$accretionDisc
fi fi
# 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
cp $piholeDir/$accretionDisc $adList cp $piholeDir/$accretionDisc $adList