From 715838cf892f9718b4a9afc94210a872b3c268ef Mon Sep 17 00:00:00 2001 From: DL6ER Date: Mon, 19 Dec 2016 13:42:42 +0100 Subject: [PATCH] Allow disabling second DNS server --- advanced/Scripts/webpage.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index d07e5c94..6251b158 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -75,12 +75,18 @@ SetDNSServers(){ sed -i.bak '/PIHOLE_DNS_1/d;/PIHOLE_DNS_2/d;/DNS_FQDN_REQUIRED/d;' /etc/pihole/setupVars.conf # Save setting to file echo "PIHOLE_DNS_1=${args[2]}" >> /etc/pihole/setupVars.conf - echo "PIHOLE_DNS_2=${args[3]}" >> /etc/pihole/setupVars.conf + if [[ "${args[3]}" != "none" ]]; then + echo "PIHOLE_DNS_2=${args[3]}" >> /etc/pihole/setupVars.conf + else + echo "PIHOLE_DNS_2=" >> /etc/pihole/setupVars.conf + fi # Replace within actual dnsmasq config file sed -i '/server=/d;' /etc/dnsmasq.d/01-pihole.conf echo "server=${args[2]}" >> /etc/dnsmasq.d/01-pihole.conf - echo "server=${args[3]}" >> /etc/dnsmasq.d/01-pihole.conf + if [[ "${args[3]}" != "none" ]]; then + echo "server=${args[3]}" >> /etc/dnsmasq.d/01-pihole.conf + fi # Remove domain-needed entry sed -i '/domain-needed/d;' /etc/dnsmasq.d/01-pihole.conf