core: leave volatile.img structure creation for the VM

This is already handled by a script in initramfs.

Fixes QubesOS/qubes-issues#1308
This commit is contained in:
Marek Marczykowski-Górecki 2015-11-25 01:24:00 +01:00
parent 564ea5d64c
commit de275cc917
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -26,28 +26,3 @@ fi
TOTAL_SIZE=$[ $ROOT_SIZE + $SWAP_SIZE + 512 ]
truncate -s ${TOTAL_SIZE}M "$FILENAME"
sfdisk --no-reread -u M "$FILENAME" > /dev/null 2> /dev/null <<EOF
0,${SWAP_SIZE},S
,${ROOT_SIZE},L
EOF
(
flock 200
loopdev=`losetup -f --show --partscan "$FILENAME"`
udevadm settle
created=
if [ ! -e ${loopdev}p1 ]; then
# device wasn't created automatically, probably udev isn't running;
# create devs manually
for partdev in /sys/block/$(basename ${loopdev})/loop*p*; do
mknod /dev/$(basename ${partdev}) b $(cat ${partdev}/dev | tr : ' ')
done
created=yes
fi
mkswap -f ${loopdev}p1 > /dev/null
if [ "$created" = "yes" ]; then
rm -f ${loopdev}p*
fi
losetup -d ${loopdev} || :
chown --reference `dirname "$FILENAME"` "$FILENAME"
) 200>"/var/run/qubes/prepare-volatile-img.lock"