Add support for multiple 9p directories.

This commit is contained in:
Tom Alexander 2025-12-07 10:32:56 -05:00
parent 32d276c467
commit c23a99bd41
Signed by: talexander
GPG Key ID: 36C99E8B3C39D85F

View File

@ -284,7 +284,9 @@ function start_body {
protect -d -i -p "$$"
fi
local entry parsed_item
local additional_args=()
local next_pcie_slot=10
if [ "$NETWORK" = "NAT" ]; then
assert_bridge "$host_interface_name" "$bridge_name" "$ip_range"
@ -307,7 +309,17 @@ function start_body {
fi
if [ -n "$BIND9P" ]; then
additional_args+=("-s" "28,virtio-9p,bind9p=${BIND9P}")
if [[ "$BIND9P" = *":"* ]]; then
IFS=':' read -ra entry <<<"$BIND9P"
for item in "${entry[@]}"; do
IFS='=' read -ra parsed_item <<<"$item"
additional_args+=("-s" "${next_pcie_slot},virtio-9p,${parsed_item[0]}=${parsed_item[1]}")
next_pcie_slot=$((next_pcie_slot+1))
done
else
additional_args+=("-s" "${next_pcie_slot},virtio-9p,bind9p=${BIND9P}")
next_pcie_slot=$((next_pcie_slot+1))
fi
fi
@ -321,7 +333,8 @@ function start_body {
additional_args+=("-s" "5,ahci-cd,$mount_cd")
fi
if [ "$VNC_ENABLE" = "YES" ]; then
additional_args+=("-s" "29,fbuf,tcp=$VNC_LISTEN,w=$VNC_WIDTH,h=$VNC_HEIGHT")
additional_args+=("-s" "${next_pcie_slot},fbuf,tcp=$VNC_LISTEN,w=$VNC_WIDTH,h=$VNC_HEIGHT")
next_pcie_slot=$((next_pcie_slot+1))
fi
vms+=("$name")
while true; do
@ -340,8 +353,8 @@ function start_body {
-o 'rtc.use_localtime=false'
-s "0,hostbridge"
-s "4,nvme,/dev/zvol/${zfs_path}/disk0"
-s "30,xhci,tablet"
-s "31,lpc" -l "com1,stdio"
-s "${next_pcie_slot},xhci,tablet"
-s "$((next_pcie_slot+1)),lpc" -l "com1,stdio"
-l "bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd,${mount_path}/BHYVE_UEFI_VARS.fd"
"${additional_args[@]}"
"$name"