From 2da704e872b9880bd3d079f5bebe772d3bc8c137 Mon Sep 17 00:00:00 2001 From: mxklb Date: Fri, 14 Feb 2020 13:37:02 +0000 Subject: [PATCH] Check for enough space on /boot volume (check #209) --- install.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/install.sh b/install.sh index 96cf563..8ca241b 100755 --- a/install.sh +++ b/install.sh @@ -7,6 +7,25 @@ if [[ $EUID -ne 0 ]]; then exit 1 fi +# Check for enough space on /boot volume +boot_line=$(df -h | grep /boot | head -n 1) +if [ "x${boot_line}" = "x" ]; then + echo "Warning: /boot volume not found .." +else + boot_space=$(echo $boot_line | awk '{print $4;}') + free_space=$(echo "${boot_space%?}") + unit="${boot_space: -1}" + if [[ "$unit" = "K" ]]; then + echo "Error: Not enough space left ($boot_space) on /boot" + exit 1 + elif [[ "$unit" = "M" ]]; then + if [ "$free_space" -lt "25" ]; then + echo "Error: Not enough space left ($boot_space) on /boot" + exit 1 + fi + fi +fi + # # make sure that we are on something ARM/Raspberry related # either a bare metal Raspberry or a qemu session with