From fcf3b4e4e2625327e27f679c144d315e31193e6e Mon Sep 17 00:00:00 2001 From: jacobsalmela Date: Sat, 23 Jan 2016 11:48:12 -0600 Subject: [PATCH 01/32] file to set lcd font size --- advanced/console-setup | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 advanced/console-setup diff --git a/advanced/console-setup b/advanced/console-setup new file mode 100644 index 00000000..f12be6eb --- /dev/null +++ b/advanced/console-setup @@ -0,0 +1,17 @@ +# CONFIGURATION FILE FOR SETUPCON + +# Consult the console-setup(5) manual page. + +ACTIVE_CONSOLES="/dev/tty[1-6]" + +CHARMAP="UTF-8" + +# For best results with the Adafruit 2.8 LCD and Pi-hole's chronometer +CODESET="guess" +FONTFACE="Terminus" +FONTSIZE="10x20" + +VIDEOMODE= + +# The following is an example how to use a braille font +# FONT='lat9w-08.psf.gz brl-8x8.psf' From 71fd32b1f4396b34230e975ff6792766ed2d166c Mon Sep 17 00:00:00 2001 From: jacobsalmela Date: Sat, 23 Jan 2016 12:56:27 -0600 Subject: [PATCH 02/32] script to set everything up --- advanced/Scripts/setupLCD.sh | 53 ++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 advanced/Scripts/setupLCD.sh diff --git a/advanced/Scripts/setupLCD.sh b/advanced/Scripts/setupLCD.sh new file mode 100644 index 00000000..bfcd0fc5 --- /dev/null +++ b/advanced/Scripts/setupLCD.sh @@ -0,0 +1,53 @@ +#!/usr/bin/env bash +# Pi-hole: A black hole for Internet advertisements +# by Jacob Salmela +# Network-wide ad blocking via your Raspberry Pi +# +# (c) 2015 by Jacob Salmela +# This file is part of Pi-hole. +# +# Pi-hole is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# pi-hole.net/donate + +getInitSys() { + if command -v systemctl > /dev/null && systemctl | grep -q '\-\.mount'; then + SYSTEMD=1 + elif [ -f /etc/init.d/cron ] && [ ! -h /etc/init.d/cron ]; then + SYSTEMD=0 + else + echo "Unrecognised init system" + return 1 + fi +} + +autoLoginPiToConsole() { + if [ -e /etc/init.d/lightdm ]; then + if [ $SYSTEMD -eq 1 ]; then + $SUDO systemctl set-default multi-user.target + $SUDO ln -fs /etc/systemd/system/autologin@.service /etc/systemd/system/getty.target.wants/getty@tty1.service + else + $SUDO update-rc.d lightdm disable 2 + $SUDO sed /etc/inittab -i -e "s/1:2345:respawn:\/sbin\/getty --noclear 38400 tty1/1:2345:respawn:\/bin\/login -f pi tty1 <\/dev\/tty1 >\/dev\/tty1 2>&1/" + fi + fi +} + + +getInitSys +# Set pi to log in automatically +autoLoginPiToConsole + +# Set chronomter to run automatically when pi logs in +$SUDO echo /usr/local/bin/chronometer.sh >> /home/pi/.bashrc + +# Back up the original file and download the new one +$SUDO mv /etc/default/console-setup /etc/default/console-setup.orig +$SUDO curl -o /etc/default/console-setup https://raw.githubusercontent.com/pi-hole/pi-hole/master/advanced/console-setup + +# Instantly apply the font change to the LCD screen +$SUDO setupcon + +$SUDO /usr/local/bin/chronometer.sh From 29c593b8b01c86f31c5b3f5e52f24785003a9af7 Mon Sep 17 00:00:00 2001 From: Chad Howell Date: Mon, 25 Jan 2016 00:28:53 -0500 Subject: [PATCH 03/32] Add user pihole if user does not exsist Check if user pihole exist and add if not. This will give pihole its own system user without a login or home directory that is not system dependent. --- automated install/basic-install.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index d9e448a9..b07145b2 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -431,6 +431,16 @@ runGravity(){ } +setUser(){ + # Check if user pihole exists and create if not + echo "::: Checking if user 'pihole' exists..." + if id -u pihole > /dev/null 2>&1; then + echo "::: User 'pihole' already exists" + else + echo "::: User 'pihole' doesn't exist. Creating..." + $SUDO useradd -r -s /usr/sbin/nologin pihole + fi +} installPihole(){ checkForDependencies # done @@ -438,7 +448,7 @@ installPihole(){ $SUDO chown www-data:www-data /var/www/html $SUDO chmod 775 /var/www/html - $SUDO usermod -a -G www-data pi + $SUDO usermod -a -G www-data pihole $SUDO lighty-enable-mod fastcgi fastcgi-php > /dev/null getGitFiles From 73bfbba5f75b2f21eaec6fa7c14880f1b1bb21b6 Mon Sep 17 00:00:00 2001 From: Daniel Fayette Date: Wed, 10 Feb 2016 15:07:31 -0600 Subject: [PATCH 04/32] Set file permisions on /etc/pihole Ensures file permisions on $piholeDir before reload/restart of dnsmasq --- gravity.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gravity.sh b/gravity.sh index 3004b8a2..44131fa3 100755 --- a/gravity.sh +++ b/gravity.sh @@ -321,6 +321,8 @@ function gravity_reload() { echo -n "::: Refresh lists in dnsmasq..." dnsmasqPid=$(pidof dnsmasq) + find "$piholeDir" -type f -exec $SUDO chmod 666 {} \; & spinner $! + if [[ $dnsmasqPid ]]; then # service already running - reload config $SUDO kill -HUP $dnsmasqPid & spinner $! From ecd46f85601b849734d5bcc512cc2f312d69470f Mon Sep 17 00:00:00 2001 From: Daniel Fayette Date: Sat, 13 Feb 2016 22:36:24 -0600 Subject: [PATCH 05/32] Allow installer to specify own DNS servers Offers "other" option. Gives Installer chance to review settings before continuing. --- automated install/basic-install.sh | 34 ++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 00431c69..226f6e41 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -286,9 +286,10 @@ setStaticIPv4() { } setDNS(){ - DNSChoseCmd=(whiptail --separate-output --radiolist "Select Upstream DNS Provider" $r $c 2) + DNSChoseCmd=(whiptail --separate-output --radiolist "Select Upstream DNS Provider" $r $c 3) DNSChooseOptions=(Google "" on - OpenDNS "" off) + OpenDNS "" off + Other "" off) DNSchoices=$("${DNSChoseCmd[@]}" "${DNSChooseOptions[@]}" 2>&1 >/dev/tty) if [[ $? = 0 ]];then case $DNSchoices in @@ -302,6 +303,23 @@ setDNS(){ piholeDNS1="208.67.222.222" piholeDNS2="208.67.220.220" ;; + Other) + until [[ $DNSSettingsCorrect = True ]] + do + piholeDNS=$(whiptail --backtitle "Specify Upstream DNS Provider(s)" --inputbox "Enter your desired upstream DNS provider(s)" $r $c "8.8.8.8, 8.8.4.4" 3>&1 1>&2 2>&3) + piholeDNS1=$(echo $piholeDNS | sed 's/[, \t]\+/,/g' | awk -F, '{print$1}') + piholeDNS2=$(echo $piholeDNS | sed 's/[, \t]\+/,/g' | awk -F, '{print$2}') + + if (whiptail --backtitle "Specify Upstream DNS Provider(s)" --title "Upstream DNS Provider(s)" --yesno "Are these settings correct? + DNS Server 1: $piholeDNS1 + DNS Server 2: $piholeDNS2" $r $c) then + DNSSettingsCorrect=True + else + # If the settings are wrong, the loop continues + DNSSettingsCorrect=False + fi + done + ;; esac else echo "::: Cancel selected. Exiting..." @@ -342,8 +360,16 @@ versionCheckDNSmasq(){ $SUDO cp $newFileToInstall $newFileFinalLocation echo " done." $SUDO sed -i "s/@INT@/$piholeInterface/" $newFileFinalLocation - $SUDO sed -i "s/@DNS1@/$piholeDNS1/" $newFileFinalLocation - $SUDO sed -i "s/@DNS2@/$piholeDNS2/" $newFileFinalLocation + if [[ "$piholDNS1" != "" ]]; then + $SUDO sed -i "s/@DNS1@/$piholeDNS1/" $newFileFinalLocation + else + $SUDO sed -i '/^server=@DNS1@/d' $newFileFinalLocation + fi + if [[ "$piholDNS2" != "" ]]; then + $SUDO sed -i "s/@DNS2@/$piholeDNS2/" $newFileFinalLocation + else + $SUDO sed -i '/^server=@DNS2@/d' $newFileFinalLocation + fi } installScripts() { From 3142992c573e564e4fabeac8ea0c32c04bc14f95 Mon Sep 17 00:00:00 2001 From: jacobsalmela Date: Sun, 14 Feb 2016 10:53:13 -0600 Subject: [PATCH 06/32] update --- advanced/Scripts/setupLCD.sh | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/advanced/Scripts/setupLCD.sh b/advanced/Scripts/setupLCD.sh index bfcd0fc5..00e3a3f8 100644 --- a/advanced/Scripts/setupLCD.sh +++ b/advanced/Scripts/setupLCD.sh @@ -1,17 +1,21 @@ #!/usr/bin/env bash # Pi-hole: A black hole for Internet advertisements -# by Jacob Salmela -# Network-wide ad blocking via your Raspberry Pi -# # (c) 2015 by Jacob Salmela -# This file is part of Pi-hole. +# Network-wide ad blocking via your Raspberry Pi +# http://pi-hole.net +# Automatically configures the Pi to use the 2.8 LCD screen to display stats on it (also works over ssh) # # Pi-hole is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. -# pi-hole.net/donate +# Set up the LCD screen based on Adafruits instuctions +curl -SLs https://apt.adafruit.com/add-pin | sudo bash +sudo apt-get -y install raspberrypi-bootloader +sudo apt-get -y install adafruit-pitft-helper + +# Borrowed from somewhere. Will update when I find it. getInitSys() { if command -v systemctl > /dev/null && systemctl | grep -q '\-\.mount'; then SYSTEMD=1 @@ -23,6 +27,7 @@ getInitSys() { fi } +# Borrowed from somewhere. Will update when I find it. autoLoginPiToConsole() { if [ -e /etc/init.d/lightdm ]; then if [ $SYSTEMD -eq 1 ]; then @@ -37,6 +42,7 @@ autoLoginPiToConsole() { getInitSys + # Set pi to log in automatically autoLoginPiToConsole @@ -50,4 +56,5 @@ $SUDO curl -o /etc/default/console-setup https://raw.githubusercontent.com/pi-ho # Instantly apply the font change to the LCD screen $SUDO setupcon +# Start chronometer after the settings are applues $SUDO /usr/local/bin/chronometer.sh From 4d0b4cfb36f0cf5592449323e9c2bfcc1cb71012 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Sun, 14 Feb 2016 23:44:23 +0000 Subject: [PATCH 07/32] Update basic-install.sh Do not stop dnsmasq when installing. Instead run `service dnsmasq restart` once installation is complete. This may have been the cause of issues outlined in #218 --- automated install/basic-install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 359a1f0d..514ac8e6 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -387,7 +387,7 @@ stopServices() { # Stop dnsmasq and lighttpd $SUDO echo ":::" $SUDO echo -n "::: Stopping services..." - $SUDO service dnsmasq stop & spinner $! || true + #$SUDO service dnsmasq stop & spinner $! || true $SUDO service lighttpd stop & spinner $! || true $SUDO echo " done." } @@ -601,7 +601,7 @@ displayFinalMessage echo -n "::: Restarting services..." # Start services -$SUDO service dnsmasq start +$SUDO service dnsmasq restart $SUDO service lighttpd start echo " done." From 06444c1c27b37f6347b3504559c86139a5faa2bf Mon Sep 17 00:00:00 2001 From: slamanna212 Date: Mon, 15 Feb 2016 17:31:31 -0500 Subject: [PATCH 08/32] Add 3 More DNS Server Choices Durring Install Added Level 3 , Norton, and Comodo DNS Choices --- automated install/basic-install.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 514ac8e6..35bcec41 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -316,6 +316,21 @@ setDNS(){ piholeDNS1="208.67.222.222" piholeDNS2="208.67.220.220" ;; + Level3) + echo "::: Using Level3 servers." + piholeDNS1="4.2.2.1" + piholeDNS2="4.2.2.2" + ;; + Norton) + echo "::: Using Norton ConnectSafe servers." + piholeDNS1="199.85.126.10" + piholeDNS2="199.85.127.10" + ;; + Comodo) + echo "::: Using Comodo Secure servers." + piholeDNS1="8.26.56.26" + piholeDNS2="8.20.247.20" + ;; esac else echo "::: Cancel selected. Exiting..." From 94600c54cbaac14e6e7c0e32b06fce9cddc7b624 Mon Sep 17 00:00:00 2001 From: slamanna212 Date: Mon, 15 Feb 2016 17:54:17 -0500 Subject: [PATCH 09/32] Added Default State for New DNS Options Added default state of off for 3 new DNS options to better match existing code --- automated install/basic-install.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 35bcec41..84ba3921 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -302,7 +302,10 @@ setStaticIPv4() { setDNS(){ DNSChoseCmd=(whiptail --separate-output --radiolist "Select Upstream DNS Provider" $r $c 2) DNSChooseOptions=(Google "" on - OpenDNS "" off) + OpenDNS "" off + Level3 "" off + Norton "" off + Comodo "" off) DNSchoices=$("${DNSChoseCmd[@]}" "${DNSChooseOptions[@]}" 2>&1 >/dev/tty) if [[ $? = 0 ]];then case $DNSchoices in From da959e1296761c3e70d5ab3b812c649fd4424d2b Mon Sep 17 00:00:00 2001 From: slamanna212 Date: Mon, 15 Feb 2016 17:55:14 -0500 Subject: [PATCH 10/32] Increased Size Of Whiptail Dialog Increased Size of Whiptail Dialog to 5 to show all 5 DNS choices --- automated install/basic-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 84ba3921..23aa827f 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -300,7 +300,7 @@ setStaticIPv4() { } setDNS(){ - DNSChoseCmd=(whiptail --separate-output --radiolist "Select Upstream DNS Provider" $r $c 2) + DNSChoseCmd=(whiptail --separate-output --radiolist "Select Upstream DNS Provider" $r $c 5) DNSChooseOptions=(Google "" on OpenDNS "" off Level3 "" off From 432e6d539502795117840b36dd5df35bf433c64e Mon Sep 17 00:00:00 2001 From: Daniel Fayette Date: Tue, 16 Feb 2016 16:47:36 -0600 Subject: [PATCH 11/32] Cleaned up output, Fixed Cancel button --- automated install/basic-install.sh | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 600b8fd8..e85593dd 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -305,7 +305,7 @@ setDNS(){ OpenDNS "" off Level3 "" off Norton "" off - Comodo "" off) + Comodo "" off Other "" off) DNSchoices=$("${DNSChoseCmd[@]}" "${DNSChooseOptions[@]}" 2>&1 >/dev/tty) if [[ $? = 0 ]];then @@ -339,12 +339,15 @@ setDNS(){ until [[ $DNSSettingsCorrect = True ]] do piholeDNS=$(whiptail --backtitle "Specify Upstream DNS Provider(s)" --inputbox "Enter your desired upstream DNS provider(s)" $r $c "8.8.8.8, 8.8.4.4" 3>&1 1>&2 2>&3) - piholeDNS1=$(echo $piholeDNS | sed 's/[, \t]\+/,/g' | awk -F, '{print$1}') - piholeDNS2=$(echo $piholeDNS | sed 's/[, \t]\+/,/g' | awk -F, '{print$2}') + if [[ $? = 0 ]];then + piholeDNS1=$(echo $piholeDNS | sed 's/[, \t]\+/,/g' | awk -F, '{print$1}') + piholeDNS2=$(echo $piholeDNS | sed 's/[, \t]\+/,/g' | awk -F, '{print$2}') + else + echo "::: Cancel selected, exiting...." + exit 1 + fi - if (whiptail --backtitle "Specify Upstream DNS Provider(s)" --title "Upstream DNS Provider(s)" --yesno "Are these settings correct? - DNS Server 1: $piholeDNS1 - DNS Server 2: $piholeDNS2" $r $c) then + if (whiptail --backtitle "Specify Upstream DNS Provider(s)" --title "Upstream DNS Provider(s)" --yesno "Are these settings correct?\n DNS Server 1: $piholeDNS1\n DNS Server 2: $piholeDNS2" $r $c) then DNSSettingsCorrect=True else # If the settings are wrong, the loop continues From 40f541bc31a23e49853f9536b809f4ab403d0baa Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Tue, 16 Feb 2016 23:00:48 +0000 Subject: [PATCH 12/32] update verifyFreeDiskSpace()... addresses #322. Will now check free space on the first file system output by 'df- lkP`, as opposed to `/` to make pi-hole more compatible with other distros. --- automated install/basic-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 514ac8e6..837c3179 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -120,7 +120,7 @@ verifyFreeDiskSpace() { # 25MB is the minimum space needed (20MB install + 5MB one day of logs.) requiredFreeBytes=25600 - existingFreeBytes=`df -lkP / | awk '{print $4}' | tail -1` + existingFreeBytes=`df -lkP | awk '{print $4}' | tail -1` if [[ $existingFreeBytes -lt $requiredFreeBytes ]]; then whiptail --msgbox --backtitle "Insufficient Disk Space" --title "Insufficient Disk Space" "\nYour system appears to be low on disk space. pi-hole recomends a minimum of $requiredFreeBytes Bytes.\nYou only have $existingFreeBytes Free.\n\nIf this is a new install you may need to expand your disk.\n\nTry running:\n 'sudo raspi-config'\nChoose the 'expand file system option'\n\nAfter rebooting, run this installation again.\n\ncurl -L install.pi-hole.net | bash\n" $r $c From c396aeed52b844b28e9cbef5ee9a33f932144dae Mon Sep 17 00:00:00 2001 From: Promofaux Date: Wed, 17 Feb 2016 00:07:14 +0000 Subject: [PATCH 13/32] Correct miss-spelled variables on lines 398 and 403 --- automated install/basic-install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index e85593dd..a2bf8f7c 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -395,12 +395,12 @@ versionCheckDNSmasq(){ $SUDO cp $newFileToInstall $newFileFinalLocation echo " done." $SUDO sed -i "s/@INT@/$piholeInterface/" $newFileFinalLocation - if [[ "$piholDNS1" != "" ]]; then + if [[ "$piholeDNS1" != "" ]]; then $SUDO sed -i "s/@DNS1@/$piholeDNS1/" $newFileFinalLocation else $SUDO sed -i '/^server=@DNS1@/d' $newFileFinalLocation fi - if [[ "$piholDNS2" != "" ]]; then + if [[ "$piholeDNS2" != "" ]]; then $SUDO sed -i "s/@DNS2@/$piholeDNS2/" $newFileFinalLocation else $SUDO sed -i '/^server=@DNS2@/d' $newFileFinalLocation From 21c688a8a8c415ea32e79b3b9ef143d5fbf09e0e Mon Sep 17 00:00:00 2001 From: Hippyjake Date: Tue, 16 Feb 2016 18:06:49 -0700 Subject: [PATCH 14/32] add uptime -p to chrono script --- advanced/Scripts/chronometer.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/advanced/Scripts/chronometer.sh b/advanced/Scripts/chronometer.sh index 9153d9ba..ebed8684 100755 --- a/advanced/Scripts/chronometer.sh +++ b/advanced/Scripts/chronometer.sh @@ -88,6 +88,7 @@ function normalChrono(){ echo " $(ifconfig eth0 | awk '/inet addr/ {print $2}' | cut -d':' -f2)" echo "" uptime | cut -d' ' -f11- + uptime -p echo "-------------------------------" # Uncomment to continually read the log file and display the current domain being blocked #tail -f /var/log/pihole.log | awk '/\/etc\/pihole\/gravity.list/ {if ($7 != "address" && $7 != "name" && $7 != "/etc/pihole/gravity.list") print $7; else;}' From c3c051385c6bb8e98d15632e1d4473a558369a71 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Wed, 17 Feb 2016 12:42:31 +0000 Subject: [PATCH 15/32] Update basic-install.sh Corrected mistake in previous commit --- automated install/basic-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 837c3179..5850b27e 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -120,7 +120,7 @@ verifyFreeDiskSpace() { # 25MB is the minimum space needed (20MB install + 5MB one day of logs.) requiredFreeBytes=25600 - existingFreeBytes=`df -lkP | awk '{print $4}' | tail -1` + existingFreeBytes=`df -lk | awk '{print $4}' | head -2 | tail -1` if [[ $existingFreeBytes -lt $requiredFreeBytes ]]; then whiptail --msgbox --backtitle "Insufficient Disk Space" --title "Insufficient Disk Space" "\nYour system appears to be low on disk space. pi-hole recomends a minimum of $requiredFreeBytes Bytes.\nYou only have $existingFreeBytes Free.\n\nIf this is a new install you may need to expand your disk.\n\nTry running:\n 'sudo raspi-config'\nChoose the 'expand file system option'\n\nAfter rebooting, run this installation again.\n\ncurl -L install.pi-hole.net | bash\n" $r $c From 8e289215b4f937795cfb4b1488895d0353cc7cf3 Mon Sep 17 00:00:00 2001 From: Daniel Fayette Date: Wed, 17 Feb 2016 10:00:36 -0600 Subject: [PATCH 16/32] Account for CHIP pc not having root on '/' --- automated install/basic-install.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 5850b27e..346b419c 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -120,7 +120,10 @@ verifyFreeDiskSpace() { # 25MB is the minimum space needed (20MB install + 5MB one day of logs.) requiredFreeBytes=25600 - existingFreeBytes=`df -lk | awk '{print $4}' | head -2 | tail -1` + existingFreeBytes=`df -lk / 2>&1 | awk '{print $4}' | head -2 | tail -1` + if ! [[ "$existingFreeBytes" =~ ^[0-9]\+$ ]]; then + existingFreeBytes=`df -lk /dev 2>&1 | awk '{print $4}' | head -2 | tail -1` + fi if [[ $existingFreeBytes -lt $requiredFreeBytes ]]; then whiptail --msgbox --backtitle "Insufficient Disk Space" --title "Insufficient Disk Space" "\nYour system appears to be low on disk space. pi-hole recomends a minimum of $requiredFreeBytes Bytes.\nYou only have $existingFreeBytes Free.\n\nIf this is a new install you may need to expand your disk.\n\nTry running:\n 'sudo raspi-config'\nChoose the 'expand file system option'\n\nAfter rebooting, run this installation again.\n\ncurl -L install.pi-hole.net | bash\n" $r $c From 0116b6341c3c4955f2e9f5bb97445219a200112b Mon Sep 17 00:00:00 2001 From: jacobsalmela Date: Sat, 20 Feb 2016 01:14:48 -0600 Subject: [PATCH 17/32] updated script Added links to where code was borrowed from added reboot at the end also added a few things commented out that might be useful for some people to learn. --- advanced/Scripts/setupLCD.sh | 53 ++++++++++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 12 deletions(-) diff --git a/advanced/Scripts/setupLCD.sh b/advanced/Scripts/setupLCD.sh index 00e3a3f8..df2be704 100644 --- a/advanced/Scripts/setupLCD.sh +++ b/advanced/Scripts/setupLCD.sh @@ -10,12 +10,25 @@ # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. -# Set up the LCD screen based on Adafruits instuctions -curl -SLs https://apt.adafruit.com/add-pin | sudo bash -sudo apt-get -y install raspberrypi-bootloader -sudo apt-get -y install adafruit-pitft-helper +############ FUNCTIONS ########### +# Run this script as root or under sudo +echo ":::" +if [[ $EUID -eq 0 ]];then + echo "::: You are root." +else + echo "::: sudo will be used." + # Check if it is actually installed + # If it isn't, exit because the install cannot complete + if [[ $(dpkg-query -s sudo) ]];then + export SUDO="sudo" + else + echo "::: Please install sudo or run this script as root." + exit 1 + fi +fi -# Borrowed from somewhere. Will update when I find it. +# Borrowed from adafruit-pitft-helper < borrowed from raspi-config +# https://github.com/adafruit/Adafruit-PiTFT-Helper/blob/master/adafruit-pitft-helper#L324-L334 getInitSys() { if command -v systemctl > /dev/null && systemctl | grep -q '\-\.mount'; then SYSTEMD=1 @@ -27,7 +40,8 @@ getInitSys() { fi } -# Borrowed from somewhere. Will update when I find it. +# Borrowed from adafruit-pitft-helper: +# https://github.com/adafruit/Adafruit-PiTFT-Helper/blob/master/adafruit-pitft-helper#L274-L285 autoLoginPiToConsole() { if [ -e /etc/init.d/lightdm ]; then if [ $SYSTEMD -eq 1 ]; then @@ -40,14 +54,26 @@ autoLoginPiToConsole() { fi } - -getInitSys - +######### SCRIPT ########### # Set pi to log in automatically +getInitSys autoLoginPiToConsole # Set chronomter to run automatically when pi logs in -$SUDO echo /usr/local/bin/chronometer.sh >> /home/pi/.bashrc +echo /usr/local/bin/chronometer.sh >> /home/pi/.bashrc +# OR +#$SUDO echo /usr/local/bin/chronometer.sh >> /etc/profile + +# Set up the LCD screen based on Adafruits instuctions: +# https://learn.adafruit.com/adafruit-pitft-28-inch-resistive-touchscreen-display-raspberry-pi/easy-install +curl -SLs https://apt.adafruit.com/add-pin | $SUDO bash +$SUDO apt-get -y install raspberrypi-bootloader +$SUDO apt-get -y install adafruit-pitft-helper +$SUDO adafruit-pitft-helper -t 28r + +# Download the cmdline.txt file that prevents the screen from going blank after a period of time +$SUDO mv /boot/cmdline.txt /boot/cmdline.orig +$SUDO curl -o /boot/cmdline.txt https://raw.githubusercontent.com/pi-hole/pi-hole/master/advanced/cmdline.txt # Back up the original file and download the new one $SUDO mv /etc/default/console-setup /etc/default/console-setup.orig @@ -56,5 +82,8 @@ $SUDO curl -o /etc/default/console-setup https://raw.githubusercontent.com/pi-ho # Instantly apply the font change to the LCD screen $SUDO setupcon -# Start chronometer after the settings are applues -$SUDO /usr/local/bin/chronometer.sh +$SUDO reboot + +# Start showing the stats on the screen by running the command on another tty: +# http://unix.stackexchange.com/questions/170063/start-a-process-on-a-different-tty +#setsid sh -c 'exec /usr/local/bin/chronometer.sh <> /dev/tty1 >&0 2>&1' From c5d45edf2d93fcd68a31c80fc44078958e754e76 Mon Sep 17 00:00:00 2001 From: jacobsalmela Date: Sat, 20 Feb 2016 01:15:14 -0600 Subject: [PATCH 18/32] consoleblank=0 This makes sure the LCD screen does not go blank after a set period of time. --- advanced/cmdline.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 advanced/cmdline.txt diff --git a/advanced/cmdline.txt b/advanced/cmdline.txt new file mode 100644 index 00000000..84d52b79 --- /dev/null +++ b/advanced/cmdline.txt @@ -0,0 +1 @@ +dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait fbcon=map:10 fbcon=font:VGA8x8 consoleblank=0 From b41608d40b9fb5a7330cd42fba947c4337d412c1 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sat, 20 Feb 2016 14:44:56 +0000 Subject: [PATCH 19/32] Include fix for regex in verifyFreeDiskSpace() --- automated install/basic-install.sh | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index a2bf8f7c..505c843d 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -117,15 +117,19 @@ welcomeDialogs() { verifyFreeDiskSpace() { - # 25MB is the minimum space needed (20MB install + 5MB one day of logs.) - requiredFreeBytes=25600 - - existingFreeBytes=`df -lkP / | awk '{print $4}' | tail -1` - - if [[ $existingFreeBytes -lt $requiredFreeBytes ]]; then - whiptail --msgbox --backtitle "Insufficient Disk Space" --title "Insufficient Disk Space" "\nYour system appears to be low on disk space. pi-hole recomends a minimum of $requiredFreeBytes Bytes.\nYou only have $existingFreeBytes Free.\n\nIf this is a new install you may need to expand your disk.\n\nTry running:\n 'sudo raspi-config'\nChoose the 'expand file system option'\n\nAfter rebooting, run this installation again.\n\ncurl -L install.pi-hole.net | bash\n" $r $c - exit 1 - fi + # 25MB is the minimum space needed (20MB install + 5MB one day of logs.) + requiredFreeBytes=25600 + + existingFreeBytes=`df -lk / 2>&1 | awk '{print $4}' | head -2 | tail -1` + if ! [[ "$existingFreeBytes" =~ ^([0-9])*$ ]]; then + existingFreeBytes=`df -lk /dev 2>&1 | awk '{print $4}' | head -2 | tail -1` + fi + + if [[ $existingFreeBytes -lt $requiredFreeBytes ]]; then + echo "$existingFreeBytes is less than $requiredFreeBytes" + echo "Insufficient free space, exiting..." + exit 1 + fi } From 4a1e88f4bf8b11a1dac57075d22c6e1f5331c3a0 Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Sat, 20 Feb 2016 09:48:06 -0500 Subject: [PATCH 20/32] Fixed Pi-hole user not being created --- automated install/basic-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index faed1077..ac57db43 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -558,6 +558,7 @@ installPihole() { # Install base files and web interface checkForDependencies # done stopServices + setUser $SUDO mkdir -p /etc/pihole/ $SUDO chown www-data:www-data /var/www/html $SUDO chmod 775 /var/www/html @@ -567,7 +568,6 @@ installPihole() { getGitFiles installScripts installConfigs - #installWebAdmin CreateLogFile installPiholeWeb installCron From 7001edcd1df8390315ae6295abfaf6ae0d57dac4 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sat, 20 Feb 2016 15:00:03 +0000 Subject: [PATCH 21/32] Change 'Other' to 'Custom', add explanation to whiptail. Convert spaces to tabs. --- automated install/basic-install.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 505c843d..43cd6c78 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -304,13 +304,13 @@ setStaticIPv4() { } setDNS(){ - DNSChoseCmd=(whiptail --separate-output --radiolist "Select Upstream DNS Provider" $r $c 6) + DNSChoseCmd=(whiptail --separate-output --radiolist "Select Upstream DNS Provider. To use your own, select Custom" $r $c 6) DNSChooseOptions=(Google "" on OpenDNS "" off Level3 "" off Norton "" off Comodo "" off - Other "" off) + Custom "" off) DNSchoices=$("${DNSChoseCmd[@]}" "${DNSChooseOptions[@]}" 2>&1 >/dev/tty) if [[ $? = 0 ]];then case $DNSchoices in @@ -339,10 +339,10 @@ setDNS(){ piholeDNS1="8.26.56.26" piholeDNS2="8.20.247.20" ;; - Other) - until [[ $DNSSettingsCorrect = True ]] - do - piholeDNS=$(whiptail --backtitle "Specify Upstream DNS Provider(s)" --inputbox "Enter your desired upstream DNS provider(s)" $r $c "8.8.8.8, 8.8.4.4" 3>&1 1>&2 2>&3) + Custom) + until [[ $DNSSettingsCorrect = True ]] + do + piholeDNS=$(whiptail --backtitle "Specify Upstream DNS Provider(s)" --inputbox "Enter your desired upstream DNS provider(s)" $r $c "8.8.8.8, 8.8.4.4" 3>&1 1>&2 2>&3) if [[ $? = 0 ]];then piholeDNS1=$(echo $piholeDNS | sed 's/[, \t]\+/,/g' | awk -F, '{print$1}') piholeDNS2=$(echo $piholeDNS | sed 's/[, \t]\+/,/g' | awk -F, '{print$2}') @@ -351,14 +351,14 @@ setDNS(){ exit 1 fi - if (whiptail --backtitle "Specify Upstream DNS Provider(s)" --title "Upstream DNS Provider(s)" --yesno "Are these settings correct?\n DNS Server 1: $piholeDNS1\n DNS Server 2: $piholeDNS2" $r $c) then + if (whiptail --backtitle "Specify Upstream DNS Provider(s)" --title "Upstream DNS Provider(s)" --yesno "Are these settings correct?\n DNS Server 1: $piholeDNS1\n DNS Server 2: $piholeDNS2" $r $c) then DNSSettingsCorrect=True else # If the settings are wrong, the loop continues DNSSettingsCorrect=False fi - done - ;; + done + ;; esac else echo "::: Cancel selected. Exiting..." From 8687d25d88cd9772ab7b13b54ad7f89e67e8e88b Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sat, 20 Feb 2016 15:12:13 +0000 Subject: [PATCH 22/32] make prepopulation of freetext on custom DNS provider a bit more intelligent --- automated install/basic-install.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 43cd6c78..18531f27 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -304,7 +304,7 @@ setStaticIPv4() { } setDNS(){ - DNSChoseCmd=(whiptail --separate-output --radiolist "Select Upstream DNS Provider. To use your own, select Custom" $r $c 6) + DNSChoseCmd=(whiptail --separate-output --radiolist "Select Upstream DNS Provider. To use your own, select Custom." $r $c 6) DNSChooseOptions=(Google "" on OpenDNS "" off Level3 "" off @@ -342,7 +342,15 @@ setDNS(){ Custom) until [[ $DNSSettingsCorrect = True ]] do - piholeDNS=$(whiptail --backtitle "Specify Upstream DNS Provider(s)" --inputbox "Enter your desired upstream DNS provider(s)" $r $c "8.8.8.8, 8.8.4.4" 3>&1 1>&2 2>&3) + if [ ! $piholeDNS1 ]; then + prePopulate="" + elif [ $piholeDNS1 ] && [ ! $piholeDNS2 ]; then + prePopulate="$piholeDNS1" + elif [ $piholeDNS1 ] && [ $piholeDNS2 ]; then + prePopulate="$piholeDNS1, $piholeDNS2" + fi + + piholeDNS=$(whiptail --backtitle "Specify Upstream DNS Provider(s)" --inputbox "Enter your desired upstream DNS provider(s), seperated by a comma.\n\nFor example '8.8.8.8, 8.8.4.4'" $r $c "$prePopulate" 3>&1 1>&2 2>&3) if [[ $? = 0 ]];then piholeDNS1=$(echo $piholeDNS | sed 's/[, \t]\+/,/g' | awk -F, '{print$1}') piholeDNS2=$(echo $piholeDNS | sed 's/[, \t]\+/,/g' | awk -F, '{print$2}') From b14b182084e571fa72e44f9b687bf4da0040ccff Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sat, 20 Feb 2016 15:17:57 +0000 Subject: [PATCH 23/32] change regex to test for one or more numbers, not 0 or more numbers. --- automated install/basic-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 18531f27..b8834951 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -121,7 +121,7 @@ verifyFreeDiskSpace() { requiredFreeBytes=25600 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` fi From f3978446039ccd8ceaaf042aec33c84aa023239d Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sat, 20 Feb 2016 16:08:02 +0000 Subject: [PATCH 24/32] Remove conflicted merge markup. Not sure how that got through. --- automated install/basic-install.sh | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 1a021089..75f32116 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -117,7 +117,6 @@ welcomeDialogs() { verifyFreeDiskSpace() { -<<<<<<< HEAD # 25MB is the minimum space needed (20MB install + 5MB one day of logs.) requiredFreeBytes=25600 @@ -131,20 +130,6 @@ verifyFreeDiskSpace() { echo "Insufficient free space, exiting..." exit 1 fi -======= - # 25MB is the minimum space needed (20MB install + 5MB one day of logs.) - requiredFreeBytes=25600 - - existingFreeBytes=`df -lk / 2>&1 | awk '{print $4}' | head -2 | tail -1` - if ! [[ "$existingFreeBytes" =~ ^[0-9]\+$ ]]; then - existingFreeBytes=`df -lk /dev 2>&1 | awk '{print $4}' | head -2 | tail -1` - fi - - if [[ $existingFreeBytes -lt $requiredFreeBytes ]]; then - whiptail --msgbox --backtitle "Insufficient Disk Space" --title "Insufficient Disk Space" "\nYour system appears to be low on disk space. pi-hole recomends a minimum of $requiredFreeBytes Bytes.\nYou only have $existingFreeBytes Free.\n\nIf this is a new install you may need to expand your disk.\n\nTry running:\n 'sudo raspi-config'\nChoose the 'expand file system option'\n\nAfter rebooting, run this installation again.\n\ncurl -L install.pi-hole.net | bash\n" $r $c - exit 1 - fi ->>>>>>> development } From 800d2f0859eaa70d8a72607392c3d8c13706472c Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sat, 20 Feb 2016 16:17:29 +0000 Subject: [PATCH 25/32] Add back in whiptail dialog to verifyFreeDiskSpace() --- automated install/basic-install.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 75f32116..c20447c2 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -125,7 +125,8 @@ verifyFreeDiskSpace() { existingFreeBytes=`df -lk /dev 2>&1 | awk '{print $4}' | head -2 | tail -1` fi - if [[ $existingFreeBytes -lt $requiredFreeBytes ]]; then + if [[ $existingFreeBytes -lt $requiredFreeBytes ]]; then + whiptail --msgbox --backtitle "Insufficient Disk Space" --title "Insufficient Disk Space" "\nYour system appears to be low on disk space. pi-hole recomends a minimum of $requiredFreeBytes Bytes.\nYou only have $existingFreeBytes Free.\n\nIf this is a new install you may need to expand your disk.\n\nTry running:\n 'sudo raspi-config'\nChoose the 'expand file system option'\n\nAfter rebooting, run this installation again.\n\ncurl -L install.pi-hole.net | bash\n" $r $c echo "$existingFreeBytes is less than $requiredFreeBytes" echo "Insufficient free space, exiting..." exit 1 From 0ebb7eecdb87f7a74304ac31a489e13cfda74e4c Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sat, 20 Feb 2016 17:33:20 +0000 Subject: [PATCH 26/32] Verify Custom DNS IP is a valid IP address --- automated install/basic-install.sh | 61 ++++++++++++++++++++++++++---- 1 file changed, 54 insertions(+), 7 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index c20447c2..e6deca29 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -304,6 +304,23 @@ setStaticIPv4() { fi } +function valid_ip() +{ + local ip=$1 + local stat=1 + + if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then + OIFS=$IFS + IFS='.' + ip=($ip) + IFS=$OIFS + [[ ${ip[0]} -le 255 && ${ip[1]} -le 255 \ + && ${ip[2]} -le 255 && ${ip[3]} -le 255 ]] + stat=$? + fi + return $stat +} + setDNS(){ DNSChoseCmd=(whiptail --separate-output --radiolist "Select Upstream DNS Provider. To use your own, select Custom." $r $c 6) DNSChooseOptions=(Google "" on @@ -343,9 +360,16 @@ setDNS(){ Custom) until [[ $DNSSettingsCorrect = True ]] do + + strInvalid="Invalid" + if [ ! $piholeDNS1 ]; then - prePopulate="" - elif [ $piholeDNS1 ] && [ ! $piholeDNS2 ]; then + if [ ! $piholeDNS2 ]; then + prePopulate="" + else + prePopulate=", $piholeDNS2" + fi + elif [ $piholeDNS1 ] && [ ! $piholeDNS2 ]; then prePopulate="$piholeDNS1" elif [ $piholeDNS1 ] && [ $piholeDNS2 ]; then prePopulate="$piholeDNS1, $piholeDNS2" @@ -355,16 +379,39 @@ setDNS(){ if [[ $? = 0 ]];then piholeDNS1=$(echo $piholeDNS | sed 's/[, \t]\+/,/g' | awk -F, '{print$1}') piholeDNS2=$(echo $piholeDNS | sed 's/[, \t]\+/,/g' | awk -F, '{print$2}') + + if ! valid_ip $piholeDNS1 || [ ! $piholeDNS1 ]; then + piholeDNS1=$strInvalid + fi + + if ! valid_ip $piholeDNS2 && [ $piholeDNS2 ]; then + piholeDNS2=$strInvalid + fi + else echo "::: Cancel selected, exiting...." exit 1 fi - - if (whiptail --backtitle "Specify Upstream DNS Provider(s)" --title "Upstream DNS Provider(s)" --yesno "Are these settings correct?\n DNS Server 1: $piholeDNS1\n DNS Server 2: $piholeDNS2" $r $c) then - DNSSettingsCorrect=True - else - # If the settings are wrong, the loop continues + + if [ $piholeDNS1 == $strInvalid ] || [ $piholeDNS2 == $strInvalid ]; then + whiptail --msgbox --backtitle "Invalid IP" --title "Invalid IP" "One or both entered IP addresses were invalid. Please try again.\n\n DNS Server 1: $piholeDNS1\n DNS Server 2: $piholeDNS2" $r $c + + if [ $piholeDNS1 == $strInvalid ]; then + piholeDNS1="" + fi + + if [ $piholeDNS2 == $strInvalid ]; then + piholeDNS2="" + fi + DNSSettingsCorrect=False + else + if (whiptail --backtitle "Specify Upstream DNS Provider(s)" --title "Upstream DNS Provider(s)" --yesno "Are these settings correct?\n DNS Server 1: $piholeDNS1\n DNS Server 2: $piholeDNS2" $r $c) then + DNSSettingsCorrect=True + else + # If the settings are wrong, the loop continues + DNSSettingsCorrect=False + fi fi done ;; From bffc77e47887f786d814945c71df35ae1f9d98c1 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sun, 21 Feb 2016 17:45:25 +0000 Subject: [PATCH 27/32] Add support for comments and blank lines in adlists.default/adlists.list --- gravity.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/gravity.sh b/gravity.sh index 66b923b8..83700529 100755 --- a/gravity.sh +++ b/gravity.sh @@ -100,7 +100,12 @@ function gravity_collapse() { echo -n "::: Custom adList file detected. Reading..." sources=() while read -a line; do - sources+=($line) + #Do not read commented out or blank lines + if [[ $line = \#* ]] || [[ ! $line ]]; then + echo "" > /dev/null + else + sources+=($line) + fi done < $adListFile echo " done!" else @@ -108,7 +113,12 @@ function gravity_collapse() { echo -n "::: No custom adlist file detected, reading from default file..." sources=() while read -a line; do - sources+=($line) + #Do not read commented out or blank lines + if [[ $line = \#* ]] || [[ ! $line ]]; then + echo "" > /dev/null + else + sources+=($line) + fi done < $adListDefault echo " done!" fi From 13777cc1aa9e5740552bac2da6b53e48e1f6c85f Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sun, 21 Feb 2016 18:12:57 +0000 Subject: [PATCH 28/32] update default list to include StevenBlack's amalgamated list (remove seperate lists included in that list). Take advantage of new support for commenting and blank lines --- adlists.default | 46 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 7 deletions(-) diff --git a/adlists.default b/adlists.default index cf5ca45b..493ca843 100644 --- a/adlists.default +++ b/adlists.default @@ -1,14 +1,46 @@ -https://adaway.org/hosts.txt +## Pi-hole ad-list default sources. Updated 21/02/2016 ######################### +# # +# To make changes to this file: # +# 1. run `cp /etc/pihole/adlists.default /etc/pihole/adlists.list # +# 2. run `nano /etc/pihole/adlists.list` # +# 3. Uncomment or comment any of the below lists # +# # +# Know of any other lists? Feel free to let us know about them, or add them # +# to this file! # +################################################################################ + +# The below list amalgamates several lists we used previously. +# See `https://github.com/StevenBlack/hosts` for details +https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts + +# Other lists we consider safe: http://adblock.gjtech.net/?format=unix-hosts -http://hosts-file.net/ad_servers.txt -http://www.malwaredomainlist.com/hostslist/hosts.txt -http://pgl.yoyo.org/adservers/serverlist.php? -http://someonewhocares.org/hosts/hosts -http://winhelp2002.mvps.org/hosts.txt http://mirror1.malwaredomains.com/files/justdomains http://sysctl.org/cameleon/hosts https://zeustracker.abuse.ch/blocklist.php?download=domainblocklist https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt -http://optimate.dl.sourceforge.net/project/adzhosts/HOSTS.txt + +# hosts-file.net list. Updated frequently, but has been known to block legitimate sites. +http://hosts-file.net/ad_servers.txt + +# Mahakala list. Has been known to block legitimage domains including the entire .com range. +#http://adblock.mahakala.is/ + +# ADZHOSTS list. Has been known to block legitimate domains +#http://optimate.dl.sourceforge.net/project/adzhosts/HOSTS.txt + +# Windows 10 telemetry list - warning this one may block windows update +#https://raw.githubusercontent.com/crazy-max/HostsWindowsBlocker/master/hosts.txt + +# Securemecca.com list - Also blocks "adult" sites (pornography/gambling etc) +#http://securemecca.com/Downloads/hosts.txt + +# Quidsup's tracker list https://raw.githubusercontent.com/quidsup/notrack/master/trackers.txt + + +# Untested Lists: +#https://raw.githubusercontent.com/reek/anti-adblock-killer/master/anti-adblock-killer-filters.txt +#http://spam404bl.com/spam404scamlist.txt +#http://malwaredomains.lehigh.edu/files/domains.txt From ca2d3a192cbefda4b5d50ab38f06cf64d63e25b4 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sun, 21 Feb 2016 18:38:34 +0000 Subject: [PATCH 29/32] add double bracket notation to lines 396, 399, 403 . Fixes error raised by @jacobsalmela --- automated install/basic-install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index e6deca29..c20308ab 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -393,14 +393,14 @@ setDNS(){ exit 1 fi - if [ $piholeDNS1 == $strInvalid ] || [ $piholeDNS2 == $strInvalid ]; then + if [[ $piholeDNS1 == $strInvalid ]] || [[ $piholeDNS2 == $strInvalid ]]; then whiptail --msgbox --backtitle "Invalid IP" --title "Invalid IP" "One or both entered IP addresses were invalid. Please try again.\n\n DNS Server 1: $piholeDNS1\n DNS Server 2: $piholeDNS2" $r $c - if [ $piholeDNS1 == $strInvalid ]; then + if [[ $piholeDNS1 == $strInvalid ]]; then piholeDNS1="" fi - if [ $piholeDNS2 == $strInvalid ]; then + if [[ $piholeDNS2 == $strInvalid ]]; then piholeDNS2="" fi From 592af806599c035f1212fd5460545340b0733dc4 Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Sun, 21 Feb 2016 14:19:57 -0500 Subject: [PATCH 30/32] Update adlists.default --- adlists.default | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adlists.default b/adlists.default index 493ca843..81676a3d 100644 --- a/adlists.default +++ b/adlists.default @@ -1,7 +1,7 @@ ## Pi-hole ad-list default sources. Updated 21/02/2016 ######################### # # # To make changes to this file: # -# 1. run `cp /etc/pihole/adlists.default /etc/pihole/adlists.list # +# 1. run `cp /etc/pihole/adlists.default /etc/pihole/adlists.list` # # 2. run `nano /etc/pihole/adlists.list` # # 3. Uncomment or comment any of the below lists # # # From a0673c7028c0e7124d1ebe9f2e68160ee70235a0 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Sun, 21 Feb 2016 20:38:05 +0000 Subject: [PATCH 31/32] Update basic-install.sh Increase required free bytes. --- automated install/basic-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index c20308ab..b3e6202f 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -118,7 +118,7 @@ welcomeDialogs() { verifyFreeDiskSpace() { # 25MB is the minimum space needed (20MB install + 5MB one day of logs.) - requiredFreeBytes=25600 + requiredFreeBytes=51200 existingFreeBytes=`df -lk / 2>&1 | awk '{print $4}' | head -2 | tail -1` if ! [[ "$existingFreeBytes" =~ ^([0-9])+$ ]]; then From 88674e21cfa5ad0166f6444bf7d442fb4cd03c7c Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Sun, 21 Feb 2016 20:45:56 +0000 Subject: [PATCH 32/32] Update gravity.sh Clear out `pihole.*` files from `/etc/pihole` as they are no longer needed. --- gravity.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gravity.sh b/gravity.sh index 83700529..321aec27 100755 --- a/gravity.sh +++ b/gravity.sh @@ -328,6 +328,12 @@ function gravity_advanced() { } function gravity_reload() { + #Clear no longer needed files... + echo ":::" + echo -n "::: Cleaning up un-needed files..." + $SUDO rm /etc/pihole/pihole.* + echo " done!" + # Reload hosts file echo ":::" echo -n "::: Refresh lists in dnsmasq..."