Merged with @slamanna212 code to add 3 new DNS providers.

This commit is contained in:
Daniel Fayette 2016-02-16 16:38:06 -06:00
commit fdf805bc7b
3 changed files with 43 additions and 5 deletions

View file

@ -24,6 +24,7 @@ Once installed, [configure your router to have **DHCP clients use the Pi as thei
[![Pi-hole exlplained](http://i.imgur.com/qNybJDX.png)](https://vimeo.com/135965232)
## Pi-hole Projects
- [x86 Docker container that runs Pi-hole](https://hub.docker.com/r/diginc/pi-hole/)
- [Pi-hole Chrome extension](https://chrome.google.com/webstore/detail/pi-hole-list-editor/hlnoeoejkllgkjbnnnhfolapllcnaglh) ([open source](https://github.com/packtloss/pihole-extension))
- [Go Bananas for CHiP-hole ad blocking](https://www.hackster.io/jacobsalmela/chip-hole-network-wide-ad-blocker-98e037)
- [Sky-Hole](http://dlaa.me/blog/post/skyhole)

View file

@ -115,6 +115,20 @@ welcomeDialogs() {
In the next section, you can choose to use your current network settings (DHCP) or to manually edit them." $r $c
}
verifyFreeDiskSpace() {
# 25MB is the minimum space needed (20MB install + 5MB one day of logs.)
requiredFreeBytes=25600
existingFreeBytes=`df -lkP / | awk '{print $4}' | tail -1`
if [[ $existingFreeBytes -lt $requiredFreeBytes ]]; then
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
exit 1
fi
}
chooseInterface() {
# Turn the available interfaces into an array so it can be used with a whiptail dialog
interfacesArray=()
@ -286,9 +300,12 @@ setStaticIPv4() {
}
setDNS(){
DNSChoseCmd=(whiptail --separate-output --radiolist "Select Upstream DNS Provider" $r $c 3)
DNSChoseCmd=(whiptail --separate-output --radiolist "Select Upstream DNS Provider" $r $c 6)
DNSChooseOptions=(Google "" on
OpenDNS "" off
Level3 "" off
Norton "" off
Comodo "" off)
Other "" off)
DNSchoices=$("${DNSChoseCmd[@]}" "${DNSChooseOptions[@]}" 2>&1 >/dev/tty)
if [[ $? = 0 ]];then
@ -303,6 +320,21 @@ setDNS(){
piholeDNS1="208.67.222.222"
piholeDNS2="208.67.220.220"
;;
Level3)
echo "::: Using Level3 servers."
piholeDNS1="4.2.2.1"
piholeDNS2="4.2.2.2"
;;
Norton)
echo "::: Using Norton ConnectSafe servers."
piholeDNS1="199.85.126.10"
piholeDNS2="199.85.127.10"
;;
Comodo)
echo "::: Using Comodo Secure servers."
piholeDNS1="8.26.56.26"
piholeDNS2="8.20.247.20"
;;
Other)
until [[ $DNSSettingsCorrect = True ]]
do
@ -399,7 +431,7 @@ stopServices() {
# Stop dnsmasq and lighttpd
$SUDO echo ":::"
$SUDO echo -n "::: Stopping services..."
$SUDO service dnsmasq stop & spinner $! || true
#$SUDO service dnsmasq stop & spinner $! || true
$SUDO service lighttpd stop & spinner $! || true
$SUDO echo " done."
}
@ -590,6 +622,9 @@ The install log is in /etc/pihole." $r $c
$SUDO mkdir -p /etc/pihole/
welcomeDialogs
# Verify there is enough disk space for the install
verifyFreeDiskSpace
# Just back up the original Pi-hole right away since it won't take long and it gets it out of the way
backupLegacyPihole
# Find interfaces and let the user choose one
@ -610,7 +645,7 @@ displayFinalMessage
echo -n "::: Restarting services..."
# Start services
$SUDO service dnsmasq start
$SUDO service dnsmasq restart
$SUDO service lighttpd start
echo " done."

View file

@ -31,6 +31,8 @@ piholeIPv6file=/etc/pihole/.useIPv6
adListFile=/etc/pihole/adlists.list
adListDefault=/etc/pihole/adlists.default
whitelistScript=/usr/local/bin/whitelist.sh
blacklistScript=/usr/local/bin/blacklist.sh
if [[ -f $piholeIPfile ]];then
# If the file exists, it means it was exported from the installation script and we should use that value instead of detecting it in this script
@ -220,7 +222,7 @@ function gravity_Schwarzchild() {
function gravity_Blacklist(){
# Append blacklist entries if they exist
echo -n "::: Running blacklist script to update HOSTS file...."
blacklist.sh -f -nr -q > /dev/null & spinner $!
$blacklistScript -f -nr -q > /dev/null & spinner $!
numBlacklisted=$(wc -l < "/etc/pihole/blacklist.txt")
plural=; [[ "$numBlacklisted" != "1" ]] && plural=s
@ -245,7 +247,7 @@ function gravity_Whitelist() {
echo " done!"
echo -n "::: Running whitelist script to update HOSTS file...."
whitelist.sh -f -nr -q ${urls[@]} > /dev/null & spinner $!
$whitelistScript -f -nr -q ${urls[@]} > /dev/null & spinner $!
numWhitelisted=$(wc -l < "/etc/pihole/whitelist.txt")
plural=; [[ "$numWhitelisted" != "1" ]] && plural=s