From f752200b5413b20ec17ae82fe378a32825792b47 Mon Sep 17 00:00:00 2001 From: Anthony Perkins Date: Tue, 6 Sep 2022 16:02:09 +0100 Subject: [PATCH] Check for firmware, and stop connecting com1 twice --- roles/home-cli/files/bhyve-vm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/roles/home-cli/files/bhyve-vm b/roles/home-cli/files/bhyve-vm index 38f6a45..c477138 100755 --- a/roles/home-cli/files/bhyve-vm +++ b/roles/home-cli/files/bhyve-vm @@ -45,9 +45,17 @@ vnc="localhost:0" # Change to /dev/nmdm0A for the first null-modem. comoutput=stdio -# Comment the next line out for no CD-ROM. +# Comment the next line out for no CD-ROM. cdrom="-s 3,ahci-cd,$vmpath/cdrom.iso" +################################################################################ + +# Check for firmware. +if ! [ -e /usr/local/share/uefi-firmware/BHYVE_UEFI.fd ]; then + echo "Firmware not found. Try \`pkg install bhyve-firmware\`." >&2 + exit 1 +fi + # Finally, run the bhyve command with all of these variables. /usr/sbin/bhyve \ -c sockets=1,cores=$cpucores,threads=1 \ @@ -60,7 +68,7 @@ cdrom="-s 3,ahci-cd,$vmpath/cdrom.iso" ${cdrom:-""} \ -s 29,fbuf,tcp=${vnc},w=1024,h=768 \ -s 30,xhci,tablet \ - -s 31,lpc -l com1,stdio \ + -s 31,lpc \ -l com1,$comoutput \ -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \ $vmname