###All credit for the below function goes to http://fitnr.com/showing-a-bash-spinner.html
spinner()
{
spinner(){
localpid=$1
localdelay=0.001
localspinstr='|/-\'
localspinstr='/-\|'
while["$(ps a | awk '{print $1}'| grep $pid)"];do
localtemp=${spinstr#?}
printf" [%c] ""$spinstr"
@ -70,8 +74,7 @@ spinner()
}
backupLegacyPihole()
{
backupLegacyPihole(){
if[[ -f /etc/dnsmasq.d/adList.conf ]];then
echo"Original Pi-hole detected. Initiating sub space transport"
$SUDO mkdir -p /etc/pihole/original/
@ -86,8 +89,7 @@ else
fi
}
welcomeDialogs()
{
welcomeDialogs(){
# Display the welcome dialog
whiptail --msgbox --backtitle "Welcome" --title "Pi-hole automated installer""This installer will transform your Raspberry Pi into a network-wide ad blocker!"$r$c
@ -96,12 +98,10 @@ whiptail --msgbox --backtitle "Plea" --title "Free and open source" "The Pi-hole
# Explain the need for a static address
whiptail --msgbox --backtitle "Initating network interface" --title "Static IP Needed""The Pi-hole is a SERVER so it needs a STATIC IP ADDRESS to function properly.
In the next section, you can choose to use your current network settings (DHCP) or to manually edit them."$r$c
}
chooseInterface()
{
chooseInterface(){
# Turn the available interfaces into an array so it can be used with a whiptail dialog
piholeIPv6=$(ip -6 route get 2001:4860:4860::8888 | awk -F " "'{ for(i=1;i<=NF;i++) if ($i == "src") print $(i+1) }')
whiptail --msgbox --backtitle "IPv6..." --title "IPv6 Supported""$piholeIPv6 will be used to block ads."$r$c
$SUDO mkdir -p /etc/pihole/
$SUDO touch /etc/pihole/.useIPv6
}
getStaticIPv4Settings()
{
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: $IPv4addr
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.
It is also possible to use a DHCP reservation, but if you are going to do that, you might as well set a static address."$r$c
# Nothing else to do since the variables are already set above