for desiredInterface in ${chooseInterfaceOptions};do
piholeInterface=${desiredInterface}
echo"::: Using interface: $piholeInterface"
done
@ -279,8 +278,8 @@ use4andor6() {
getStaticIPv4Settings(){
# 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?
IP address: $IPv4_address
Gateway: $IPv4gw"${r}${c}); then
IP address: ${IPv4_address}
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.
@ -290,20 +289,19 @@ It is also possible to use a DHCP reservation, but if you are going to do that,
# Otherwise, we need to ask the user to input their desired settings.
# 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
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
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
if ! valid_ip "${piholeDNS2}"&&["${piholeDNS2}"];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
piholeDNS1=""
fi
if[[${piholeDNS2}=="$strInvalid"]];then
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
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
# Let user know if they have outdated packages on their system and
# advise them to run a package update at soonest possible.
echo":::"
echo -n "::: Checking $PKG_MANAGER for upgraded packages...."
echo -n "::: Checking ${PKG_MANAGER} for upgraded packages...."
updatesToInstall=$(eval"${PKG_COUNT}")
echo" done!"
echo":::"
if[[${updatesToInstall} -eq "0"]];then
echo"::: Your system is up to date! Continuing with Pi-hole installation..."
else
echo"::: There are $updatesToInstall updates available for your system!"
echo"::: We recommend you run '$PKG_UPDATE' after installing Pi-Hole! "
echo"::: There are ${updatesToInstall} updates available for your system!"
echo"::: We recommend you run '${PKG_UPDATE}' after installing Pi-Hole! "
echo":::"
fi
}
@ -786,7 +784,7 @@ configureFirewall() {
finalExports(){
#If it already exists, lets overwrite it with the new values.
if[[ -f ${setupVars}]];then
if[[ -f ${setupVars}]];then
rm ${setupVars}
fi
{
@ -798,7 +796,6 @@ finalExports() {
}>> "${setupVars}"
}
installPihole(){
# Install base files and web interface
create_pihole_user
@ -866,7 +863,7 @@ displayFinalMessage() {
whiptail --msgbox --backtitle "Make it so." --title "Installation Complete!""Configure your devices to use the Pi-hole as their DNS server using:
IPv4: ${IPv4_address%/*}
IPv6: $IPv6_address
IPv6: ${IPv6_address}
If you set a new IP address, you should restart the Pi.
@ -876,7 +873,7 @@ View the web interface at http://pi.hole/admin or http://${IPv4_address%/*}/admi
update_dialogs(){
# reconfigure
if["$reconfigure"=true];then
if["${reconfigure}"=true];then
opt1a="Repair"
opt1b="This will retain existing settings"
strAdd="You will remain on the same version"
@ -889,17 +886,17 @@ update_dialogs() {
opt2b="This will allow you to enter new settings"
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\