Merge pull request #743 from pi-hole/whatDuplicates

What duplicates
This commit is contained in:
Jacob Salmela 2016-10-04 08:53:51 -05:00 committed by GitHub
commit ca0cbd68d6
1 changed files with 22 additions and 20 deletions

View File

@ -149,27 +149,27 @@ verifyFreeDiskSpace() {
# 50MB is the minimum space needed (45MB install (includes web admin bootstrap/jquery libraries etc) + 5MB one day of logs.) # 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. # - Fourdee: Local ensures the variable is only created, and accessible within this function/void. Generally considered a "good" coding practice for non-global variables.
echo "::: Verifying free disk space..."
local required_free_kilobytes=51200 local required_free_kilobytes=51200
local existing_free_kilobytes=$(df -Pk | grep -m1 '\/$' | awk '{print $4}') local existing_free_kilobytes=$(df -Pk | grep -m1 '\/$' | awk '{print $4}')
# - Unknown free disk space , not a integer # - Unknown free disk space , not a integer
if ! [[ "$existing_free_kilobytes" =~ ^([0-9])+$ ]]; then if ! [[ "$existing_free_kilobytes" =~ ^([0-9])+$ ]]; then
echo "::: Unknown free disk space!"
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} echo "::: We were unable to determine available free disk space on this system."
local choice=$? echo "::: You may override this check and force the installation, however, it is not recommended"
if (( $choice != 0 )); then echo "::: To do so, pass the argument '--i_do_not_follow_recommendations' to the install script"
echo "::: eg. curl -L https://install.pi-hole.net | bash /dev/stdin --i_do_not_follow_recommendations"
echo "non-integer value from existing_free_kilobytes ($existing_free_kilobytes)"
echo "Unknown free space, user aborted, exiting..."
exit 1 exit 1
fi
# - Insufficient free disk space # - Insufficient free disk space
elif [[ $existing_free_kilobytes -lt $required_free_kilobytes ]]; then elif [[ ${existing_free_kilobytes} -lt ${required_free_kilobytes} ]]; then
echo "::: Insufficient Disk Space!"
echo "::: Your system appears to be low on disk space. pi-hole recommends a minimum of $required_free_kilobytes KiloBytes."
echo "::: You only have $existing_free_kilobytes KiloBytes free."
echo "::: If this is a new install you may need to expand your disk."
echo "::: Try running 'sudo raspi-config', and choose the 'expand file system option'"
echo "::: After rebooting, run this installation again. (curl -L https://install.pi-hole.net | bash)"
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..." echo "Insufficient free space, exiting..."
exit 1 exit 1
@ -804,7 +804,6 @@ installPihole() {
checkForDependencies # done checkForDependencies # done
stopServices stopServices
setUser setUser
${SUDO} mkdir -p /etc/pihole/
if [ ! -d "/var/www/html" ]; then if [ ! -d "/var/www/html" ]; then
${SUDO} mkdir -p /var/www/html ${SUDO} mkdir -p /var/www/html
fi fi
@ -820,7 +819,6 @@ installPihole() {
getGitFiles getGitFiles
installScripts installScripts
installConfigs installConfigs
installConfigs
CreateLogFile CreateLogFile
configureSelinux configureSelinux
installPiholeWeb installPiholeWeb
@ -837,7 +835,6 @@ updatePihole() {
getGitFiles getGitFiles
installScripts installScripts
installConfigs installConfigs
installConfigs
CreateLogFile CreateLogFile
configureSelinux configureSelinux
installPiholeWeb installPiholeWeb
@ -928,15 +925,20 @@ if [[ -f ${setupVars} ]];then
fi fi
# Start the installer # Start the installer
# Verify there is enough disk space for the install
if [ $1 = "--i_do_not_follow_recommendations" ]; then
echo "::: ----i_do_not_follow_recommendations passed to script"
echo "::: skipping free disk space verification!"
else
verifyFreeDiskSpace
fi
# Install packages used by this installation script # Install packages used by this installation script
installerDependencies installerDependencies
if [[ ${useUpdateVars} == false ]]; then if [[ ${useUpdateVars} == false ]]; then
welcomeDialogs welcomeDialogs
# Verify there is enough disk space for the install
verifyFreeDiskSpace
${SUDO} mkdir -p /etc/pihole/ ${SUDO} mkdir -p /etc/pihole/
# Find IP used to route to outside world # Find IP used to route to outside world
findIPRoute findIPRoute
# Find interfaces and let the user choose one # Find interfaces and let the user choose one