dnsmasq "domain-needed" property

This commit is contained in:
DL6ER 2016-12-14 16:09:57 +01:00
parent ba015c1918
commit 85e3f37503

View file

@ -72,7 +72,7 @@ SetWebPassword(){
SetDNSServers(){ SetDNSServers(){
# Remove setting from file (create backup setupVars.conf.bak) # 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 # Save setting to file
echo "PIHOLE_DNS_1=${args[2]}" >> /etc/pihole/setupVars.conf echo "PIHOLE_DNS_1=${args[2]}" >> /etc/pihole/setupVars.conf
echo "PIHOLE_DNS_2=${args[3]}" >> /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[2]}" >> /etc/dnsmasq.d/01-pihole.conf
echo "server=${args[3]}" >> /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 # Restart dnsmasq to load new configuration
RestartDNS RestartDNS