mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-09-25 19:21:57 +02:00
more simple state management on admin login
This commit is contained in:
@@ -14,6 +14,8 @@ if [ ${bootstrapInfoExists} -eq 1 ]; then
|
||||
if [ "${state}" = "presync" ]; then
|
||||
echo "TODO: Stop pre-sync ... press key to continue"
|
||||
read key
|
||||
# unmount the temporary mount
|
||||
sudo umount -l /mnt/hdd
|
||||
# update info file
|
||||
state=waitsetup
|
||||
echo "state=waitsetup" > $infoFile
|
||||
@@ -21,39 +23,11 @@ if [ ${bootstrapInfoExists} -eq 1 ]; then
|
||||
echo "device=${device}" >> $infoFile
|
||||
fi
|
||||
|
||||
# wait until boostrap process is done
|
||||
keepWaiting=1
|
||||
while [ ${keepWaiting} -eq 1 ]
|
||||
do
|
||||
|
||||
# 1) when bootstrap on configured device
|
||||
if [ "${state}" = "ready" ]; then
|
||||
echo "detected bootstrap ready"
|
||||
keepWaiting=0
|
||||
|
||||
# 2) when bootstrap on a fresh sd card
|
||||
elif [ "${state}" = "waitsetup" ]; then
|
||||
echo "detected bootstrap waitinmg for setup"
|
||||
|
||||
# unmount the temporary mount
|
||||
sudo umount -l /mnt/hdd
|
||||
|
||||
# update info file - that setup started
|
||||
echo "state=setup" > $infoFile
|
||||
echo "message='SetUp Started'" >> $infoFile
|
||||
echo "device=${device}" >> $infoFile
|
||||
keepWaiting=0
|
||||
|
||||
# 3) when bootstap is still running
|
||||
else
|
||||
# wait 2 sevs and check again
|
||||
echo "bootstrap still running - state(${state}) message(${message})"
|
||||
echo "please wait, act or CTRL+c --> Exit to terminal"
|
||||
sleep 2
|
||||
keepWaiting=1
|
||||
fi
|
||||
|
||||
done
|
||||
# signal if bootstrap is not ready yet
|
||||
if [ "${state}" = "recovering" ]; then
|
||||
echo "WARNING: bootstrap is still updating - please close SSH and login later again"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
|
@@ -134,6 +134,7 @@ if [ ${hddIsAutoMounted} -eq 0 ]; then
|
||||
echo "state=waitsetup" > $infoFile
|
||||
echo "message='HDD failed Mounting'" >> $infoFile
|
||||
echo "device=${hddDeviceName}" >> $infoFile
|
||||
# no need to unmount the HDD, it failed mounting
|
||||
exit 1
|
||||
else
|
||||
echo "OK - HDD available under /mnt/hdd" >> $logFile
|
||||
@@ -148,6 +149,8 @@ if [ ${hddIsAutoMounted} -eq 0 ]; then
|
||||
echo "state=recovering" > $infoFile
|
||||
echo "message='TODO: migration and recover'" >> $infoFile
|
||||
echo "device=${hddDeviceName}" >> $infoFile
|
||||
# unmountig the HDD at the end of the process
|
||||
sudo umount -l /mnt/hdd
|
||||
exit 1
|
||||
else
|
||||
echo "OK - No config file found: ${configFile}" >> $logFile
|
||||
@@ -161,6 +164,7 @@ if [ ${hddIsAutoMounted} -eq 0 ]; then
|
||||
echo "state=olddata" > $infoFile
|
||||
echo "message='No Auto-Update possible'" >> $infoFile
|
||||
echo "device=${hddDeviceName}" >> $infoFile
|
||||
# keep HDD mounted if user wants to copy data
|
||||
exit 1
|
||||
else
|
||||
echo "OK - No LND data found" >> $logFile
|
||||
@@ -175,6 +179,7 @@ if [ ${hddIsAutoMounted} -eq 0 ]; then
|
||||
echo "state=presync" > $infoFile
|
||||
echo "message='TODO: start pre-sync'" >> $infoFile
|
||||
echo "device=${hddDeviceName}" >> $infoFile
|
||||
# after admin login, presync will be stoped and HDD unmounted
|
||||
exit 1
|
||||
else
|
||||
ls /mnt/hdd/bitcoin/blocks/blk00000.dat >> $logFile
|
||||
@@ -186,6 +191,8 @@ if [ ${hddIsAutoMounted} -eq 0 ]; then
|
||||
echo "state=waitsetup" > $infoFile
|
||||
echo "message='HDD needs SetUp (2)'" >> $infoFile
|
||||
echo "device=${hddDeviceName}" >> $infoFile
|
||||
# unmount HDD to be ready for auto-mount during setup
|
||||
sudo umount -l /mnt/hdd
|
||||
exit 1
|
||||
|
||||
fi
|
||||
|
Reference in New Issue
Block a user