mirror of
https://github.com/pi-hole/pi-hole
synced 2025-01-22 05:51:15 +00:00
Merge pull request #1281 from pi-hole/tweak/web_debug
Back end changes for Web based debug calls.
This commit is contained in:
commit
f6fc6a5e56
@ -332,11 +332,17 @@ debugLighttpd() {
|
||||
}
|
||||
|
||||
countdown() {
|
||||
local tuvix
|
||||
tuvix=${TIMEOUT}
|
||||
printf "::: Logging will automatically teminate in ${TIMEOUT} seconds\n"
|
||||
printf "::: Logging will automatically teminate in %s seconds\n" "${TIMEOUT}"
|
||||
while [ $tuvix -ge 1 ]
|
||||
do
|
||||
printf ":::\t${tuvix} seconds left. \r"
|
||||
printf ":::\t%s seconds left. " "${tuvix}"
|
||||
if [[ -z "${WEBCALL}" ]]; then
|
||||
printf "\r"
|
||||
else
|
||||
printf "\n"
|
||||
fi
|
||||
sleep 5
|
||||
tuvix=$(( tuvix - 5 ))
|
||||
done
|
||||
@ -407,6 +413,10 @@ finalWork() {
|
||||
local tricorder
|
||||
echo "::: Finshed debugging!"
|
||||
echo "::: The debug log can be uploaded to tricorder.pi-hole.net for sharing with developers only."
|
||||
if [[ "${AUTOMATED}" ]]; then
|
||||
echo "::: Debug script running in automated mode, uploading log to tricorder..."
|
||||
tricorder=$(cat /var/log/pihole_debug.log | nc tricorder.pi-hole.net 9999)
|
||||
else
|
||||
read -r -p "::: Would you like to upload the log? [y/N] " response
|
||||
case ${response} in
|
||||
[yY][eE][sS]|[yY])
|
||||
@ -416,11 +426,11 @@ finalWork() {
|
||||
echo "::: Log will NOT be uploaded to tricorder."
|
||||
;;
|
||||
esac
|
||||
|
||||
fi
|
||||
# Check if tricorder.pi-hole.net is reachable and provide token.
|
||||
if [ -n "${tricorder}" ]; then
|
||||
echo "::: Your debug token is : ${tricorder}"
|
||||
echo "::: Please contact the Pi-hole team with your token for assistance."
|
||||
echo "::: ---=== Your debug token is : ${tricorder} Please make a note of it. ===---"
|
||||
echo "::: Contact the Pi-hole team with your token for assistance."
|
||||
echo "::: Thank you."
|
||||
else
|
||||
echo "::: There was an error uploading your debug log."
|
||||
|
20
pihole
20
pihole
@ -45,7 +45,19 @@ wildcardFunc() {
|
||||
}
|
||||
|
||||
debugFunc() {
|
||||
"${PI_HOLE_SCRIPT_DIR}"/piholeDebug.sh
|
||||
local automated
|
||||
local web
|
||||
|
||||
# Pull off the `debug` leaving passed call augmentation flags in $1
|
||||
shift
|
||||
if [[ "$@" == *"-a"* ]]; then
|
||||
automated="true"
|
||||
fi
|
||||
if [[ "$@" == *"-w"* ]]; then
|
||||
web="true"
|
||||
fi
|
||||
|
||||
AUTOMATED=${automated:-} WEBCALL=${web:-} "${PI_HOLE_SCRIPT_DIR}"/piholeDebug.sh
|
||||
exit 0
|
||||
}
|
||||
|
||||
@ -278,6 +290,8 @@ helpFunc() {
|
||||
::: -b, blacklist Blacklist domain(s) (exact match)
|
||||
::: -wild, wildcard Blacklist whole domain(s) (wildcard)
|
||||
::: -d, debug Start a debugging session
|
||||
::: Automated debugging can be enabled with `-a`.
|
||||
::: 'pihole -d -a'
|
||||
::: -f, flush Flush the 'pihole.log' file
|
||||
::: -t, tail Output the last lines of the 'pihole.log' file. Lines are appended as the file grows
|
||||
::: -up, updatePihole Update Pi-hole components
|
||||
@ -287,7 +301,7 @@ helpFunc() {
|
||||
::: -h, help Show this help dialog
|
||||
::: -v, version Show installed versions of Pi-Hole and Web-Admin
|
||||
::: -q, query Query the adlists for a specific domain
|
||||
::: Use 'pihole -q domain -exact' if you want to see exact matches only
|
||||
::: 'pihole -q domain -exact' shows exact matches only
|
||||
::: -l, logging Enable or Disable logging (pass 'on' or 'off')
|
||||
::: -a, admin Admin webpage options
|
||||
::: uninstall Uninstall Pi-Hole from your system :(!
|
||||
@ -310,7 +324,7 @@ case "${1}" in
|
||||
"-w" | "whitelist" ) whitelistFunc "$@";;
|
||||
"-b" | "blacklist" ) blacklistFunc "$@";;
|
||||
"-wild" | "wildcard" ) wildcardFunc "$@";;
|
||||
"-d" | "debug" ) debugFunc;;
|
||||
"-d" | "debug" ) debugFunc "$@";;
|
||||
"-f" | "flush" ) flushFunc;;
|
||||
"-up" | "updatePihole" ) updatePiholeFunc;;
|
||||
"-r" | "reconfigure" ) reconfigurePiholeFunc;;
|
||||
|
Loading…
Reference in New Issue
Block a user