From bf867bd9fdc4e3e6374d80c92d4db936fd7b456f Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sun, 11 Dec 2016 16:54:27 +0100 Subject: [PATCH] Set DNS servers from web UI --- advanced/Scripts/webpage.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 0a79d853..839f6e6d 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -57,11 +57,22 @@ 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 + # Save setting to file + echo "PIHOLE_DNS_1=${args[2]}" >> /etc/pihole/setupVars.conf + echo "PIHOLE_DNS_2=${args[3]}" >> /etc/pihole/setupVars.conf + +} + for var in "$@"; do case "${var}" in "-p" | "password" ) SetWebPassword;; "-c" | "celsius" ) unit="C"; SetTemperatureUnit;; "-f" | "fahrenheit" ) unit="F"; SetTemperatureUnit;; + "setdns" ) SetDNSServers;; "-h" | "--help" ) helpFunc;; esac done