Skip to content

Commit

Permalink
Include fix for regex in verifyFreeDiskSpace()
Browse files Browse the repository at this point in the history
  • Loading branch information
PromoFaux committed Feb 20, 2016
1 parent 668b883 commit b41608d
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions automated install/basic-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,19 @@ welcomeDialogs() {


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
# 25MB is the minimum space needed (20MB install + 5MB one day of logs.)
requiredFreeBytes=25600

existingFreeBytes=`df -lk / 2>&1 | awk '{print $4}' | head -2 | tail -1`
if ! [[ "$existingFreeBytes" =~ ^([0-9])*$ ]]; then
existingFreeBytes=`df -lk /dev 2>&1 | awk '{print $4}' | head -2 | tail -1`
fi

if [[ $existingFreeBytes -lt $requiredFreeBytes ]]; then
echo "$existingFreeBytes is less than $requiredFreeBytes"
echo "Insufficient free space, exiting..."
exit 1
fi
}


Expand Down

0 comments on commit b41608d

Please sign in to comment.