Use UUID for fstab in virtual machine builds.

This solves issues when booting virtio-type drives.
This commit is contained in:
parazyd 2021-01-13 18:59:16 +01:00
parent 580fecb67c
commit e2876ea69f
No known key found for this signature in database
GPG Key ID: 6B636BF0493EE747
2 changed files with 7 additions and 3 deletions

@ -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; }

@ -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