Commit e177121d authored by Gleb Fotengauer-Malinovskiy's avatar Gleb Fotengauer-Malinovskiy Committed by Michael Shigorin

tar2vm: use UUID, prepare for virtio as well

Forward-port of b84182c5cb684afbd30ed1f9e5b6f89f55b4b53f commit extended to handle /boot as well.
parent b0df2032
......@@ -167,6 +167,20 @@ if [ -n "$BOOTPART" ]; then
mkfs."$BOOTFSTYPE" "$LOOPBOOT"
fi
ROOTUUID="$(blkid -s UUID -o value -c /dev/null "$LOOPROOT")"
if [ -n "$ROOTUUID" ]; then
ROOTDEV="UUID=$ROOTUUID"
else
ROOTDEV="$LOOPROOT"
fi
if [ -n "$BOOTPART" ]; then
BOOTUUID="$(blkid -s UUID -o value -c /dev/null "$LOOPBOOT")"
if [ -n "$ROOTUUID" ]; then
BOOTDEV="UUID=$BOOTUUID"
fi
fi
# mount and populate it
mkdir -pm755 "$ROOTFS"
mount "$LOOPROOT" "$ROOTFS"
......@@ -180,7 +194,7 @@ tar -C "$ROOTFS" --numeric-owner -xf "$TAR"
for i in /dev /proc /sys; do mount --bind "$i" "$ROOTFS$i"; done
# loop device so lilo could work...
echo "$LOOPROOT / $ROOTFSTYPE relatime 1 1" >> "$ROOTFS/etc/fstab"
echo "$ROOTDEV / $ROOTFSTYPE relatime 1 1" >> "$ROOTFS/etc/fstab"
# target device at once
if [ -n "$BOOTPART" ]; then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment