Merge branch 'development' into UpdateMethod

# Conflicts:
#	automated install/basic-install.sh
This commit is contained in:
Promofaux 2016-08-30 19:32:40 +01:00
commit 01a9534729
3 changed files with 21 additions and 10 deletions

View File

@ -1,4 +1,7 @@
<html>
<head>
<script>window.close();</script>
</head>
<body>
</body>
</html>
</html>

View File

@ -141,27 +141,27 @@ verifyFreeDiskSpace() {
# 50MB is the minimum space needed (45MB install (includes web admin bootstrap/jquery libraries etc) + 5MB one day of logs.)
# - Fourdee: Local ensures the variable is only created, and accessible within this function/void. Generally considered a "good" coding practice for non-global variables.
local requiredFreeBytes=51200
local existingFreeBytes=$(df -Pk | grep -m1 '\/$' | awk '{print $4}')
local required_free_kilobytes=51200
local existing_free_kilobytes=$(df -Pk | grep -m1 '\/$' | awk '{print $4}')
# - Unknown free disk space , not a integer
if ! [[ "$existingFreeBytes" =~ ^([0-9])+$ ]]; then
if ! [[ "$existing_free_kilobytes" =~ ^([0-9])+$ ]]; then
whiptail --title "Unknown free disk space" --yesno "We were unable to determine available free disk space on this system.\n\nYou may override this check and force the installation, however, it is not recommended.\n\nWould you like to continue with the installation?" --defaultno --backtitle "Pi-hole" ${r} ${c}
local choice=$?
if (( $choice != 0 )); then
echo "non-integer value from existingFreeBytes ($existingFreeBytes)"
echo "non-integer value from existing_free_kilobytes ($existing_free_kilobytes)"
echo "Unknown free space, user aborted, exiting..."
exit 1
fi
# - Insufficient free disk space
elif [[ ${existingFreeBytes} -lt ${requiredFreeBytes} ]]; then
elif [[ $existing_free_kilobytes -lt $required_free_kilobytes ]]; 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}
echo "$existingFreeBytes is less than $requiredFreeBytes"
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 $required_free_kilobytes KiloBytes.\nYou only have $existing_free_kilobytes KiloBytes 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 "$existing_free_kilobytes is less than $required_free_kilobytes"
echo "Insufficient free space, exiting..."
exit 1
@ -295,8 +295,8 @@ It is also possible to use a DHCP reservation, but if you are going to do that,
Gateway: $IPv4gw" ${r} ${c}); then
# If the settings are correct, then we need to set the piholeIP
# Saving it to a temporary file us to retrieve it later when we run the gravity.sh script. piholeIP is saved to a permanent file so gravity.sh can use it when updating
${SUDO} echo "${IPv4addr%/*}" > /etc/pihole/piholeIP
${SUDO} echo "$piholeInterface" > /tmp/piholeINT
$SUDO echo "${IPv4addr%/*}" > /etc/pihole/piholeIP
$SUDO echo "$piholeInterface" > /tmp/piholeINT
# After that's done, the loop ends and we move on
ipSettingsCorrect=True
else

8
pihole
View File

@ -70,6 +70,12 @@ function setupLCDFunction {
exit 1
}
function queryFunc {
domain=$2
for list in /etc/pihole/list.*;do echo $list;grep ${domain} $list;done
exit 1
}
function chronometerFunc {
shift
${SUDO} /opt/pihole/chronometer.sh "$@"
@ -105,6 +111,7 @@ function helpFunc {
echo "::: -c, chronometer Calculates stats and displays to an LCD"
echo "::: -h, help Show this help dialog"
echo "::: -v, version Show current versions"
echo "::: -q, query Query the adlists for a specific domain"
echo "::: uninstall Uninstall Pi-Hole from your system :(!"
exit 1
}
@ -126,6 +133,7 @@ case "$1" in
"-c" | "chronometer" ) chronometerFunc "$@";;
"-h" | "help" ) helpFunc;;
"-v" | "version" ) versionFunc;;
"-q" | "query" ) queryFunc "$@";;
"uninstall" ) uninstallFunc;;
* ) helpFunc;;
esac