detect inconsistant sd card image

This commit is contained in:
rootzoll
2021-05-25 13:55:58 -05:00
parent 9211380701
commit e71e4796b2
2 changed files with 24 additions and 0 deletions

View File

@@ -87,6 +87,18 @@ if [ "${setupStep}" != "100" ]; then
fi
sudo chmod 777 ${infoFile}
######################################
# CHECK SD CARD INCONSISTENT STATE
# when the provision did not ran thru without error (ask user for fresh sd card)
provisionFlagExists=$(sudo ls /home/admin/provision.flag | grep -c 'provision.flag')
if [ "${provisionFlagExists}" == "1" ]; then
sed -i "s/^state=.*/state=inconsistentsystem/g" ${infoFile}
sed -i "s/^message=.*/message='provision did not ran thru'/g" ${infoFile}
echo "FAIL: 'provision did not ran thru - need fresh sd card!" >> ${logFile}
exit 1
fi
######################################
# SECTION FOR POSSIBLE REBOOT ACTIONS
systemInitReboot=0
@@ -439,6 +451,9 @@ if [ ${isMounted} -eq 0 ]; then
source ${infoFile}
echo "# PROVISION PROCESS with setupPhase(${setupPhase})"
# mark system on sd card as in setup process
echo "the provision process was started but did not finish yet" > /home/admin/provision.flag
# temp mount the HDD
echo "Temp mounting data drive ($hddCandidate)" >> $logFile
if [ "${hddFormat}" != "btrfs" ]; then

View File

@@ -88,6 +88,15 @@ ssh admin@${localip}
Use your Password A
" 7 41
elif [ "${eventID}" == "inconsistentsystem" ]; then
dialog --backtitle "${backtitle}" --cr-wrap --infobox "
PLEASE START WITH A FRESH SD CARD IMAGE
---------------------------------------
Cut power & remove sd card and then
flash a fresh RaspiBlitz image on it.
" 8 45
elif [ "${eventID}" == "waitsetup" ] && [ "${mode}" == "lcd" ]; then
if [ "${setupPhase}" == "setup" ] || [ "${setupPhase}" == "update" ] || [ "${setupPhase}" == "recovery" ] || [ "${setupPhase}" == "migration" ]; then