diff --git a/home.admin/config.scripts/blitz.bootdrive.sh b/home.admin/config.scripts/blitz.bootdrive.sh index ea7461f5c..95bcb71fe 100644 --- a/home.admin/config.scripts/blitz.bootdrive.sh +++ b/home.admin/config.scripts/blitz.bootdrive.sh @@ -32,7 +32,7 @@ minimumSizeByte=16384000000 rootPartition=$(sudo mount | grep " / " | cut -d " " -f 1 | cut -d "/" -f 3) rootPartitionBytes=$(lsblk -b -o NAME,SIZE | grep "${rootPartition}" | tr -s ' ' | cut -d " " -f 2) -# make conculsions +# make conclusions needsExpansion=0 tooSmall=0 if [ $rootPartitionBytes -lt $minimumSizeByte ]; then diff --git a/home.admin/config.scripts/blitz.fatpack.sh b/home.admin/config.scripts/blitz.fatpack.sh index e4f106fad..2ccf45ca2 100755 --- a/home.admin/config.scripts/blitz.fatpack.sh +++ b/home.admin/config.scripts/blitz.fatpack.sh @@ -9,6 +9,31 @@ if [ "$EUID" -ne 0 ] exit 1 fi +# check if sd card needs expansion before fatpack +source <(sudo /home/admin/config.scripts/blitz.bootdrive.sh status) +if [ "${fsexpanded}" != "1" ]; then + + echo "################################################" + echo "# SD CARD NEEDS EXPANSION BEFORE FATPACK" + echo "# this will be done now ... and trigger a reboot" + echo "# after reboot run this script again" + echo "################################################" + + # write a stop file to prevent full bootstrap + # after fsexpand reboot + touch /boot/stop + + # trigger fsexpand + /home/admin/config.scripts/blitz.bootdrive.sh fsexpand + + # make sure this expand is not marked (because its not done after release) + sed -i "s/^fsexpanded=.*/fsexpanded=0/g" /home/admin/raspiblitz.info + + # trigger reboot + shutdown -h -r now + exit 0 +fi + apt_install() { apt install -y ${@} if [ $? -eq 100 ]; then