cleanup_fn_()
{
- test -n "$loopdev" && losetup -d "$loopdev"
+ test -n "$loopdev" \
+ && { udevadm settle --timeout=3; losetup -d "$loopdev"; }
}
# If the loop module is loaded, unload it first
dd if=/dev/zero of=backing_file bs=1M count=4 >/dev/null 2>&1 || fail=1
# Set up loop device on top of backing file
-loopdev=`losetup -f --show backing_file`
+loopdev=$(losetup -f --show backing_file)
test -z "$loopdev" && fail=1
require_partitionable_loop_device_ $loopdev
udevadm settle --timeout=5 || fail=1
# Verify that the partition appeared in /proc/partitions
-entry=`basename "$loopdev"p1`
+entry=$(basename "$loopdev"p1)
grep "$entry" /proc/partitions || { cat /proc/partitions; fail=1; }
# Remove the partition