From a9a499939ec1ea8add866479b7d5676cd1e0a4f8 Mon Sep 17 00:00:00 2001 From: "Daniel (Fourdee)" Date: Fri, 12 Aug 2016 12:44:45 +0100 Subject: [PATCH 1/3] Fourdee - See notes: https://github.com/pi-hole/pi-hole/issues/602 + Improve available free disk space check. + Option to override if the free disk space check is not a valid integer. --- automated install/basic-install.sh | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 254d601f..994ed94c 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -155,20 +155,35 @@ In the next section, you can choose to use your current network settings (DHCP) verifyFreeDiskSpace() { + # 50MB is the minimum space needed (45MB install (includes web admin bootstrap/jquery libraries etc) + 5MB one day of logs.) - requiredFreeBytes=51200 + # - 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}') - existingFreeBytes=$(df -lk / 2>&1 | awk '{print $4}' | head -2 | tail -1) + # - Unknown free disk space , not a integer if ! [[ "$existingFreeBytes" =~ ^([0-9])+$ ]]; then - existingFreeBytes=$(df -lk /dev 2>&1 | awk '{print $4}' | head -2 | tail -1) - fi - if [[ $existingFreeBytes -lt $requiredFreeBytes ]]; 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 "Unknown free space, user aborted, exiting..." + exit + + fi + + # - Insufficient free disk space + elif [[ $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 echo "$existingFreeBytes is less than $requiredFreeBytes" echo "Insufficient free space, exiting..." exit 1 + fi + } From 037318e2ffdb5edbcd67ad0844a6053f84cdbcea Mon Sep 17 00:00:00 2001 From: "Daniel (Fourdee)" Date: Fri, 12 Aug 2016 13:20:30 +0100 Subject: [PATCH 2/3] Provide non-zero exit code, as per existing sourcecode. --- automated install/basic-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 994ed94c..0ed95976 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -170,7 +170,7 @@ verifyFreeDiskSpace() { echo "non-integer value from existingFreeBytes ($existingFreeBytes)" echo "Unknown free space, user aborted, exiting..." - exit + exit 1 fi From 3ade7a8b0eccc7b63766c85d626777db5d0c5f26 Mon Sep 17 00:00:00 2001 From: Patrick Geneva Date: Fri, 5 Aug 2016 21:27:55 -0400 Subject: [PATCH 3/3] Added - Readme Windows Tray App --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index acfce86c..09de0d03 100644 --- a/README.md +++ b/README.md @@ -102,6 +102,7 @@ You can view [real-time stats](http://pi-hole.net/faq/install-the-real-time-lcd- - [unRaid-hole](https://github.com/spants/unraidtemplates/blob/master/Spants/unRaid-hole.xml#L13)--[Repo and more info](http://lime-technology.com/forum/index.php?PHPSESSID=c0eae3e5ef7e521f7866034a3336489d&topic=38486.0) - [Pi-hole on/off button](http://thetimmy.silvernight.org/pages/endisbutton/) - [Minibian Pi-hole](http://munkjensen.net/wiki/index.php/See_my_Pi-Hole#Minibian_Pi-hole) +- [Windows Tray Stat Application](https://github.com/goldbattle/copernicus) ## Coverage