mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 10:43:55 +00:00
Add logging enable/disable toggle in setup
This commit is contained in:
parent
3da7bf5bed
commit
229439c7b7
1 changed files with 34 additions and 0 deletions
|
@ -498,6 +498,29 @@ setDNS() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setLogging() {
|
||||||
|
LogToggleCommand=(whiptail --separate-output --radiolist "Select Logging mode:" ${r} ${c} 6)
|
||||||
|
DNSChooseOptions=("On (Reccomended)" "" on
|
||||||
|
Off "" off)
|
||||||
|
DNSchoices=$("${DNSChooseCmd[@]}" "${DNSChooseOptions[@]}" 2>&1 >/dev/tty)
|
||||||
|
if [[ $? = 0 ]];then
|
||||||
|
case ${DNSchoices} in
|
||||||
|
"On (Reccomended)")
|
||||||
|
echo "::: Logging On."
|
||||||
|
queryLogging=true
|
||||||
|
;;
|
||||||
|
Off)
|
||||||
|
echo "::: Logging Off."
|
||||||
|
queryLogging=false
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
echo "::: Cancel selected. Exiting..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
version_check_dnsmasq() {
|
version_check_dnsmasq() {
|
||||||
# Check if /etc/dnsmasq.conf is from pihole. If so replace with an original and install new in .d directory
|
# Check if /etc/dnsmasq.conf is from pihole. If so replace with an original and install new in .d directory
|
||||||
local dnsmasq_conf="/etc/dnsmasq.conf"
|
local dnsmasq_conf="/etc/dnsmasq.conf"
|
||||||
|
@ -572,6 +595,14 @@ version_check_dnsmasq() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sed -i 's/^#conf-dir=\/etc\/dnsmasq.d$/conf-dir=\/etc\/dnsmasq.d/' ${dnsmasq_conf}
|
sed -i 's/^#conf-dir=\/etc\/dnsmasq.d$/conf-dir=\/etc\/dnsmasq.d/' ${dnsmasq_conf}
|
||||||
|
|
||||||
|
if [[ "${queryLogging}" == false ]] ; then
|
||||||
|
#Disable Logging
|
||||||
|
sed -i 's/^log-queries/#log-queries/' ${dnsmasq_pihole_01_location}
|
||||||
|
else
|
||||||
|
#Enable Logging
|
||||||
|
sed -i 's/^#log-queries/log-queries/' ${dnsmasq_pihole_01_location}
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
remove_legacy_scripts() {
|
remove_legacy_scripts() {
|
||||||
|
@ -834,6 +865,7 @@ finalExports() {
|
||||||
echo "IPv6_address=${IPv6_address}"
|
echo "IPv6_address=${IPv6_address}"
|
||||||
echo "piholeDNS1=${piholeDNS1}"
|
echo "piholeDNS1=${piholeDNS1}"
|
||||||
echo "piholeDNS2=${piholeDNS2}"
|
echo "piholeDNS2=${piholeDNS2}"
|
||||||
|
echo "queryLogging=${queryLogging}"
|
||||||
}>> "${setupVars}"
|
}>> "${setupVars}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1010,6 +1042,8 @@ main() {
|
||||||
use4andor6
|
use4andor6
|
||||||
# Decide what upstream DNS Servers to use
|
# Decide what upstream DNS Servers to use
|
||||||
setDNS
|
setDNS
|
||||||
|
# Let the user decide if they want query logging enabled...
|
||||||
|
setLogging
|
||||||
|
|
||||||
# Install packages used by the Pi-hole
|
# Install packages used by the Pi-hole
|
||||||
install_dependent_packages PIHOLE_DEPS[@]
|
install_dependent_packages PIHOLE_DEPS[@]
|
||||||
|
|
Loading…
Reference in a new issue