From 01211364986a842ace33bab93607eb4455476af8 Mon Sep 17 00:00:00 2001 From: Victor Marquez Date: Fri, 19 Aug 2016 20:45:17 -0400 Subject: [PATCH 1/5] Added window.close() to index.html Adding window.close() will automatically close any pop-ups that might get loaded with a blocked ad. --- advanced/index.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/advanced/index.html b/advanced/index.html index 6bfc7988..3a4abe1f 100644 --- a/advanced/index.html +++ b/advanced/index.html @@ -1,4 +1,7 @@ + + + - \ No newline at end of file + From 6c0a8a43377bc24994e50cc2c6c6b7c6956a088c Mon Sep 17 00:00:00 2001 From: "Daniel (Fourdee)" Date: Thu, 25 Aug 2016 12:11:54 +0100 Subject: [PATCH 2/5] Minor - Corrected var names Kilobyte values are used, not Bytes. --- automated install/basic-install.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 0ed95976..415251e3 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -158,27 +158,27 @@ verifyFreeDiskSpace() { # 50MB is the minimum space needed (45MB install (includes web admin bootstrap/jquery libraries etc) + 5MB one day of logs.) # - Fourdee: Local ensures the variable is only created, and accessible within this function/void. Generally considered a "good" coding practice for non-global variables. - local requiredFreeBytes=51200 - local existingFreeBytes=$(df -Pk | grep -m1 '\/$' | awk '{print $4}') + local required_free_kilobytes=51200 + local existing_free_kilobytes=$(df -Pk | grep -m1 '\/$' | awk '{print $4}') # - Unknown free disk space , not a integer - if ! [[ "$existingFreeBytes" =~ ^([0-9])+$ ]]; then + if ! [[ "$existing_free_kilobytes" =~ ^([0-9])+$ ]]; then whiptail --title "Unknown free disk space" --yesno "We were unable to determine available free disk space on this system.\n\nYou may override this check and force the installation, however, it is not recommended.\n\nWould you like to continue with the installation?" --defaultno --backtitle "Pi-hole" $r $c local choice=$? if (( $choice != 0 )); then - echo "non-integer value from existingFreeBytes ($existingFreeBytes)" + echo "non-integer value from existing_free_kilobytes ($existing_free_kilobytes)" echo "Unknown free space, user aborted, exiting..." exit 1 fi # - Insufficient free disk space - elif [[ $existingFreeBytes -lt $requiredFreeBytes ]]; then + elif [[ $existing_free_kilobytes -lt $required_free_kilobytes ]]; 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" + 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 $required_free_kilobytes Bytes.\nYou only have $existing_free_kilobytes 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 "$existing_free_kilobytes is less than $required_free_kilobytes" echo "Insufficient free space, exiting..." exit 1 From 49ded54306523b571b0c58bba9e968310f61f78f Mon Sep 17 00:00:00 2001 From: "Daniel (Fourdee)" Date: Thu, 25 Aug 2016 12:17:36 +0100 Subject: [PATCH 3/5] Minor - Update descriptions Apply to whiptail descriptions also. --- 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 415251e3..614ff291 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -177,7 +177,7 @@ verifyFreeDiskSpace() { # - Insufficient free disk space elif [[ $existing_free_kilobytes -lt $required_free_kilobytes ]]; 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 $required_free_kilobytes Bytes.\nYou only have $existing_free_kilobytes 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 + 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 $required_free_kilobytes KiloBytes.\nYou only have $existing_free_kilobytes KiloBytes 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 "$existing_free_kilobytes is less than $required_free_kilobytes" echo "Insufficient free space, exiting..." exit 1 From 29b548f07c94618ea683fbd533bf28d45df2b09a Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Fri, 26 Aug 2016 09:39:27 +0100 Subject: [PATCH 4/5] Add queryfunc --- pihole | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pihole b/pihole index 64a36c59..0b67d6c0 100755 --- a/pihole +++ b/pihole @@ -62,6 +62,11 @@ function setupLCDFunction { exit 1 } +function queryFunc { + for list in /etc/pihole/list.*;do echo $list;grep '$@' $list;done + exit 1 +} + function chronometerFunc { shift $SUDO /opt/pihole/chronometer.sh "$@" @@ -96,6 +101,7 @@ function helpFunc { echo "::: -c, chronometer Calculates stats and displays to an LCD" echo "::: -h, help Show this help dialog" echo "::: -v, version Show current versions" + echo "::: -q, query Query the adlists for a specific domain" echo "::: uninstall Uninstall Pi-Hole from your system :(!" exit 1 } @@ -116,6 +122,7 @@ case "$1" in "-c" | "chronometer" ) chronometerFunc "$@";; "-h" | "help" ) helpFunc;; "-v" | "version" ) versionFunc;; +"-q" | "query" ) queryFunc;; "uninstall" ) uninstallFunc;; * ) helpFunc;; esac From 77135ca3c74a6aca0265b0696aadd73f01b051ad Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Fri, 26 Aug 2016 10:09:39 +0100 Subject: [PATCH 5/5] Actually pass through the argument to the function --- pihole | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pihole b/pihole index 0b67d6c0..7d0f4c18 100755 --- a/pihole +++ b/pihole @@ -63,7 +63,8 @@ function setupLCDFunction { } function queryFunc { - for list in /etc/pihole/list.*;do echo $list;grep '$@' $list;done + domain=$2 + for list in /etc/pihole/list.*;do echo $list;grep ${domain} $list;done exit 1 } @@ -122,7 +123,7 @@ case "$1" in "-c" | "chronometer" ) chronometerFunc "$@";; "-h" | "help" ) helpFunc;; "-v" | "version" ) versionFunc;; -"-q" | "query" ) queryFunc;; +"-q" | "query" ) queryFunc "$@";; "uninstall" ) uninstallFunc;; * ) helpFunc;; esac