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
|
@ -151,7 +151,7 @@ chooseInterface() {
|
|||
interfaceCount=$(echo "$availableInterfaces" | wc -l)
|
||||
chooseInterfaceCmd=(whiptail --separate-output --radiolist "Choose An Interface" $r $c $interfaceCount)
|
||||
chooseInterfaceOptions=$("${chooseInterfaceCmd[@]}" "${interfacesArray[@]}" 2>&1 >/dev/tty)
|
||||
if [[ $? = 0 ]];then
|
||||
if [[ $? = 0 ]]; then
|
||||
for desiredInterface in $chooseInterfaceOptions
|
||||
do
|
||||
piholeInterface=$desiredInterface
|
||||
|
@ -358,9 +358,7 @@ setDNS(){
|
|||
Custom)
|
||||
until [[ $DNSSettingsCorrect = True ]]
|
||||
do
|
||||
|
||||
strInvalid="Invalid"
|
||||
|
||||
if [ ! $piholeDNS1 ]; then
|
||||
if [ ! $piholeDNS2 ]; then
|
||||
prePopulate=""
|
||||
|
@ -372,36 +370,28 @@ setDNS(){
|
|||
elif [ $piholeDNS1 ] && [ $piholeDNS2 ]; then
|
||||
prePopulate="$piholeDNS1, $piholeDNS2"
|
||||
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)
|
||||
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}')
|
||||
|
||||
if ! valid_ip "$piholeDNS1" || [ ! "$piholeDNS1" ]; then
|
||||
piholeDNS1=$strInvalid
|
||||
fi
|
||||
|
||||
if ! valid_ip "$piholeDNS2" && [ "$piholeDNS2" ]; then
|
||||
piholeDNS2=$strInvalid
|
||||
fi
|
||||
|
||||
else
|
||||
echo "::: Cancel selected, exiting...."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
if [[ $piholeDNS1 == "$strInvalid" ]]; then
|
||||
piholeDNS1=""
|
||||
fi
|
||||
|
||||
if [[ $piholeDNS2 == "$strInvalid" ]]; then
|
||||
piholeDNS2=""
|
||||
fi
|
||||
|
||||
DNSSettingsCorrect=False
|
||||
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
|
||||
|
@ -425,7 +415,6 @@ versionCheckDNSmasq(){
|
|||
dnsFile1="/etc/dnsmasq.conf"
|
||||
dnsFile2="/etc/dnsmasq.conf.orig"
|
||||
dnsSearch="addn-hosts=/etc/pihole/gravity.list"
|
||||
|
||||
defaultFile="/etc/.pihole/advanced/dnsmasq.conf.original"
|
||||
newFileToInstall="/etc/.pihole/advanced/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)
|
||||
#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
|
||||
|
||||
#Check to see if apt-get update has already been run today
|
||||
# it needs to have been run at least once on new installs!
|
||||
|
||||
|
@ -707,12 +695,12 @@ displayFinalMessage() {
|
|||
# Final completion message to user
|
||||
whiptail --msgbox --backtitle "Make it so." --title "Installation Complete!" "Configure your devices to use the Pi-hole as their DNS server using:
|
||||
|
||||
$IPv4addr
|
||||
$piholeIPv6
|
||||
$IPv4addr
|
||||
$piholeIPv6
|
||||
|
||||
If you set a new IP address, you should restart the Pi.
|
||||
If you set a new IP address, you should restart the Pi.
|
||||
|
||||
The install log is in /etc/pihole." $r $c
|
||||
The install log is in /etc/pihole." $r $c
|
||||
}
|
||||
|
||||
######## SCRIPT ############
|
||||
|
|
Loading…
Reference in a new issue