mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 10:43:55 +00:00
Adjust "pihole status" command
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
parent
b011adc453
commit
4e4d6b5d1f
1 changed files with 7 additions and 7 deletions
14
pihole
14
pihole
|
@ -268,16 +268,17 @@ statusFunc() {
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Determine if Pi-hole's addn-hosts configs are commented out
|
# Determine if Pi-hole's blocking is enabled
|
||||||
addnConfigs=$(grep -i "addn-hosts=/" /etc/dnsmasq.d/01-pihole.conf)
|
|
||||||
|
|
||||||
if [[ "${addnConfigs}" =~ "#" ]]; then
|
addnConfigs=$?
|
||||||
|
|
||||||
|
if grep -q "BLOCKING=false" /etc/pihole/setupVars.conf; then
|
||||||
# A config is commented out
|
# A config is commented out
|
||||||
case "${1}" in
|
case "${1}" in
|
||||||
"web") echo 0;;
|
"web") echo 0;;
|
||||||
*) echo -e " ${CROSS} Pi-hole blocking is Disabled";;
|
*) echo -e " ${CROSS} Pi-hole blocking is Disabled";;
|
||||||
esac
|
esac
|
||||||
elif [[ -n "${addnConfigs}" ]]; then
|
elif grep -q "BLOCKING=true" /etc/pihole/setupVars.conf; then
|
||||||
# Configs are set
|
# Configs are set
|
||||||
case "${1}" in
|
case "${1}" in
|
||||||
"web") echo 1;;
|
"web") echo 1;;
|
||||||
|
@ -289,9 +290,8 @@ statusFunc() {
|
||||||
"web") echo 99;;
|
"web") echo 99;;
|
||||||
*) echo -e " ${INFO} No hosts file linked to dnsmasq, adding it in enabled state";;
|
*) echo -e " ${INFO} No hosts file linked to dnsmasq, adding it in enabled state";;
|
||||||
esac
|
esac
|
||||||
# Add addn-host= to dnsmasq
|
# Enable blocking
|
||||||
echo "addn-hosts=/etc/pihole/gravity.list" >> /etc/dnsmasq.d/01-pihole.conf
|
pihole enable
|
||||||
restartDNS
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue