From 1a275ba18458363f66da62ff6ab0481cf472e3a7 Mon Sep 17 00:00:00 2001 From: Jacob Salmela Date: Sun, 1 Apr 2018 06:40:48 -0500 Subject: [PATCH 1/2] debug user locale; improve function to parse variables and files Signed-off-by: Jacob Salmela --- advanced/Scripts/piholeDebug.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index a16457a0..33114794 100755 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -493,6 +493,12 @@ parse_setup_vars() { fi } +parse_locale() { + echo_current_diagnostic "Locale" + local pihole_locale="$(locale)" + parse_file "${pihole_locale}" +} + does_ip_match_setup_vars() { # Check for IPv4 or 6 local protocol="${1}" @@ -879,8 +885,11 @@ parse_file() { # Put the current Internal Field Separator into another variable so it can be restored later OLD_IFS="$IFS" # Get the lines that are in the file(s) and store them in an array for parsing later - IFS=$'\r\n' command eval 'file_info=( $(cat "${filename}") )' - + if [[ -f "$filename" ]]; then + IFS=$'\r\n' command eval 'file_info=( $(cat "${filename}") )' + else + read -a file_info <<< $filename + fi # Set a named variable for better readability local file_lines # For each line in the file, @@ -1165,6 +1174,7 @@ parse_setup_vars check_x_headers analyze_gravity_list show_content_of_pihole_files +parse_locale analyze_pihole_log copy_to_debug_log upload_to_tricorder From 250b445eeee8691d9b5a3bfee30f48d46e87853f Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Tue, 10 Apr 2018 21:37:04 -0700 Subject: [PATCH 2/2] Split declaration and population for stickler. Signed-off-by: Dan Schaper --- advanced/Scripts/piholeDebug.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index 33114794..f34b8646 100755 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -494,8 +494,9 @@ parse_setup_vars() { } parse_locale() { + local pihole_locale echo_current_diagnostic "Locale" - local pihole_locale="$(locale)" + pihole_locale="$(locale)" parse_file "${pihole_locale}" }