From a4ba8d4b8fd0e44e11deeecf33267c82c3d8735e Mon Sep 17 00:00:00 2001 From: DL6ER Date: Thu, 24 Jan 2019 09:16:24 +0100 Subject: [PATCH] Prevent double disabling/enabling by checking BLOCKING_ENABLED value in setupVars.conf Signed-off-by: DL6ER --- pihole | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pihole b/pihole index fff3417d..84a5623f 100755 --- a/pihole +++ b/pihole @@ -144,6 +144,10 @@ Time: elif [[ "${1}" == "0" ]]; then # Disable Pi-hole + if grep -cq "BLOCKING_ENABLED=false" "${setupVars}"; then + echo -e " ${INFO} Blocking already disabled, nothing to do" + exit 0 + fi if [[ -e "${gravitylist}" ]]; then mv "${gravitylist}" "${gravitylist}.bck" echo "" > "${gravitylist}" @@ -193,6 +197,10 @@ Time: fi else # Enable Pi-hole + if grep -cq "BLOCKING_ENABLED=true" "${setupVars}"; then + echo -e " ${INFO} Blocking already enabled, nothing to do" + exit 0 + fi echo -e " ${INFO} Enabling blocking" local str="Pi-hole Enabled"