echo"::: Cannot continue, neither IPv4 or IPv6 selected"
echo"::: Exiting"
exit1
fi
}
getStaticIPv4Settings(){
local ipSettingsCorrect
# Ask if the user wants to use DHCP settings as their static IP
if(whiptail --backtitle "Calibrating network interface" --title "Static IP Address" --yesno "Do you want to use your current network settings as a static address?
if whiptail --backtitle "Calibrating network interface" --title "Static IP Address" --yesno "Do you want to use your current network settings as a static address?
IP address: ${IPV4_ADDRESS}
Gateway: ${IPv4gw}"${r}${c}); then
Gateway: ${IPv4gw}"${r}${c}; then
# If they choose yes, let the user know that the IP address will not be available via DHCP and may cause a conflict.
whiptail --msgbox --backtitle "IP information" --title "FYI: IP Conflict""It is possible your router could still try to assign this IP to a device, which would cause a conflict. But in most cases the router is smart enough to not do that.
If you are worried, either manually set the address, or modify the DHCP reservation pool so it does not include the IP you want.
@ -329,36 +323,29 @@ It is also possible to use a DHCP reservation, but if you are going to do that,
# Start by getting the IPv4 address (pre-filling it with info gathered from DHCP)
# Start a loop to let the user enter their information with the chance to go back and edit it if necessary
DNSchoices=$(whiptail --separate-output --radiolist "Select Upstream DNS Provider. To use your own, select Custom."${r}${c}6\
"${DNSChooseOptions[@]}" 2>&1 >/dev/tty)||\
{echo"::: Cancel selected. Exiting";exit 1;}
case${DNSchoices} in
Google)
echo"::: Using Google DNS servers."
PIHOLE_DNS_1="8.8.8.8"
PIHOLE_DNS_2="8.8.4.4"
;;
OpenDNS)
echo"::: Using OpenDNS servers."
PIHOLE_DNS_1="208.67.222.222"
PIHOLE_DNS_2="208.67.220.220"
;;
Level3)
echo"::: Using Level3 servers."
PIHOLE_DNS_1="4.2.2.1"
PIHOLE_DNS_2="4.2.2.2"
;;
Norton)
echo"::: Using Norton ConnectSafe servers."
PIHOLE_DNS_1="199.85.126.10"
PIHOLE_DNS_2="199.85.127.10"
;;
Comodo)
echo"::: Using Comodo Secure servers."
PIHOLE_DNS_1="8.26.56.26"
PIHOLE_DNS_2="8.20.247.20"
;;
Custom)
until[[${DNSSettingsCorrect}= True ]];do
strInvalid="Invalid"
if[ ! ${PIHOLE_DNS_1}];then
if[ ! ${PIHOLE_DNS_2}];then
prePopulate=""
else
prePopulate=", ${PIHOLE_DNS_2}"
fi
elif[${PIHOLE_DNS_1}]&&[ ! ${PIHOLE_DNS_2}];then
prePopulate="${PIHOLE_DNS_1}"
elif[${PIHOLE_DNS_1}]&&[${PIHOLE_DNS_2}];then
prePopulate="${PIHOLE_DNS_1}, ${PIHOLE_DNS_2}"
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
PIHOLE_DNS_1=$(echo"${piholeDNS}"| sed 's/[, \t]\+/,/g'| awk -F, '{print$1}')
PIHOLE_DNS_2=$(echo"${piholeDNS}"| sed 's/[, \t]\+/,/g'| awk -F, '{print$2}')
if ! valid_ip "${PIHOLE_DNS_1}"||[ ! "${PIHOLE_DNS_1}"];then
PIHOLE_DNS_1=${strInvalid}
fi
if ! valid_ip "${PIHOLE_DNS_2}"&&["${PIHOLE_DNS_2}"];then
PIHOLE_DNS_2=${strInvalid}
fi
else
echo"::: Cancel selected, exiting...."
exit1
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)||\
{echo"::: Cancel selected. Exiting";exit 1;}
PIHOLE_DNS_1=$(echo"${piholeDNS}"| sed 's/[, \t]\+/,/g'| awk -F, '{print$1}')
PIHOLE_DNS_2=$(echo"${piholeDNS}"| sed 's/[, \t]\+/,/g'| awk -F, '{print$2}')
if ! valid_ip "${PIHOLE_DNS_1}"||[ ! "${PIHOLE_DNS_1}"];then
PIHOLE_DNS_1=${strInvalid}
fi
if ! valid_ip "${PIHOLE_DNS_2}"&&["${PIHOLE_DNS_2}"];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: $PIHOLE_DNS_1\n DNS Server 2: ${PIHOLE_DNS_2}"${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: $PIHOLE_DNS_1\n DNS Server 2: ${PIHOLE_DNS_2}"${r}${c}
if[[${PIHOLE_DNS_1}=="${strInvalid}"]];then
PIHOLE_DNS_1=""
fi
if[[${PIHOLE_DNS_2}=="${strInvalid}"]];then
PIHOLE_DNS_2=""
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: $PIHOLE_DNS_1\n DNS Server 2: ${PIHOLE_DNS_2}"${r}${c});then
DNSSettingsCorrect=True
else
# If the settings are wrong, the loop continues
DNSSettingsCorrect=False
fi
if[[${PIHOLE_DNS_2}=="${strInvalid}"]];then
PIHOLE_DNS_2=""
fi
done
;;
esac
else
echo"::: Cancel selected. Exiting..."
exit1
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: $PIHOLE_DNS_1\n DNS Server 2: ${PIHOLE_DNS_2}"${r}${c});then
DNSSettingsCorrect=True
else
# If the settings are wrong, the loop continues
DNSSettingsCorrect=False
fi
fi
done
;;
esac
}
setLogging(){
@ -622,26 +602,25 @@ clean_existing() {
installScripts(){
# Install the scripts from repository to their various locations
readonlyinstall_dir="/opt/pihole/"
echo":::"
echo -n "::: Installing scripts from ${PI_HOLE_LOCAL_REPO}..."
# Clear out script files from Pi-hole scripts directory.
if(whiptail --title "SELinux Enforcing Detected" --yesno "SELinux is being Enforced on your system!\n\nPi-hole currently does not support SELinux, but you may still continue with the installation.\n\nNote: Admin UI Will not function fully without setting your policies correctly\n\nContinue installing Pi-hole?"${r}${c});then
echo":::"
echo"::: Continuing installation with SELinux Enforcing."
echo"::: Please refer to official SELinux documentation to create a custom policy."
else
echo":::"
echo"::: Not continuing install after SELinux Enforcing detected."
exit1
fi
whiptail --title "SELinux Enforcing Detected" --yesno "SELinux is being Enforced on your system!\n\nPi-hole currently does not support SELinux, but you may still continue with the installation.\n\nNote: Admin UI Will not function fully without setting your policies correctly\n\nContinue installing Pi-hole?"${r}${c}||\
{echo":::";echo"::: Not continuing install after SELinux Enforcing detected.";exit 1;}
echo":::"
echo"::: Continuing installation with SELinux Enforcing."
echo"::: Please refer to official SELinux documentation to create a custom policy."
fi
fi
}
@ -1040,23 +1015,19 @@ update_dialogs() {
UpdateCmd=$(whiptail --title "Existing Install Detected!" --menu "\n\nWe have detected an existing install.\n\nPlease choose from the following options: \n($strAdd)"${r}${c}2\