Make sure a loop device exists before kpartx is called

If "kpartx -av" is called and there is no unused /dev/loop* device,
then kpartx fails. Calling "losetup -f" finds first unused device
and creates it if it doesn't exist.

Fixes bug #1195264

Change-Id: I5d59b519fd8e2a7380b71a788f9d3f2331b6567f
This commit is contained in:
Jan Provaznik 2014-01-06 10:55:06 +01:00
parent 09a8fca8d0
commit c9cceeeb40

View File

@ -49,6 +49,9 @@ else
# UPDATE to above warning alluding to Fedora18:
# F19 images have the rootfs partition on p1
MAGIC_BIT=p1
# kpartx fails if no /dev/loop* exists, "losetup -f" prints first unused
# loop device and creates it if it doesn't exist
sudo losetup -f
# XXX: Parsing stdout is dangerous, would like a better way to discover
# the device used for the image.
# NOTE: On F17 (parted-3.0-10.fc17.x86_64), partprobe of