Merge branch 'mountall-settle' into 'main'

mountall: use udevadm settle to wait for newly opened cryptodisks to appear in /dev/mapper

See merge request systemrescue/systemrescue-sources!230
This commit is contained in:
Gerd v. Egidy 2022-09-06 18:42:01 +00:00
commit 99b906f21f
2 changed files with 10 additions and 3 deletions

View file

@ -7,7 +7,8 @@ https://gitlab.com/systemrescue/systemrescue-sources/-/issues/278
------------------------------------------------------------------------------
9.05 (YYYY-MM-DD):
-------------------------------------------------------------------------------
------------------------------------------------------------------------------
* mountall: run udevadm settle to mount newly opened cryptodisks, improve messages
* Add rclone option to the "sysconfig" scope of YAML config file, it writes a rclone.conf file
------------------------------------------------------------------------------

View file

@ -197,6 +197,8 @@ create_mountpoint()
{
local DEV="$1"
[[ $VERBOSE -eq 1 ]] && echo "looking for a suitable mountpoint for $DEV"
DEVNAME=$(basename "$DEV")
MOUNTPOINT="/mnt/$DEVNAME"
@ -265,10 +267,10 @@ try_mount()
{
local DEV="$1"
echo -n "mounting $DEV... "
create_mountpoint "$DEV" || return
echo -n "mounting $DEV to $MOUNTPOINT... "
local OPTIONS=""
if [[ $READONLY -eq 1 ]]; then
[[ $VERBOSE -eq 1 ]] && echo "mounting read-only"
@ -311,6 +313,10 @@ for BLKDEV in $(ls -1 "/sys/class/block"); do
fi
done
# if we just opened a cryptodev we have to wait until it appears in /dev/mapper
[[ $VERBOSE -eq 1 ]] && echo "waiting until recently opened lvm devices appear in /dev/mapper"
udevadm settle --timeout=10
# loop through device mapper / lvm volumes
for LVMDEV in $(ls -1 "/dev/mapper"); do
# there is always one central control entry, skip it