From 422680ee9f85f5bf0ee0d1a98fa922aa3fe6c62d Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Sun, 14 Apr 2019 13:03:25 -0700 Subject: [PATCH 01/12] Fix chronometer refresh incorrectly reading the long argument sleep time `-r` worked, but `--refresh` did not. Fixes #2703 Signed-off-by: Mcat12 --- advanced/Scripts/chronometer.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/advanced/Scripts/chronometer.sh b/advanced/Scripts/chronometer.sh index 7c2d8b52..614d05ed 100755 --- a/advanced/Scripts/chronometer.sh +++ b/advanced/Scripts/chronometer.sh @@ -463,8 +463,7 @@ chronoFunc() { # Get refresh number if [[ "$*" == *"-r"* ]]; then num="$*" - num="${num/*-r /}" - num="${num/ */}" + num="${num/*-r* /}" num_str="Refresh set for every $num seconds" else num_str="" From 84244b7cd53c7373c592ae2891c897bb869e5d95 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Tue, 16 Apr 2019 18:30:04 +0200 Subject: [PATCH 02/12] Fix indentation in display of branches available during pihole checkout Signed-off-by: DL6ER --- advanced/Scripts/piholeCheckout.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/piholeCheckout.sh b/advanced/Scripts/piholeCheckout.sh index 1bfe5e21..c4b07a98 100644 --- a/advanced/Scripts/piholeCheckout.sh +++ b/advanced/Scripts/piholeCheckout.sh @@ -115,7 +115,7 @@ checkout() { if [[ "${corebranches[*]}" == *"master"* ]]; then echo -e "${OVER} ${TICK} $str" - echo -e "${INFO} ${#corebranches[@]} branches available for Pi-hole Core" + echo -e " ${INFO} ${#corebranches[@]} branches available for Pi-hole Core" else # Print STDERR output from get_available_branches echo -e "${OVER} ${CROSS} $str\\n\\n${corebranches[*]}" @@ -142,7 +142,7 @@ checkout() { if [[ "${webbranches[*]}" == *"master"* ]]; then echo -e "${OVER} ${TICK} $str" - echo -e "${INFO} ${#webbranches[@]} branches available for Web Admin" + echo -e " ${INFO} ${#webbranches[@]} branches available for Web Admin" else # Print STDERR output from get_available_branches echo -e "${OVER} ${CROSS} $str\\n\\n${webbranches[*]}" From d2c7c426de27870a74bd26904c7b9bf27bacced8 Mon Sep 17 00:00:00 2001 From: Mark Drobnak Date: Mon, 22 Apr 2019 19:43:26 -0700 Subject: [PATCH 03/12] Fix teleporter backup file extension Fixes #2714 Signed-off-by: Mark Drobnak --- advanced/Scripts/webpage.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index c6852896..c8dfb129 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -530,7 +530,7 @@ Interfaces: Teleporter() { local datetimestamp=$(date "+%Y-%m-%d_%H-%M-%S") - php /var/www/html/admin/scripts/pi-hole/php/teleporter.php > "pi-hole-teleporter_${datetimestamp}.zip" + php /var/www/html/admin/scripts/pi-hole/php/teleporter.php > "pi-hole-teleporter_${datetimestamp}.tar.gz" } addAudit() From 037737d6534c8e9e66f83d0ba7a2d1a0c7ffff40 Mon Sep 17 00:00:00 2001 From: Jan Piskvor Martinec Date: Tue, 23 Apr 2019 16:02:25 +0200 Subject: [PATCH 04/12] Show $UPDATE_PKG_CACHE content in error message. Fixes the typo in update_package_cache(), where the error message contained the color code twice, instead of the $UPDATE_PKG_CACHE text. Signed-off-by: Jan Piskvor Martinec --- 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 94377647..c915df33 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1560,7 +1560,7 @@ update_package_cache() { else # show an error and exit printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}" - printf " %bError: Unable to update package cache. Please try \"%s\"%b" "${COL_LIGHT_RED}" "${COL_LIGHT_RED}" "${COL_NC}" + printf " %bError: Unable to update package cache. Please try \"%s\"%b" "${COL_LIGHT_RED}" "${UPDATE_PKG_CACHE}" "${COL_NC}" return 1 fi } From 466fd79c66cea40d97490b8c120c1fe5e2ace2a8 Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Sat, 27 Apr 2019 12:39:45 -0700 Subject: [PATCH 05/12] Fix getting IP address in the presence of similar subnets Change was suggested by @computergeek125 in #2387 Signed-off-by: Mcat12 --- 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 c915df33..ed5d5f3c 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -525,7 +525,7 @@ find_IPv4_information() { fi # Append the CIDR notation to the IP address, if valid_ip fails this should return 127.0.0.1/8 - IPV4_ADDRESS=$(ip -oneline -family inet address show | grep "${IPv4bare}" | awk '{print $4}' | awk 'END {print}') + IPV4_ADDRESS=$(ip -oneline -family inet address show | grep "${IPv4bare}/" | awk '{print $4}' | awk 'END {print}') } # Get available interfaces that are UP From add5e4ca5ef004c7d100d79c69651ed0548ea868 Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Sat, 27 Apr 2019 13:39:44 -0700 Subject: [PATCH 06/12] Explicitly allow only -r and --refresh in argument handler It is already checked, but this make the code explicit. Signed-off-by: Mcat12 --- advanced/Scripts/chronometer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advanced/Scripts/chronometer.sh b/advanced/Scripts/chronometer.sh index 614d05ed..c62e4f29 100755 --- a/advanced/Scripts/chronometer.sh +++ b/advanced/Scripts/chronometer.sh @@ -461,7 +461,7 @@ chronoFunc() { fi # Get refresh number - if [[ "$*" == *"-r"* ]]; then + if [[ "$*" == *"-r" || "$*" == *"-r "* || "$*" == *"--refresh" || "$*" == *"--refresh "* ]]; then num="$*" num="${num/*-r* /}" num_str="Refresh set for every $num seconds" From b320e749218208081122ad3e2cff0289d5f3d353 Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Sat, 27 Apr 2019 14:05:04 -0700 Subject: [PATCH 07/12] Improve argument handling Signed-off-by: Mcat12 --- advanced/Scripts/chronometer.sh | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/advanced/Scripts/chronometer.sh b/advanced/Scripts/chronometer.sh index c62e4f29..1a4ce993 100755 --- a/advanced/Scripts/chronometer.sh +++ b/advanced/Scripts/chronometer.sh @@ -444,6 +444,9 @@ get_strings() { } chronoFunc() { + local extra_arg="$1" + local extra_value="$2" + get_init_stats for (( ; ; )); do @@ -461,9 +464,8 @@ chronoFunc() { fi # Get refresh number - if [[ "$*" == *"-r" || "$*" == *"-r "* || "$*" == *"--refresh" || "$*" == *"--refresh "* ]]; then - num="$*" - num="${num/*-r* /}" + if [[ "${extra_arg}" = "refresh" ]]; then + num="${extra_value}" num_str="Refresh set for every $num seconds" else num_str="" @@ -472,7 +474,7 @@ chronoFunc() { clear # Remove exit message heading on third refresh - if [[ "$count" -le 2 ]] && [[ "$*" != *"-e"* ]]; then + if [[ "$count" -le 2 ]] && [[ "${extra_arg}" != "exit" ]]; then echo -e " ${COL_LIGHT_GREEN}Pi-hole Chronometer${COL_NC} $num_str ${COL_LIGHT_RED}Press Ctrl-C to exit${COL_NC} @@ -520,10 +522,10 @@ chronoFunc() { fi # Handle exit/refresh options - if [[ "$*" == *"-e"* ]]; then + if [[ "${extra_arg}" == "exit" ]]; then exit 0 else - if [[ "$*" == *"-r"* ]]; then + if [[ "${extra_arg}" == "refresh" ]]; then sleep "$num" else sleep 5 @@ -560,12 +562,10 @@ if [[ $# = 0 ]]; then chronoFunc fi -for var in "$@"; do - case "$var" in - "-j" | "--json" ) jsonFunc;; - "-h" | "--help" ) helpFunc;; - "-r" | "--refresh" ) chronoFunc "$@";; - "-e" | "--exit" ) chronoFunc "$@";; - * ) helpFunc "?";; - esac -done +case "$1" in + "-j" | "--json" ) jsonFunc;; + "-h" | "--help" ) helpFunc;; + "-r" | "--refresh" ) chronoFunc refresh "$2";; + "-e" | "--exit" ) chronoFunc exit;; + * ) helpFunc "?";; +esac From 5532df24e4af9181d7c16c5676de922e0c4587b6 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Fri, 3 May 2019 02:46:27 -0700 Subject: [PATCH 08/12] Pi-hole Debug - tricorder upload function calls Fix tricorder upload function calls to use new curl function. --- advanced/Scripts/piholeDebug.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index 591a7ae4..1010f26c 100755 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -1180,7 +1180,7 @@ upload_to_tricorder() { # let the user know log_write "${INFO} Debug script running in automated mode" # and then decide again which tool to use to submit it - tricorder_use_nc_or_ssl + tricorder_use_nc_or_curl # If we're not running in automated mode, else echo "" @@ -1189,7 +1189,7 @@ upload_to_tricorder() { read -r -p "[?] Would you like to upload the log? [y/N] " response case ${response} in # If they say yes, run our function for uploading the log - [yY][eE][sS]|[yY]) tricorder_use_nc_or_ssl;; + [yY][eE][sS]|[yY]) tricorder_use_nc_or_curl;; # If they choose no, just exit out of the script *) log_write " * Log will ${COL_GREEN}NOT${COL_NC} be uploaded to tricorder.";exit; esac From ec06fd0ad413823b56503711cbe18914429a75da Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Sat, 4 May 2019 11:35:21 -0700 Subject: [PATCH 09/12] Fix incorrect adlist query when an adlist is blocked during gravity hosts-file.net was hard-coded as the domain to check instead of the actual domain. Signed-off-by: Mcat12 --- gravity.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gravity.sh b/gravity.sh index 75a51608..ff0343e9 100755 --- a/gravity.sh +++ b/gravity.sh @@ -268,7 +268,7 @@ gravity_DownloadBlocklistFromUrl() { port=443; else port=80 fi - bad_list=$(pihole -q -adlist hosts-file.net | head -n1 | awk -F 'Match found in ' '{print $2}') + bad_list=$(pihole -q -adlist "${domain}" | head -n1 | awk -F 'Match found in ' '{print $2}') echo -e "${OVER} ${CROSS} ${str} ${domain} is blocked by ${bad_list%:}. Using DNS on ${PIHOLE_DNS_1} to download ${url}"; echo -ne " ${INFO} ${str} Pending..." cmd_ext="--resolve $domain:$port:$ip $cmd_ext" From 95150a5d8568700efd00e80e100c67a3e2bead24 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Tue, 7 May 2019 19:42:11 +0200 Subject: [PATCH 10/12] Clone twenty instead of only one commit when installing Pi-hole. This ensures that we clone at least one tagged commit in case we need to push changes to master. Signed-off-by: DL6ER --- 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 ed5d5f3c..5cb4e5cc 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -413,7 +413,7 @@ make_repo() { rm -rf "${directory}" fi # Clone the repo and return the return code from this command - git clone -q --depth 1 "${remoteRepo}" "${directory}" &> /dev/null || return $? + git clone -q --depth 20 "${remoteRepo}" "${directory}" &> /dev/null || return $? # Show a colored message showing it's status printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}" # Always return 0? Not sure this is correct From 74836bebe47590255cd1a9d2ad9ad10a64929bfe Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Tue, 7 May 2019 11:10:51 -0700 Subject: [PATCH 11/12] README StickerMule URL Change StickerMule reflink to Team Pi-hole link. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 92b85906..67893ec7 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ Sending a donation using our links below is **extremely helpful** in offsetting If you'd rather not [donate](https://pi-hole.net/donate/) (_which is okay!_), there are other ways you can help support us: - [Patreon](https://patreon.com/pihole) _Become a patron for rewards_ - [Digital Ocean](http://www.digitalocean.com/?refcode=344d234950e1) _affiliate link_ -- [Stickermule](https://www.stickermule.com/unlock?ref_id=6055890701&utm_medium=link&utm_source=invite) _earn a $10 credit after your first purchase_ +- [Stickermule](https://www.stickermule.com/unlock?ref_id=9127301701&utm_medium=link&utm_source=invite) _earn a $10 credit after your first purchase_ - [Pi-hole Swag Store](https://pi-hole.net/shop/) _affiliate link_ - [Amazon](http://www.amazon.com/exec/obidos/redirect-home/pihole09-20) _affiliate link_ - [DNS Made Easy](https://cp.dnsmadeeasy.com/u/133706) _affiliate link_ From 3220e2b978d934898ff7172d48f613d5d4131945 Mon Sep 17 00:00:00 2001 From: mpiederiet Date: Tue, 7 May 2019 14:54:25 +0200 Subject: [PATCH 12/12] Fix for preventing git error message in cron logs Fix to prevent "fatal: No names found, cannot describe anything" git message during scheduled update checks Signed-off-by: DL6ER --- advanced/Scripts/updatecheck.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advanced/Scripts/updatecheck.sh b/advanced/Scripts/updatecheck.sh index 257c1929..26dc2ac2 100755 --- a/advanced/Scripts/updatecheck.sh +++ b/advanced/Scripts/updatecheck.sh @@ -34,7 +34,7 @@ function get_local_branch() { function get_local_version() { # Return active branch cd "${1}" 2> /dev/null || return 1 - git describe --long --dirty --tags || return 1 + git describe --long --dirty --tags 2> /dev/null || return 1 } # Source the setupvars config file