1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-11-18 06:08:21 +00:00

Merge branch 'development' for release 2.5.2

This commit is contained in:
Promofaux 2016-02-14 23:09:09 +00:00
commit 7116634739
4 changed files with 57 additions and 6 deletions

View File

@ -6,3 +6,12 @@ http://pgl.yoyo.org/adservers/serverlist.php?
http://someonewhocares.org/hosts/hosts
http://winhelp2002.mvps.org/hosts.txt
http://mirror1.malwaredomains.com/files/justdomains
http://securemecca.com/Downloads/hosts.txt
https://hosts.neocities.org/
http://sysctl.org/cameleon/hosts
https://zeustracker.abuse.ch/blocklist.php?download=domainblocklist
https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt
https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt
http://optimate.dl.sourceforge.net/project/adzhosts/HOSTS.txt
https://raw.githubusercontent.com/quidsup/notrack/master/trackers.txt

View File

@ -51,9 +51,13 @@ function CalcblockedToday(){
function CalcPercentBlockedToday(){
if [ "$queriesToday" != "Err." ] && [ "$blockedToday" != "Err." ]; then
#scale 2 rounds the number down, so we'll do scale 4 and then trim the last 2 zeros
percentBlockedToday=$(echo "scale=4; $blockedToday/$queriesToday*100" | bc)
percentBlockedToday=$(sed 's/.\{2\}$//' <<< "$percentBlockedToday")
if [ "$queriesToday" != 0 ]; then #Fixes divide by zero error :)
#scale 2 rounds the number down, so we'll do scale 4 and then trim the last 2 zeros
percentBlockedToday=$(echo "scale=4; $blockedToday/$queriesToday*100" | bc)
percentBlockedToday=$(sed 's/.\{2\}$//' <<< "$percentBlockedToday")
else
percentBlockedToday=0
fi
fi
}

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=()
@ -148,6 +162,12 @@ chooseInterface() {
}
cleanupIPv6() {
# Removes IPv6 indicator file if we are not using IPv6
if [ -f "/etc/pihole/.useIPv6" ] && [ ! $useIPv6 ]; then
rm /etc/pihole/.useIPv6
fi
}
use4andor6() {
# Let use select IPv4 and/or IPv6
@ -187,6 +207,7 @@ use4andor6() {
echo "::: Exiting"
exit 1
fi
cleanupIPv6
else
echo "::: Cancel selected. Exiting..."
exit 1
@ -557,6 +578,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
@ -575,6 +599,18 @@ $SUDO mv $tmpLog $instalLogLoc
displayFinalMessage
echo -n "::: Restarting services..."
# Start services
$SUDO service dnsmasq start
$SUDO service lighttpd start
echo " done."
echo ":::"
echo "::: Installation Complete! Configure your devices to use the Pi-hole as their DNS server using:"
echo "::: $IPv4addr"
echo "::: $piholeIPv6"
echo ":::"
echo "::: If you set a new IP address, you should restart the Pi."
echo "::: "
echo "::: The install log is located at: /etc/pihole/install.log"

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
@ -198,7 +200,7 @@ function gravity_spinup() {
# Default is a simple request
*) cmd_ext=""
esac
gravity_transport $url $cmd_ext $agent
gravity_transport "$url" "$cmd_ext" "$agent"
done
}
@ -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