mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 10:43:55 +00:00
commit
3e6dd9ea9e
1 changed files with 506 additions and 518 deletions
|
@ -358,9 +358,7 @@ setDNS(){
|
||||||
Custom)
|
Custom)
|
||||||
until [[ $DNSSettingsCorrect = True ]]
|
until [[ $DNSSettingsCorrect = True ]]
|
||||||
do
|
do
|
||||||
|
|
||||||
strInvalid="Invalid"
|
strInvalid="Invalid"
|
||||||
|
|
||||||
if [ ! $piholeDNS1 ]; then
|
if [ ! $piholeDNS1 ]; then
|
||||||
if [ ! $piholeDNS2 ]; then
|
if [ ! $piholeDNS2 ]; then
|
||||||
prePopulate=""
|
prePopulate=""
|
||||||
|
@ -372,36 +370,28 @@ setDNS(){
|
||||||
elif [ $piholeDNS1 ] && [ $piholeDNS2 ]; then
|
elif [ $piholeDNS1 ] && [ $piholeDNS2 ]; then
|
||||||
prePopulate="$piholeDNS1, $piholeDNS2"
|
prePopulate="$piholeDNS1, $piholeDNS2"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
piholeDNS=$(whiptail --backtitle "Specify Upstream DNS Provider(s)" --inputbox "Enter your desired upstream DNS provider(s), seperated by a comma.\n\nFor example '8.8.8.8, 8.8.4.4'" $r $c "$prePopulate" 3>&1 1>&2 2>&3)
|
piholeDNS=$(whiptail --backtitle "Specify Upstream DNS Provider(s)" --inputbox "Enter your desired upstream DNS provider(s), seperated by a comma.\n\nFor example '8.8.8.8, 8.8.4.4'" $r $c "$prePopulate" 3>&1 1>&2 2>&3)
|
||||||
if [[ $? = 0 ]];then
|
if [[ $? = 0 ]];then
|
||||||
piholeDNS1=$(echo "$piholeDNS" | sed 's/[, \t]\+/,/g' | awk -F, '{print$1}')
|
piholeDNS1=$(echo "$piholeDNS" | sed 's/[, \t]\+/,/g' | awk -F, '{print$1}')
|
||||||
piholeDNS2=$(echo "$piholeDNS" | sed 's/[, \t]\+/,/g' | awk -F, '{print$2}')
|
piholeDNS2=$(echo "$piholeDNS" | sed 's/[, \t]\+/,/g' | awk -F, '{print$2}')
|
||||||
|
|
||||||
if ! valid_ip "$piholeDNS1" || [ ! "$piholeDNS1" ]; then
|
if ! valid_ip "$piholeDNS1" || [ ! "$piholeDNS1" ]; then
|
||||||
piholeDNS1=$strInvalid
|
piholeDNS1=$strInvalid
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! valid_ip "$piholeDNS2" && [ "$piholeDNS2" ]; then
|
if ! valid_ip "$piholeDNS2" && [ "$piholeDNS2" ]; then
|
||||||
piholeDNS2=$strInvalid
|
piholeDNS2=$strInvalid
|
||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
echo "::: Cancel selected, exiting...."
|
echo "::: Cancel selected, exiting...."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $piholeDNS1 == "$strInvalid" ]] || [[ $piholeDNS2 == "$strInvalid" ]]; then
|
if [[ $piholeDNS1 == "$strInvalid" ]] || [[ $piholeDNS2 == "$strInvalid" ]]; then
|
||||||
whiptail --msgbox --backtitle "Invalid IP" --title "Invalid IP" "One or both entered IP addresses were invalid. Please try again.\n\n DNS Server 1: $piholeDNS1\n DNS Server 2: $piholeDNS2" $r $c
|
whiptail --msgbox --backtitle "Invalid IP" --title "Invalid IP" "One or both entered IP addresses were invalid. Please try again.\n\n DNS Server 1: $piholeDNS1\n DNS Server 2: $piholeDNS2" $r $c
|
||||||
|
|
||||||
if [[ $piholeDNS1 == "$strInvalid" ]]; then
|
if [[ $piholeDNS1 == "$strInvalid" ]]; then
|
||||||
piholeDNS1=""
|
piholeDNS1=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $piholeDNS2 == "$strInvalid" ]]; then
|
if [[ $piholeDNS2 == "$strInvalid" ]]; then
|
||||||
piholeDNS2=""
|
piholeDNS2=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
DNSSettingsCorrect=False
|
DNSSettingsCorrect=False
|
||||||
else
|
else
|
||||||
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
|
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
|
||||||
|
@ -425,7 +415,6 @@ versionCheckDNSmasq(){
|
||||||
dnsFile1="/etc/dnsmasq.conf"
|
dnsFile1="/etc/dnsmasq.conf"
|
||||||
dnsFile2="/etc/dnsmasq.conf.orig"
|
dnsFile2="/etc/dnsmasq.conf.orig"
|
||||||
dnsSearch="addn-hosts=/etc/pihole/gravity.list"
|
dnsSearch="addn-hosts=/etc/pihole/gravity.list"
|
||||||
|
|
||||||
defaultFile="/etc/.pihole/advanced/dnsmasq.conf.original"
|
defaultFile="/etc/.pihole/advanced/dnsmasq.conf.original"
|
||||||
newFileToInstall="/etc/.pihole/advanced/01-pihole.conf"
|
newFileToInstall="/etc/.pihole/advanced/01-pihole.conf"
|
||||||
newFileFinalLocation="/etc/dnsmasq.d/01-pihole.conf"
|
newFileFinalLocation="/etc/dnsmasq.d/01-pihole.conf"
|
||||||
|
@ -527,7 +516,6 @@ checkForDependencies() {
|
||||||
#requiring user input (e.g password for phpmyadmin see #218)
|
#requiring user input (e.g password for phpmyadmin see #218)
|
||||||
#We'll change the logic up here, to check to see if there are any updates availible and
|
#We'll change the logic up here, to check to see if there are any updates availible and
|
||||||
# if so, advise the user to run apt-get update/upgrade at their own discretion
|
# if so, advise the user to run apt-get update/upgrade at their own discretion
|
||||||
|
|
||||||
#Check to see if apt-get update has already been run today
|
#Check to see if apt-get update has already been run today
|
||||||
# it needs to have been run at least once on new installs!
|
# it needs to have been run at least once on new installs!
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue