mirror of
https://github.com/Retropex/raspiblitz.git
synced 2025-05-13 03:30:49 +02:00
#936 expanding sd card, detecting too small card
This commit is contained in:
parent
27cfc64299
commit
6358d3631a
@ -143,6 +143,10 @@ while :
|
|||||||
message=$(echo $message | awk '{printf( "%.2f%%", 100 * $1)}')
|
message=$(echo $message | awk '{printf( "%.2f%%", 100 * $1)}')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# when old data - improve message
|
||||||
|
elif [ "${state}" = "sdtoosmall" ]; then
|
||||||
|
message="SDCARD TOO SMALL - min 16GB"
|
||||||
|
|
||||||
# when old data - improve message
|
# when old data - improve message
|
||||||
elif [ "${state}" = "olddata" ]; then
|
elif [ "${state}" = "olddata" ]; then
|
||||||
message="login for manual migration"
|
message="login for manual migration"
|
||||||
|
@ -30,6 +30,10 @@ cp $logFile /home/admin/raspiblitz.setup.log
|
|||||||
echo "Setting the Name/Alias/Hostname .."
|
echo "Setting the Name/Alias/Hostname .."
|
||||||
sudo /home/admin/config.scripts/lnd.setname.sh ${hostname}
|
sudo /home/admin/config.scripts/lnd.setname.sh ${hostname}
|
||||||
|
|
||||||
|
# expanding the root of the sd card
|
||||||
|
sudo raspi-config --expand-rootfs
|
||||||
|
sudo sed -i "s/^fsexpanded=.*/fsexpanded=1/g" /home/admin/raspiblitz.info
|
||||||
|
|
||||||
# mark setup is done
|
# mark setup is done
|
||||||
sudo sed -i "s/^setupStep=.*/setupStep=100/g" /home/admin/raspiblitz.info
|
sudo sed -i "s/^setupStep=.*/setupStep=100/g" /home/admin/raspiblitz.info
|
||||||
|
|
||||||
|
@ -26,6 +26,40 @@ if [ ${configExists} -eq 0 ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# check if file system was expanded to full capacity and sd card is bigger then 8GB
|
||||||
|
# see: https://github.com/rootzoll/raspiblitz/issues/936
|
||||||
|
source ${infoFile}
|
||||||
|
if [ "${baseImage}" = "raspbian" ]; then
|
||||||
|
echo "### RASPBIAN: CHECKING SD CARD SIZE ###" >> ${logFile}
|
||||||
|
sudo sed -i "s/^message=.*/message='Checking SD Card'/g" ${infoFile}
|
||||||
|
byteSizeSdCard=$(df --output=size,source | grep "/dev/root" | tr -cd "[0-9]")
|
||||||
|
echo "Size in Bytes is: ${byteSizeSdCard}" >> ${logFile}
|
||||||
|
if [ ${byteSizeSdCard} -lt 8192000 ]; then
|
||||||
|
echo "SD Card filesystem is smaller then 8GB." >> ${logFile}
|
||||||
|
if [ ${fsexpanded} -eq 1 ]; then
|
||||||
|
echo "There was already an attempt to expand the fs, but still not bigger then 8GB." >> ${logFile}
|
||||||
|
echo "SD card seems to small - at least a 16GB card is needed. Display on LCD to user." >> ${logFile}
|
||||||
|
sudo sed -i "s/^state=.*/state=sdtoosmall/g" ${infoFile}
|
||||||
|
sudo sed -i "s/^message=.*/message='Min 16GB SD card needed'/g" ${infoFile}
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "Try to expand SD card FS, display info and reboot." >> ${logFile}
|
||||||
|
sudo sed -i "s/^state=.*/state=reboot/g" ${infoFile}
|
||||||
|
sudo sed -i "s/^message=.*/message='Expanding SD Card'/g" ${infoFile}
|
||||||
|
sudo sed -i "s/^fsexpanded=.*/fsexpanded=1/g" ${infoFile}
|
||||||
|
sudo raspi-config --expand-rootfs
|
||||||
|
sleep 6
|
||||||
|
sudo shutdown -r now
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Size looks good. Bigger then 8GB card is used." >> ${logFile}
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Baseimage is ${baseImage} - not raspbian, skipping the sd card size check." >> ${logFile}
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# import config values
|
# import config values
|
||||||
sudo chmod 777 ${configFile}
|
sudo chmod 777 ${configFile}
|
||||||
source ${configFile}
|
source ${configFile}
|
||||||
|
@ -50,6 +50,7 @@ sudo killall -3 fbi
|
|||||||
network=""
|
network=""
|
||||||
chain=""
|
chain=""
|
||||||
setupStep=0
|
setupStep=0
|
||||||
|
fsexpanded=0
|
||||||
|
|
||||||
# try to load old values if available (overwrites defaults)
|
# try to load old values if available (overwrites defaults)
|
||||||
source ${infoFile} 2>/dev/null
|
source ${infoFile} 2>/dev/null
|
||||||
@ -60,6 +61,7 @@ echo "state=starting" > $infoFile
|
|||||||
echo "message=" >> $infoFile
|
echo "message=" >> $infoFile
|
||||||
echo "network=${network}" >> $infoFile
|
echo "network=${network}" >> $infoFile
|
||||||
echo "chain=${chain}" >> $infoFile
|
echo "chain=${chain}" >> $infoFile
|
||||||
|
echo "fsexpanded=${fsexpanded}" >> $infoFile
|
||||||
echo "setupStep=${setupStep}" >> $infoFile
|
echo "setupStep=${setupStep}" >> $infoFile
|
||||||
if [ "${setupStep}" != "100" ]; then
|
if [ "${setupStep}" != "100" ]; then
|
||||||
echo "hostname=${hostname}" >> $infoFile
|
echo "hostname=${hostname}" >> $infoFile
|
||||||
|
Loading…
Reference in New Issue
Block a user