mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-24 11:46:30 +00:00
fwupdater initramfs: intelligently wait for sdcard up to 10s
This commit is contained in:
parent
5d570f6333
commit
a67184be15
@ -1,14 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin
|
||||
DISK_TIMEOUT="10"
|
||||
|
||||
msg() {
|
||||
echo "* $1"
|
||||
echo " * $1"
|
||||
}
|
||||
|
||||
msg "Waiting for sdcard"
|
||||
sleep 2
|
||||
|
||||
msg "Mounting pseudo filesystems"
|
||||
mount -t devtmpfs devtmpfs /dev
|
||||
mount -t proc proc /proc
|
||||
@ -24,12 +22,24 @@ else # e.g. /dev/sdc2
|
||||
DATA_DEV=${DISK_DEV}3
|
||||
fi
|
||||
|
||||
msg "Waiting for sdcard"
|
||||
count=0
|
||||
while true; do
|
||||
if [ $count -ge $DISK_TIMEOUT ]; then
|
||||
break
|
||||
fi
|
||||
if [ -b $ROOT_DEV ]; then
|
||||
break
|
||||
fi
|
||||
count=$(($count + 1))
|
||||
sleep 1
|
||||
done
|
||||
|
||||
msg "Disk device is $DISK_DEV"
|
||||
msg "Boot device is $BOOT_DEV"
|
||||
msg "Root device is $ROOT_DEV"
|
||||
msg "Data device is $DATA_DEV"
|
||||
|
||||
|
||||
FW_DIR=/data/.fwupdate
|
||||
FW_FILE=firmware.img.gz
|
||||
FW_FILE_EXTR=firmware.img
|
||||
@ -101,3 +111,4 @@ dd if=$FW_DIR/$FW_FILE_EXTR skip=$root_start of=$ROOT_DEV bs=1048576 count=$root
|
||||
|
||||
msg "Cleaning up"
|
||||
rm -rf $FW_DIR
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user