Prevent double disabling/enabling by checking BLOCKING_ENABLED value in setupVars.conf

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER 2019-01-24 09:16:24 +01:00
parent 465589c0fd
commit a4ba8d4b8f
No known key found for this signature in database
GPG key ID: 00135ACBD90B28DD

8
pihole
View file

@ -144,6 +144,10 @@ Time:
elif [[ "${1}" == "0" ]]; then elif [[ "${1}" == "0" ]]; then
# Disable Pi-hole # 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 if [[ -e "${gravitylist}" ]]; then
mv "${gravitylist}" "${gravitylist}.bck" mv "${gravitylist}" "${gravitylist}.bck"
echo "" > "${gravitylist}" echo "" > "${gravitylist}"
@ -193,6 +197,10 @@ Time:
fi fi
else else
# Enable Pi-hole # 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" echo -e " ${INFO} Enabling blocking"
local str="Pi-hole Enabled" local str="Pi-hole Enabled"