From b7f6498a5c0d0464fe27b3b70758394201dc3f0b Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Fri, 5 Feb 2016 15:50:15 +0000 Subject: [PATCH 01/10] Create CONTRIBUTING.md Initial commit. Basic list, could probably do with some work.... --- CONTRIBUTING.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..8fac7c45 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,6 @@ +This is a basic checklist for now, We will update it in future. + +* Fork the repo and create your new branch based on the `development` branch. +* Submit Pull Requests to the development branch only. +* Before Submitting your Pull Request, merge `development` with your new branch and fix any conflicts. (Make sure you don't break anything in development!) +* Be patient. We will review all submitted pull requests, but our focus is on stability.. please don't be offended if we reject your PR, or it appears we're doing nothing with it! We'll get around to it.. From 31fda124f306d3f9aa8679a98347357de68d25e6 Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Fri, 5 Feb 2016 12:22:23 -0500 Subject: [PATCH 02/10] Add to contributor info --- CONTRIBUTING.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8fac7c45..1313f599 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,8 @@ -This is a basic checklist for now, We will update it in future. +This is a basic checklist for now, We will update it in the future. * Fork the repo and create your new branch based on the `development` branch. +* Commit Unix line endings +* If you want, try to keep to the theme of black holes/gravity. This can add some fun to your submission. * Submit Pull Requests to the development branch only. * Before Submitting your Pull Request, merge `development` with your new branch and fix any conflicts. (Make sure you don't break anything in development!) * Be patient. We will review all submitted pull requests, but our focus is on stability.. please don't be offended if we reject your PR, or it appears we're doing nothing with it! We'll get around to it.. From 9941651b3c51e61d5b758d12fc9c9ad10b5450a6 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sat, 6 Feb 2016 13:02:21 +0000 Subject: [PATCH 03/10] Addresses changes as requested by @jacobsalmela in #282 --- automated install/basic-install.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 5400e683..90fe3221 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -571,6 +571,18 @@ $SUDO mv $tmpLog $instalLogLoc displayFinalMessage +echo -n "::: Restarting services..." # Start services $SUDO service dnsmasq start $SUDO service lighttpd start +echo " done." + +echo ":::" +echo "::: Installation Complete! Configure your devices to use the Pi-hole as their DNS server using:" +echo "::: $IPv4addr" +echo "::: $piholeIPv6" +echo ":::" +echo "::: If you set a new IP address, you should restart the Pi." +echo "::: " +echo "::: The install log is in /etc/pihole.log" + From 2d1c0be24ece43900944e6a86935b9bb0295eef4 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sat, 6 Feb 2016 13:04:54 +0000 Subject: [PATCH 04/10] fix reference to install log location. #282 --- 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 90fe3221..1cffab76 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -584,5 +584,5 @@ echo "::: $piholeIPv6" echo ":::" echo "::: If you set a new IP address, you should restart the Pi." echo "::: " -echo "::: The install log is in /etc/pihole.log" +echo "::: The install log is located at: /etc/pihole/install.log" From b2fbf46e605c6f316a9e759a6694f23a8332393e Mon Sep 17 00:00:00 2001 From: Promofaux Date: Tue, 9 Feb 2016 20:43:45 +0000 Subject: [PATCH 05/10] Added more adlists to the defaults. By default we now block ~ 155,600 ad and tracker domains. Includes NoTrack's tracker list. --- adlists.default | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/adlists.default b/adlists.default index dd391357..c2385f7e 100644 --- a/adlists.default +++ b/adlists.default @@ -6,3 +6,12 @@ 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://securemecca.com/Downloads/hosts.txt +https://hosts.neocities.org/ +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 +https://raw.githubusercontent.com/quidsup/notrack/master/trackers.txt + From a734927591336cc0ce686fcbcbe19b4cef435a81 Mon Sep 17 00:00:00 2001 From: Daniel Fayette Date: Tue, 9 Feb 2016 19:51:03 -0600 Subject: [PATCH 06/10] Fixes gravity_transport variable interpretation. Adding (") around Variables passed to function ensures spaces are handled and that missing arguments are accounted for. --- gravity.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gravity.sh b/gravity.sh index 5097e050..c6fbca53 100755 --- a/gravity.sh +++ b/gravity.sh @@ -186,7 +186,7 @@ function gravity_spinup() { # Default is a simple request *) cmd_ext="" esac - gravity_transport $url $cmd_ext $agent + gravity_transport "$url" "$cmd_ext" "$agent" done } From 46d7bfecdb6e2c7c4ab5bf40d0236b768bf10771 Mon Sep 17 00:00:00 2001 From: Daniel Fayette Date: Wed, 10 Feb 2016 09:34:06 -0600 Subject: [PATCH 07/10] Check for 25mb of free disk space before install Function will check the free space of / (root) If the free space is less than 25MB it will give directions on how to expand the disk. Fixes #163 --- automated install/basic-install.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index bc027cbd..a0f0ebcb 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -115,6 +115,20 @@ welcomeDialogs() { In the next section, you can choose to use your current network settings (DHCP) or to manually edit them." $r $c } + +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 +} + + chooseInterface() { # Turn the available interfaces into an array so it can be used with a whiptail dialog interfacesArray=() @@ -557,6 +571,9 @@ The install log is in /etc/pihole." $r $c $SUDO mkdir -p /etc/pihole/ welcomeDialogs +# Verify there is enough disk space for the install +verifyFreeDiskSpace + # Just back up the original Pi-hole right away since it won't take long and it gets it out of the way backupLegacyPihole # Find interfaces and let the user choose one From b5406240c68252c6a6cd8afc2428780b0efe8fb5 Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Wed, 10 Feb 2016 19:07:48 -0500 Subject: [PATCH 08/10] Fixes IPv6 surviving a reinstall --- automated install/basic-install.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index bc027cbd..00431c69 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -148,6 +148,12 @@ chooseInterface() { } +cleanupIPv6() { + # Removes IPv6 indicator file if we are not using IPv6 + if [ -f "/etc/pihole/.useIPv6" ] && [ ! $useIPv6 ]; then + rm /etc/pihole/.useIPv6 + fi +} use4andor6() { # Let use select IPv4 and/or IPv6 @@ -187,6 +193,7 @@ use4andor6() { echo "::: Exiting" exit 1 fi + cleanupIPv6 else echo "::: Cancel selected. Exiting..." exit 1 From 4c24186911f01292932228c00b4f73bad4a94c0a Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sun, 14 Feb 2016 02:58:09 +0000 Subject: [PATCH 09/10] Fixes divide by zero error. --- advanced/Scripts/chronometer.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/advanced/Scripts/chronometer.sh b/advanced/Scripts/chronometer.sh index 2fe00498..9153d9ba 100755 --- a/advanced/Scripts/chronometer.sh +++ b/advanced/Scripts/chronometer.sh @@ -51,9 +51,13 @@ function CalcblockedToday(){ function CalcPercentBlockedToday(){ if [ "$queriesToday" != "Err." ] && [ "$blockedToday" != "Err." ]; then - #scale 2 rounds the number down, so we'll do scale 4 and then trim the last 2 zeros - percentBlockedToday=$(echo "scale=4; $blockedToday/$queriesToday*100" | bc) - percentBlockedToday=$(sed 's/.\{2\}$//' <<< "$percentBlockedToday") + if [ "$queriesToday" != 0 ]; then #Fixes divide by zero error :) + #scale 2 rounds the number down, so we'll do scale 4 and then trim the last 2 zeros + percentBlockedToday=$(echo "scale=4; $blockedToday/$queriesToday*100" | bc) + percentBlockedToday=$(sed 's/.\{2\}$//' <<< "$percentBlockedToday") + else + percentBlockedToday=0 + fi fi } From 3a887af513295a03d754edfe13e5070c400e01e1 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Sun, 14 Feb 2016 22:24:21 +0000 Subject: [PATCH 10/10] Addresses #313 path to white and blacklist scripts moved to variables and updated to include full path --- gravity.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gravity.sh b/gravity.sh index 948c06f3..6e620d4d 100755 --- a/gravity.sh +++ b/gravity.sh @@ -31,6 +31,8 @@ piholeIPv6file=/etc/pihole/.useIPv6 adListFile=/etc/pihole/adlists.list adListDefault=/etc/pihole/adlists.default +whitelistScript=/usr/local/bin/whitelist.sh +blacklistScript=/usr/local/bin/blacklist.sh if [[ -f $piholeIPfile ]];then # 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 @@ -220,7 +222,7 @@ function gravity_Schwarzchild() { function gravity_Blacklist(){ # Append blacklist entries if they exist echo -n "::: Running blacklist script to update HOSTS file...." - blacklist.sh -f -nr -q > /dev/null & spinner $! + $blacklistScript -f -nr -q > /dev/null & spinner $! numBlacklisted=$(wc -l < "/etc/pihole/blacklist.txt") plural=; [[ "$numBlacklisted" != "1" ]] && plural=s @@ -245,7 +247,7 @@ function gravity_Whitelist() { echo " done!" echo -n "::: Running whitelist script to update HOSTS file...." - whitelist.sh -f -nr -q ${urls[@]} > /dev/null & spinner $! + $whitelistScript -f -nr -q ${urls[@]} > /dev/null & spinner $! numWhitelisted=$(wc -l < "/etc/pihole/whitelist.txt") plural=; [[ "$numWhitelisted" != "1" ]] && plural=s