mirror of
https://github.com/pi-hole/pi-hole
synced 2024-12-22 23:08:07 +00:00
Allow installer to specify own DNS servers
Offers "other" option. Gives Installer chance to review settings before continuing.
This commit is contained in:
parent
dee8ce587d
commit
ecd46f8560
@ -286,9 +286,10 @@ setStaticIPv4() {
|
||||
}
|
||||
|
||||
setDNS(){
|
||||
DNSChoseCmd=(whiptail --separate-output --radiolist "Select Upstream DNS Provider" $r $c 2)
|
||||
DNSChoseCmd=(whiptail --separate-output --radiolist "Select Upstream DNS Provider" $r $c 3)
|
||||
DNSChooseOptions=(Google "" on
|
||||
OpenDNS "" off)
|
||||
OpenDNS "" off
|
||||
Other "" off)
|
||||
DNSchoices=$("${DNSChoseCmd[@]}" "${DNSChooseOptions[@]}" 2>&1 >/dev/tty)
|
||||
if [[ $? = 0 ]];then
|
||||
case $DNSchoices in
|
||||
@ -302,6 +303,23 @@ setDNS(){
|
||||
piholeDNS1="208.67.222.222"
|
||||
piholeDNS2="208.67.220.220"
|
||||
;;
|
||||
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)
|
||||
piholeDNS1=$(echo $piholeDNS | sed 's/[, \t]\+/,/g' | awk -F, '{print$1}')
|
||||
piholeDNS2=$(echo $piholeDNS | sed 's/[, \t]\+/,/g' | awk -F, '{print$2}')
|
||||
|
||||
if (whiptail --backtitle "Specify Upstream DNS Provider(s)" --title "Upstream DNS Provider(s)" --yesno "Are these settings correct?
|
||||
DNS Server 1: $piholeDNS1
|
||||
DNS Server 2: $piholeDNS2" $r $c) then
|
||||
DNSSettingsCorrect=True
|
||||
else
|
||||
# If the settings are wrong, the loop continues
|
||||
DNSSettingsCorrect=False
|
||||
fi
|
||||
done
|
||||
;;
|
||||
esac
|
||||
else
|
||||
echo "::: Cancel selected. Exiting..."
|
||||
@ -342,8 +360,16 @@ versionCheckDNSmasq(){
|
||||
$SUDO cp $newFileToInstall $newFileFinalLocation
|
||||
echo " done."
|
||||
$SUDO sed -i "s/@INT@/$piholeInterface/" $newFileFinalLocation
|
||||
$SUDO sed -i "s/@DNS1@/$piholeDNS1/" $newFileFinalLocation
|
||||
$SUDO sed -i "s/@DNS2@/$piholeDNS2/" $newFileFinalLocation
|
||||
if [[ "$piholDNS1" != "" ]]; then
|
||||
$SUDO sed -i "s/@DNS1@/$piholeDNS1/" $newFileFinalLocation
|
||||
else
|
||||
$SUDO sed -i '/^server=@DNS1@/d' $newFileFinalLocation
|
||||
fi
|
||||
if [[ "$piholDNS2" != "" ]]; then
|
||||
$SUDO sed -i "s/@DNS2@/$piholeDNS2/" $newFileFinalLocation
|
||||
else
|
||||
$SUDO sed -i '/^server=@DNS2@/d' $newFileFinalLocation
|
||||
fi
|
||||
}
|
||||
|
||||
installScripts() {
|
||||
|
Loading…
Reference in New Issue
Block a user