Fix loop0p2 does not exist on F19
On Fedora 19, there is a delay between the time loop0p2 is created to the time it is ready to be mounted. This patches waits for 5 seconds for /dev/mapper/loop0p2 to be accessible. If it is not ready then the script exits with status 1. Fixes: bug #1197340 Change-Id: Iff0cfd0566673799a77500e0e24954f5f3743a17
This commit is contained in:
parent
57a1304df9
commit
9a81644d65
@ -38,6 +38,10 @@ if [ ! -f $IMG_PATH/$BASE_IMAGE_TAR -o \
|
||||
# /dev/loop0 does not create /dev/loop0p2, while kpartx at
|
||||
# least creates /dev/mapper/loop0p2.
|
||||
LOOPDEV=$(sudo kpartx -avr $WORKING/$RAW_FILE | awk "/loop[0-9]+$MAGIC_BIT/ {print \$3}")
|
||||
if ! timeout 5 sh -c "while ! [ -e /dev/mapper/$LOOPDEV ]; do sleep 1; done"; then
|
||||
echo "Error: Could not find /dev/mapper/$LOOPDEV"
|
||||
exit 1
|
||||
fi
|
||||
EACTION="sudo kpartx -d $WORKING/$RAW_FILE;$EACTION"
|
||||
trap "$EACTION" EXIT
|
||||
mkdir $WORKING/mnt
|
||||
|
Loading…
Reference in New Issue
Block a user