Wait for udev to process all the events during volatile.img preparation

Otherwise it could happen that the device will still be opened by udev,
so can't be freed by kpartx
This commit is contained in:
Marek Marczykowski-Górecki 2015-03-30 21:30:58 +02:00
parent 063e2617d6
commit 98ab523da4

View File

@ -40,7 +40,7 @@ kpartx -s -a "$FILENAME"
loopdev=`losetup -j "$FILENAME"|tail -n 1 |cut -d: -f1`
looppart=`echo $loopdev|sed 's:dev:dev/mapper:'`
mkswap -f ${looppart}p1 > /dev/null
sync
udevadm settle
kpartx -s -d ${loopdev}
losetup -d ${loopdev} || :
chown --reference `dirname "$FILENAME"` "$FILENAME"