From b98737cd9336f8dda6049b6a82c2b761df059f13 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Wed, 16 Nov 2016 20:32:01 -0800 Subject: [PATCH] Shellcheck distro check --- advanced/Scripts/piholeDebug.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index 6d948d6a..fb50a57d 100755 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -159,16 +159,25 @@ source_file() { file_found=$(files_check "${1}") if [[ "${file_found}" ]]; then + # shellcheck source=/dev/null (source "${1}" &> /dev/null && echo "${file_found} and was successfully sourced") \ || log_echo -l "${file_found} and could not be sourced" fi } distro_check() { + header_write "Detecting installed OS distribution:" local soft_fail - header_write "Detecting installed OS Distribution" + local distro + soft_fail=0 - local distro="$(cat /etc/*release)" && block_parse "${distro}" || (log_echo "Distribution details not found." && soft_fail=1) + distro="$(cat /etc/*release)" + if [[ "${distro}" ]]; then + block_parse "${distro}" + else + log_echo "Distribution details not found." + soft_fail=1 + fi return "${soft_fail}" }