1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-02-01 05:47:04 +03:00

test-50-dissect: wait for and lock loop block partition devices

This commit is contained in:
Yu Watanabe 2022-08-27 16:13:27 +09:00
parent 3228f89b8c
commit ba44a5c77c

View File

@ -189,11 +189,20 @@ if [ "${HAVE_OPENSSL}" -eq 1 ]; then
sfdisk --part-label "${image}.gpt" 3 "Signature Partition" sfdisk --part-label "${image}.gpt" 3 "Signature Partition"
fi fi
loop="$(losetup --show -P -f "${image}.gpt")" loop="$(losetup --show -P -f "${image}.gpt")"
udevadm wait --timeout 60 --settle "${loop:?}" partitions=(
dd if="${image}.raw" of="${loop}p1" "${loop:?}p1"
dd if="${image}.verity" of="${loop}p2" "${loop:?}p2"
)
if [ "${HAVE_OPENSSL}" -eq 1 ]; then if [ "${HAVE_OPENSSL}" -eq 1 ]; then
dd if="${image}.verity-sig" of="${loop}p3" partitions+=( "${loop:?}p3" )
fi
# The kernel sometimes(?) does not emit "add" uevent for loop block partition devices.
# Let's not expect the devices to be initialized.
udevadm wait --timeout 60 --settle --initialized=no "${partitions[@]}"
udevadm lock --device="${loop}p1" dd if="${image}.raw" of="${loop}p1"
udevadm lock --device="${loop}p2" dd if="${image}.verity" of="${loop}p2"
if [ "${HAVE_OPENSSL}" -eq 1 ]; then
udevadm lock --device="${loop}p3" dd if="${image}.verity-sig" of="${loop}p3"
fi fi
losetup -d "${loop}" losetup -d "${loop}"