dracut modules: wait for disks to show up

master
BodgeMaster 2023-06-28 15:19:06 +02:00
parent d30bc61c0e
commit 6ebde2efd1
1 changed files with 34 additions and 1 deletions

View File

@ -17,7 +17,40 @@ case "$CONTAINER" in
emergency_shell
esac
mount -t f2fs -o nodev,nosuid "$CONTAINER" /sysroot/container
# try to wait for $CONTAINER to be available
function mount_container {
mount -t f2fs -o nodev,nosuid "$CONTAINER" /sysroot/container;
}
if [ -b "$CONTAINER" ]; then
mount_container
else
sleep 1
if [ -b "$CONTAINER" ]; then
mount_container
else
sleep 1
if [ -b "$CONTAINER" ]; then
mount_container
else
sleep 3
if [ -b "$CONTAINER" ]; then
mount_container
else
sleep 5
if [ -b "$CONTAINER" ]; then
mount_container
else
sleep 10
if [ -b "$CONTAINER" ]; then
mount_container
fi
# assume that the drive won't show up after more than 20s
fi
fi
fi
fi
fi
if [ -f /sysroot/container/squashfs.img ]; then
losetup -r -f /sysroot/container/squashfs.img