whiptail --msgbox --backtitle "Insufficient Disk Space" --title "Insufficient Disk Space""\nYour system appears to be low on disk space. pi-hole recomends a minimum of $requiredFreeBytes Bytes.\nYou only have $existingFreeBytes Free.\n\nIf this is a new install you may need to expand your disk.\n\nTry running:\n 'sudo raspi-config'\nChoose the 'expand file system option'\n\nAfter rebooting, run this installation again.\n\ncurl -L install.pi-hole.net | bash\n"$r$c
exit1
fi
# 25MB is the minimum space needed (20MB install + 5MB one day of logs.)
whiptail --msgbox --backtitle "Insufficient Disk Space" --title "Insufficient Disk Space""\nYour system appears to be low on disk space. pi-hole recomends a minimum of $requiredFreeBytes Bytes.\nYou only have $existingFreeBytes Free.\n\nIf this is a new install you may need to expand your disk.\n\nTry running:\n 'sudo raspi-config'\nChoose the 'expand file system option'\n\nAfter rebooting, run this installation again.\n\ncurl -L install.pi-hole.net | bash\n"$r$c
echo"$existingFreeBytes is less than $requiredFreeBytes"
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}')
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
DNSSettingsCorrect=True
else
# If the settings are wrong, the loop continues
DNSSettingsCorrect=False
fi
fi
done
;;
esac
else
echo"::: Cancel selected. Exiting..."
@ -359,8 +455,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[["$piholeDNS1" !=""]];then
$SUDO sed -i "s/@DNS1@/$piholeDNS1/"$newFileFinalLocation
else
$SUDO sed -i '/^server=@DNS1@/d'$newFileFinalLocation
fi
if[["$piholeDNS2" !=""]];then
$SUDO sed -i "s/@DNS2@/$piholeDNS2/"$newFileFinalLocation
else
$SUDO sed -i '/^server=@DNS2@/d'$newFileFinalLocation