1
0
mirror of https://github.com/pi-hole/pi-hole synced 2025-02-03 11:51:16 +00:00

Merge branch 'fayetted-Issue_309' into slamanna212-development

This commit is contained in:
Promofaux 2016-02-17 00:08:48 +00:00
commit 668b883651
2 changed files with 36 additions and 5 deletions

View File

@ -300,12 +300,13 @@ setStaticIPv4() {
} }
setDNS(){ setDNS(){
DNSChoseCmd=(whiptail --separate-output --radiolist "Select Upstream DNS Provider" $r $c 5) DNSChoseCmd=(whiptail --separate-output --radiolist "Select Upstream DNS Provider" $r $c 6)
DNSChooseOptions=(Google "" on DNSChooseOptions=(Google "" on
OpenDNS "" off OpenDNS "" off
Level3 "" off Level3 "" off
Norton "" off Norton "" off
Comodo "" off) Comodo "" off
Other "" off)
DNSchoices=$("${DNSChoseCmd[@]}" "${DNSChooseOptions[@]}" 2>&1 >/dev/tty) DNSchoices=$("${DNSChoseCmd[@]}" "${DNSChooseOptions[@]}" 2>&1 >/dev/tty)
if [[ $? = 0 ]];then if [[ $? = 0 ]];then
case $DNSchoices in case $DNSchoices in
@ -334,6 +335,26 @@ setDNS(){
piholeDNS1="8.26.56.26" piholeDNS1="8.26.56.26"
piholeDNS2="8.20.247.20" piholeDNS2="8.20.247.20"
;; ;;
Other)
until [[ $DNSSettingsCorrect = True ]]
do
piholeDNS=$(whiptail --backtitle "Specify Upstream DNS Provider(s)" --inputbox "Enter your desired upstream DNS provider(s)" $r $c "8.8.8.8, 8.8.4.4" 3>&1 1>&2 2>&3)
if [[ $? = 0 ]];then
piholeDNS1=$(echo $piholeDNS | sed 's/[, \t]\+/,/g' | awk -F, '{print$1}')
piholeDNS2=$(echo $piholeDNS | sed 's/[, \t]\+/,/g' | awk -F, '{print$2}')
else
echo "::: Cancel selected, exiting...."
exit 1
fi
if (whiptail --backtitle "Specify Upstream DNS Provider(s)" --title "Upstream DNS Provider(s)" --yesno "Are these settings correct?\n DNS Server 1: $piholeDNS1\n DNS Server 2: $piholeDNS2" $r $c) then
DNSSettingsCorrect=True
else
# If the settings are wrong, the loop continues
DNSSettingsCorrect=False
fi
done
;;
esac esac
else else
echo "::: Cancel selected. Exiting..." echo "::: Cancel selected. Exiting..."
@ -374,8 +395,16 @@ versionCheckDNSmasq(){
$SUDO cp $newFileToInstall $newFileFinalLocation $SUDO cp $newFileToInstall $newFileFinalLocation
echo " done." echo " done."
$SUDO sed -i "s/@INT@/$piholeInterface/" $newFileFinalLocation $SUDO sed -i "s/@INT@/$piholeInterface/" $newFileFinalLocation
if [[ "$piholeDNS1" != "" ]]; then
$SUDO sed -i "s/@DNS1@/$piholeDNS1/" $newFileFinalLocation $SUDO sed -i "s/@DNS1@/$piholeDNS1/" $newFileFinalLocation
else
$SUDO sed -i '/^server=@DNS1@/d' $newFileFinalLocation
fi
if [[ "$piholeDNS2" != "" ]]; then
$SUDO sed -i "s/@DNS2@/$piholeDNS2/" $newFileFinalLocation $SUDO sed -i "s/@DNS2@/$piholeDNS2/" $newFileFinalLocation
else
$SUDO sed -i '/^server=@DNS2@/d' $newFileFinalLocation
fi
} }
installScripts() { installScripts() {

View File

@ -323,6 +323,8 @@ function gravity_reload() {
echo -n "::: Refresh lists in dnsmasq..." echo -n "::: Refresh lists in dnsmasq..."
dnsmasqPid=$(pidof dnsmasq) dnsmasqPid=$(pidof dnsmasq)
find "$piholeDir" -type f -exec $SUDO chmod 666 {} \; & spinner $!
if [[ $dnsmasqPid ]]; then if [[ $dnsmasqPid ]]; then
# service already running - reload config # service already running - reload config
$SUDO kill -HUP $dnsmasqPid & spinner $! $SUDO kill -HUP $dnsmasqPid & spinner $!