1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-12-22 23:08:07 +00:00
This commit is contained in:
Promofaux 2016-10-31 21:38:48 +00:00 committed by Dan Schaper
parent 035e4bf727
commit d4dccfdb2d

View File

@ -537,6 +537,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"
@ -611,6 +634,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() {
@ -855,6 +886,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}"
} }
@ -1034,6 +1066,12 @@ 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_dependent_packages PIHOLE_DEPS[@]
# Install and log everything to a file # Install and log everything to a file
installPihole | tee ${tmpLog} installPihole | tee ${tmpLog}
else else