diff --git a/README.md b/README.md
index 98a28a93..fb2179eb 100644
--- a/README.md
+++ b/README.md
@@ -17,9 +17,9 @@ The Pi-hole[®](https://pi-hole.net/trademark-rules-and-brand-guidelines/) is a
- **Free**: open source software which helps ensure _you_ are the sole person in control of your privacy
-----
-
-
-
+[](https://www.codacy.com/app/Pi-hole/pi-hole?utm_source=github.com&utm_medium=referral&utm_content=pi-hole/pi-hole&utm_campaign=Badge_Grade)
+[](https://travis-ci.org/pi-hole/pi-hole)
+[](https://www.bountysource.com/trackers/3011939-pi-hole-pi-hole?utm_source=3011939&utm_medium=shield&utm_campaign=TRACKER_BADGE)
## One-Step Automated Install
Those who want to get started quickly and conveniently may install Pi-hole using the following command:
@@ -67,7 +67,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_
diff --git a/advanced/Scripts/chronometer.sh b/advanced/Scripts/chronometer.sh
index 7c2d8b52..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,10 +464,8 @@ chronoFunc() {
fi
# Get refresh number
- if [[ "$*" == *"-r"* ]]; then
- num="$*"
- num="${num/*-r /}"
- num="${num/ */}"
+ if [[ "${extra_arg}" = "refresh" ]]; then
+ num="${extra_value}"
num_str="Refresh set for every $num seconds"
else
num_str=""
@@ -473,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}
@@ -521,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
@@ -561,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
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[*]}"
diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh
index c840ed04..1010f26c 100755
--- a/advanced/Scripts/piholeDebug.sh
+++ b/advanced/Scripts/piholeDebug.sh
@@ -109,7 +109,6 @@ FTL_PORT="${RUN_DIRECTORY}/pihole-FTL.port"
PIHOLE_LOG="${LOG_DIRECTORY}/pihole.log"
PIHOLE_LOG_GZIPS="${LOG_DIRECTORY}/pihole.log.[0-9].*"
PIHOLE_DEBUG_LOG="${LOG_DIRECTORY}/pihole_debug.log"
-PIHOLE_DEBUG_LOG_SANITIZED="${LOG_DIRECTORY}/pihole_debug-sanitized.log"
PIHOLE_FTL_LOG="${LOG_DIRECTORY}/pihole-FTL.log"
PIHOLE_WEB_SERVER_ACCESS_LOG_FILE="${WEB_SERVER_LOG_DIRECTORY}/access.log"
@@ -209,11 +208,6 @@ log_write() {
copy_to_debug_log() {
# Copy the contents of file descriptor 3 into the debug log
cat /proc/$$/fd/3 > "${PIHOLE_DEBUG_LOG}"
- # Since we use color codes such as '\e[1;33m', they should be removed before being
- # uploaded to our server, since it can't properly display in color
- # This is accomplished by use sed to remove characters matching that patter
- # The entire file is then copied over to a sanitized version of the log
- sed 's/\[[0-9;]\{1,5\}m//g' > "${PIHOLE_DEBUG_LOG_SANITIZED}" <<< cat "${PIHOLE_DEBUG_LOG}"
}
initialize_debug() {
@@ -269,6 +263,9 @@ compare_local_version_to_git_version() {
# The commit they are on
local remote_commit
remote_commit=$(git describe --long --dirty --tags --always)
+ # Status of the repo
+ local local_status
+ local_status=$(git status -s)
# echo this information out to the user in a nice format
# If the current version matches what pihole -v produces, the user is up-to-date
if [[ "${remote_version}" == "$(pihole -v | awk '/${search_term}/ {print $6}' | cut -d ')' -f1)" ]]; then
@@ -291,6 +288,16 @@ compare_local_version_to_git_version() {
fi
# echo the current commit
log_write "${INFO} Commit: ${remote_commit}"
+ # if `local_status` is non-null, then the repo is not clean, display details here
+ if [[ ${local_status} ]]; then
+ #Replace new lines in the status with 12 spaces to make the output cleaner
+ log_write "${INFO} Status: ${local_status//$'\n'/'\n '}"
+ local local_diff
+ local_diff=$(git diff)
+ if [[ ${local_diff} ]]; then
+ log_write "${INFO} Diff: ${local_diff//$'\n'/'\n '}"
+ fi
+ fi
# If git status failed,
else
# Return an error message
@@ -1134,20 +1141,20 @@ analyze_pihole_log() {
IFS="$OLD_IFS"
}
-tricorder_use_nc_or_ssl() {
- # Users can submit their debug logs using nc (unencrypted) or openssl (enrypted) if available
- # Check for openssl first since encryption is a good thing
- if command -v openssl &> /dev/null; then
+tricorder_use_nc_or_curl() {
+ # Users can submit their debug logs using nc (unencrypted) or curl (encrypted) if available
+ # Check for curl first since encryption is a good thing
+ if command -v curl &> /dev/null; then
# If the command exists,
- log_write " * Using ${COL_GREEN}openssl${COL_NC} for transmission."
- # encrypt and transmit the log and store the token returned in a variable
- tricorder_token=$(< ${PIHOLE_DEBUG_LOG_SANITIZED} openssl s_client -quiet -connect tricorder.pi-hole.net:${TRICORDER_SSL_PORT_NUMBER} 2> /dev/null)
+ log_write " * Using ${COL_GREEN}curl${COL_NC} for transmission."
+ # transmit he log via TLS and store the token returned in a variable
+ tricorder_token=$(curl --silent --upload-file ${PIHOLE_DEBUG_LOG} https://tricorder.pi-hole.net:${TRICORDER_SSL_PORT_NUMBER})
# Otherwise,
else
# use net cat
log_write "${INFO} Using ${COL_YELLOW}netcat${COL_NC} for transmission."
# Save the token returned by our server in a variable
- tricorder_token=$(< ${PIHOLE_DEBUG_LOG_SANITIZED} nc tricorder.pi-hole.net ${TRICORDER_NC_PORT_NUMBER})
+ tricorder_token=$(< ${PIHOLE_DEBUG_LOG} nc tricorder.pi-hole.net ${TRICORDER_NC_PORT_NUMBER})
fi
}
@@ -1173,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 ""
@@ -1182,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
@@ -1209,7 +1216,7 @@ upload_to_tricorder() {
log_write " * Please try again or contact the Pi-hole team for assistance."
fi
# Finally, show where the log file is no matter the outcome of the function so users can look at it
- log_write " * A local copy of the debug log can be found at: ${COL_CYAN}${PIHOLE_DEBUG_LOG_SANITIZED}${COL_NC}\\n"
+ log_write " * A local copy of the debug log can be found at: ${COL_CYAN}${PIHOLE_DEBUG_LOG}${COL_NC}\\n"
}
# Run through all the functions we made
diff --git a/advanced/Scripts/query.sh b/advanced/Scripts/query.sh
index b599aa6b..69a3c7a4 100644
--- a/advanced/Scripts/query.sh
+++ b/advanced/Scripts/query.sh
@@ -54,7 +54,7 @@ scanList(){
# /dev/null forces filename to be printed when only one list has been generated
# shellcheck disable=SC2086
case "${type}" in
- "exact" ) grep -i -E -l "(^|\\s)${domain}($|\\s|#)" ${lists} /dev/null 2>/dev/null;;
+ "exact" ) grep -i -E -l "(^|(?/dev/null;;
"wc" ) grep -i -o -m 1 "/${domain}/" ${lists} 2>/dev/null;;
* ) grep -i "${domain}" ${lists} /dev/null 2>/dev/null;;
esac
diff --git a/advanced/Scripts/update.sh b/advanced/Scripts/update.sh
index 59212a94..4d352777 100755
--- a/advanced/Scripts/update.sh
+++ b/advanced/Scripts/update.sh
@@ -146,6 +146,20 @@ main() {
FTL_update=false
fi
+ # Determine FTL branch
+ local ftlBranch
+ if [[ -f "/etc/pihole/ftlbranch" ]]; then
+ ftlBranch=$( /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
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()
diff --git a/advanced/index.php b/advanced/index.php
index 49eb0f45..78135e1a 100644
--- a/advanced/index.php
+++ b/advanced/index.php
@@ -40,13 +40,6 @@ $validExtTypes = array("asp", "htm", "html", "php", "rss", "xml", "");
// Get extension of current URL
$currentUrlExt = pathinfo($_SERVER["REQUEST_URI"], PATHINFO_EXTENSION);
-// Check if this is served over HTTP or HTTPS
-if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") {
- $proto = "https";
-} else {
- $proto = "http";
-}
-
// Set mobile friendly viewport
$viewPort = '';
@@ -229,10 +222,10 @@ setHeader();
=$viewPort ?>
-
-
+
+