extend sd card before fatpack (#3783)

This commit is contained in:
/rootzoll 2023-05-04 12:35:16 +02:00 committed by GitHub
parent 4cbdde88c2
commit 7943fe0611
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 1 deletions

View file

@ -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

View file

@ -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