From 531398b532f38f268a205593ee1c930e19a96790 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Fri, 2 Sep 2016 11:27:13 +0100 Subject: [PATCH 1/8] Remove defunct list from adlists.default See issue #650 --- adlists.default | 1 - 1 file changed, 1 deletion(-) diff --git a/adlists.default b/adlists.default index 2c171e87..5a803400 100644 --- a/adlists.default +++ b/adlists.default @@ -14,7 +14,6 @@ https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts # Other lists we consider safe: -http://adblock.gjtech.net/?format=unix-hosts http://mirror1.malwaredomains.com/files/justdomains http://sysctl.org/cameleon/hosts https://zeustracker.abuse.ch/blocklist.php?download=domainblocklist From 8cb2f85a08134d70e3eb022395de763faa9d0a42 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Fri, 2 Sep 2016 16:39:34 +0100 Subject: [PATCH 2/8] Replace `truncate` command with `echo " " >` --- advanced/Scripts/piholeLogFlush.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advanced/Scripts/piholeLogFlush.sh b/advanced/Scripts/piholeLogFlush.sh index db97f8cb..8b16e3d5 100755 --- a/advanced/Scripts/piholeLogFlush.sh +++ b/advanced/Scripts/piholeLogFlush.sh @@ -11,5 +11,5 @@ # (at your option) any later version. echo -n "::: Flushing /var/log/pihole.log ..." -truncate -s 0 /var/log/pihole.log +echo " " > /var/log/pihole.log echo "... done!" From 04c60e8a1c2aa2f6c06e6277018cea2b7db07eaf Mon Sep 17 00:00:00 2001 From: Promofaux Date: Mon, 5 Sep 2016 15:52:09 +0100 Subject: [PATCH 3/8] Switch fedora and debian install check order --- automated install/basic-install.sh | 35 +++++++++++++++--------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 32a80307..0caa8bf7 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -57,7 +57,24 @@ else fi # Compatibility -if [ -x "$(command -v rpm)" ];then + +if [ -x "$(command -v apt-get)" ];then + # Debian Family + PKG_MANAGER="apt-get" + PKG_CACHE="/var/cache/apt" + UPDATE_PKG_CACHE="$PKG_MANAGER -qq update" + PKG_UPDATE="$PKG_MANAGER upgrade" + PKG_INSTALL="$PKG_MANAGER --yes --quiet install" + PKG_COUNT="$PKG_MANAGER -s -o Debug::NoLocking=true upgrade | grep -c ^Inst" + INSTALLER_DEPS=( apt-utils whiptail dhcpcd5) + PIHOLE_DEPS=( dnsutils bc dnsmasq lighttpd php5-common php5-cgi php5 git curl unzip wget sudo netcat ) + LIGHTTPD_USER="www-data" + LIGHTTPD_GROUP="www-data" + LIGHTTPD_CFG="lighttpd.conf.debian" + package_check() { + dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -c "ok installed" + } +elif [ -x "$(command -v rpm)" ];then # Fedora Family if [ -x "$(command -v dnf)" ];then PKG_MANAGER="dnf" @@ -77,22 +94,6 @@ if [ -x "$(command -v rpm)" ];then package_check() { rpm -qa | grep ^$1- > /dev/null } -elif [ -x "$(command -v apt-get)" ];then - # Debian Family - PKG_MANAGER="apt-get" - PKG_CACHE="/var/cache/apt" - UPDATE_PKG_CACHE="$PKG_MANAGER -qq update" - PKG_UPDATE="$PKG_MANAGER upgrade" - PKG_INSTALL="$PKG_MANAGER --yes --quiet install" - PKG_COUNT="$PKG_MANAGER -s -o Debug::NoLocking=true upgrade | grep -c ^Inst" - INSTALLER_DEPS=( apt-utils whiptail dhcpcd5) - PIHOLE_DEPS=( dnsutils bc dnsmasq lighttpd php5-common php5-cgi php5 git curl unzip wget sudo netcat ) - LIGHTTPD_USER="www-data" - LIGHTTPD_GROUP="www-data" - LIGHTTPD_CFG="lighttpd.conf.debian" - package_check() { - dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -c "ok installed" - } else echo "OS distribution not supported" exit From 19b656132d98e386f249125f5d73ac00117c74f0 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Tue, 6 Sep 2016 19:16:04 +0100 Subject: [PATCH 4/8] Make the output of pihole -q a bit clearer. Bye Bye nifty one-liner! --- pihole | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pihole b/pihole index 29f8821b..573fb118 100755 --- a/pihole +++ b/pihole @@ -72,7 +72,16 @@ function setupLCDFunction { function queryFunc { domain=$2 - for list in /etc/pihole/list.*;do echo $list;grep ${domain} $list;done + for list in /etc/pihole/list.* + do + count=$(grep ${domain} $list | wc -l) + + if [[ ${count} > 0 ]]; then + echo "::: ${list} (${count} results)" + grep ${domain} ${list} + echo "" + fi + done exit 1 } From 4ec01769cb9a883c7e8f26c3117e5303eae87cea Mon Sep 17 00:00:00 2001 From: Promofaux Date: Tue, 6 Sep 2016 19:21:56 +0100 Subject: [PATCH 5/8] Appease Jacob. --- pihole | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pihole b/pihole index 573fb118..bd948b55 100755 --- a/pihole +++ b/pihole @@ -75,12 +75,11 @@ function queryFunc { for list in /etc/pihole/list.* do count=$(grep ${domain} $list | wc -l) - + echo "::: ${list} (${count} results)" if [[ ${count} > 0 ]]; then - echo "::: ${list} (${count} results)" grep ${domain} ${list} - echo "" fi + echo "" done exit 1 } From eb201b614abbe2c2d61f93005d26c8b8f818d50b Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Tue, 6 Sep 2016 19:29:30 +0100 Subject: [PATCH 6/8] Change log flush time to 00:00 --- advanced/pihole.cron | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/advanced/pihole.cron b/advanced/pihole.cron index 712679ac..d4ec56a7 100644 --- a/advanced/pihole.cron +++ b/advanced/pihole.cron @@ -21,6 +21,6 @@ # This will be used for a historical view of your Pi-hole's performance #50 23 * * * root /usr/local/bin/dailyLog.sh # note: this is outdated -# Pi-hole: Flush the log daily at 11:58 so it doesn't get out of control +# Pi-hole: Flush the log daily at 00:00 so it doesn't get out of control # Stats will be viewable in the Web interface thanks to the cron job above -58 23 * * * root /usr/local/bin/pihole flush +00 00 * * * root /usr/local/bin/pihole flush From 95ee3216c42151aa4fbaa17b80d587aad7180836 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Tue, 6 Sep 2016 21:57:17 +0100 Subject: [PATCH 7/8] Add the newer pihole command tags to the bash auto complete! --- advanced/bash-completion/pihole | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advanced/bash-completion/pihole b/advanced/bash-completion/pihole index e2c70558..2d6aafae 100644 --- a/advanced/bash-completion/pihole +++ b/advanced/bash-completion/pihole @@ -4,7 +4,7 @@ _pihole() COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" - opts="whitelist blacklist debug flush updateDashboard updateGravity setupLCD chronometer uninstall help" + opts="blacklist chronometer debug flush help query setupLCD uninstall updateDashboard updateGravity updatePihole version whitelist" COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 From c2cb92a0b092863050fedb546ce6a02647fa9ad4 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Thu, 8 Sep 2016 23:42:05 +0100 Subject: [PATCH 8/8] Add cron to apt-get dependencies --- 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 0caa8bf7..97171c31 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -67,7 +67,7 @@ if [ -x "$(command -v apt-get)" ];then PKG_INSTALL="$PKG_MANAGER --yes --quiet install" PKG_COUNT="$PKG_MANAGER -s -o Debug::NoLocking=true upgrade | grep -c ^Inst" INSTALLER_DEPS=( apt-utils whiptail dhcpcd5) - PIHOLE_DEPS=( dnsutils bc dnsmasq lighttpd php5-common php5-cgi php5 git curl unzip wget sudo netcat ) + PIHOLE_DEPS=( dnsutils bc dnsmasq lighttpd php5-common php5-cgi php5 git curl unzip wget sudo netcat cron ) LIGHTTPD_USER="www-data" LIGHTTPD_GROUP="www-data" LIGHTTPD_CFG="lighttpd.conf.debian"