Merge remote-tracking branch 'qubesos/pr/5'
* qubesos/pr/5: fix VM autostart race condition Fixes qubesos/qubes-issues#1075 Conflicts: linux/aux-tools/prepare-volatile-img.sh
This commit is contained in:
parent
a425873e73
commit
d27d22a3cf
@ -31,20 +31,23 @@ sfdisk --no-reread -u M "$FILENAME" > /dev/null 2> /dev/null <<EOF
|
|||||||
,${ROOT_SIZE},L
|
,${ROOT_SIZE},L
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
loopdev=`losetup -f --show --partscan "$FILENAME"`
|
(
|
||||||
udevadm settle
|
flock 200
|
||||||
created=
|
loopdev=`losetup -f --show --partscan "$FILENAME"`
|
||||||
if [ ! -e ${loopdev}p1 ]; then
|
udevadm settle
|
||||||
|
created=
|
||||||
|
if [ ! -e ${loopdev}p1 ]; then
|
||||||
# device wasn't created automatically, probably udev isn't running;
|
# device wasn't created automatically, probably udev isn't running;
|
||||||
# create devs manually
|
# create devs manually
|
||||||
for partdev in /sys/block/$(basename ${loopdev})/loop*p*; do
|
for partdev in /sys/block/$(basename ${loopdev})/loop*p*; do
|
||||||
mknod /dev/$(basename ${partdev}) b $(cat ${partdev}/dev | tr : ' ')
|
mknod /dev/$(basename ${partdev}) b $(cat ${partdev}/dev | tr : ' ')
|
||||||
done
|
done
|
||||||
created=yes
|
created=yes
|
||||||
fi
|
fi
|
||||||
mkswap -f ${loopdev}p1 > /dev/null
|
mkswap -f ${loopdev}p1 > /dev/null
|
||||||
if [ "$created" = "yes" ]; then
|
if [ "$created" = "yes" ]; then
|
||||||
rm -f ${loopdev}p*
|
rm -f ${loopdev}p*
|
||||||
fi
|
fi
|
||||||
losetup -d ${loopdev} || :
|
losetup -d ${loopdev} || :
|
||||||
chown --reference `dirname "$FILENAME"` "$FILENAME"
|
chown --reference `dirname "$FILENAME"` "$FILENAME"
|
||||||
|
) 200>"/var/run/qubes/prepare-volatile-img.lock"
|
||||||
|
Loading…
Reference in New Issue
Block a user