tar2vm: use UUID, prepare for virtio as well
Forward-port of b84182c5cb684afbd30ed1f9e5b6f89f55b4b53f commit extended to handle /boot as well.
This commit is contained in:
parent
b0df203272
commit
e177121ddf
16
bin/tar2fs
16
bin/tar2fs
@ -167,6 +167,20 @@ if [ -n "$BOOTPART" ]; then
|
|||||||
mkfs."$BOOTFSTYPE" "$LOOPBOOT"
|
mkfs."$BOOTFSTYPE" "$LOOPBOOT"
|
||||||
fi
|
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
|
# mount and populate it
|
||||||
mkdir -pm755 "$ROOTFS"
|
mkdir -pm755 "$ROOTFS"
|
||||||
mount "$LOOPROOT" "$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
|
for i in /dev /proc /sys; do mount --bind "$i" "$ROOTFS$i"; done
|
||||||
|
|
||||||
# loop device so lilo could work...
|
# 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
|
# target device at once
|
||||||
if [ -n "$BOOTPART" ]; then
|
if [ -n "$BOOTPART" ]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user