diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 4f7fa43b..3309fc99 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -72,7 +72,7 @@ SetWebPassword(){ SetDNSServers(){ # Remove setting from file (create backup setupVars.conf.bak) - sed -i.bak '/PIHOLE_DNS_1/d;/PIHOLE_DNS_2/d;' /etc/pihole/setupVars.conf + 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 @@ -82,6 +82,18 @@ SetDNSServers(){ echo "server=${args[2]}" >> /etc/dnsmasq.d/01-pihole.conf echo "server=${args[3]}" >> /etc/dnsmasq.d/01-pihole.conf + # Remove domain-needed entry + sed -i '/domain-needed/d;' /etc/dnsmasq.d/01-pihole.conf + + # Readd it if required + if [[ "${args[4]}" == "domain-needed" ]]; then + echo "domain-needed" >> /etc/dnsmasq.d/01-pihole.conf + echo "DNS_FQDN_REQUIRED=true" >> /etc/pihole/setupVars.conf + else + echo "DNS_FQDN_REQUIRED=false" >> /etc/pihole/setupVars.conf + fi + # Leave it deleted if not wanted + # Restart dnsmasq to load new configuration RestartDNS