commit e2876ea69f31cfd150cf7577e30fb1953de53159
parent 580fecb67cbf6c6a94113f492c9927ceb2b50e9c
Author: parazyd <parazyd@dyne.org>
Date: Wed, 13 Jan 2021 18:59:16 +0100
Use UUID for fstab in virtual machine builds.
This solves issues when booting virtio-type drives.
Diffstat:
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/zlibs/helpers b/zlibs/helpers
@@ -81,13 +81,13 @@ build_vm_dist()
notice "Building complete VM image(s)"
bootstrap_complete_base || { zerr; return 1; }
- vm_inject_overrides || { zerr; return 1; }
blend_preinst || { zerr; return 1; }
image_prepare_raw || { zerr; return 1; }
image_connect_raw || { zerr; return 1; }
image_partition_${parted_type} || { zerr; return 1; }
image_format_partitions || { zerr; return 1; }
image_mount || { zerr; return 1; }
+ vm_inject_overrides || { zerr; return 1; }
strapdir_to_image || { zerr; return 1; }
vm_setup_grub || { zerr; return 1; }
blend_postinst || { zerr; return 1; }
diff --git a/zlibs/vm b/zlibs/vm
@@ -21,13 +21,17 @@ vars+=(vmname)
vm_inject_overrides()
{
fn vm_inject_overrides
- req=(strapdir bootfs)
+ req=(strapdir bootfs rootfs bootpart rootpart)
ckreq || return 1
notice "Injecting rootfs overrides"
+ bootuuid="$(lsblk "$bootpart" -no UUID)"
+ rootuuid="$(lsblk "$rootpart" -no UUID)"
+
cat <<EOF | sudo tee -a "$strapdir/etc/fstab" >/dev/null
-/dev/sda1 /boot ${bootfs} defaults 0 1
+UUID=${rootuuid} / ${rootfs} defaults 0 1
+UUID=${bootuuid} /boot ${bootfs} defaults 0 1
EOF
cat <<EOF | sudo tee "$strapdir/etc/rc.local" >/dev/null