24 lines
707 B
Bash
Executable file
24 lines
707 B
Bash
Executable file
#!/usr/bin/bash
|
|
#
|
|
# Start a netboot VM
|
|
#
|
|
set -eu
|
|
|
|
if [[ $# -eq 0 ]] ; then
|
|
arg="--memory 4096 --vcpu 4"
|
|
fi
|
|
|
|
# find macvtap interface MAC address:
|
|
MAC="$(ip link | grep -A1 "vm-macvtap" | \
|
|
sed -nE "s%\s+link/ether ([[:xdigit:]:]{17}) .+%\1%p")"
|
|
|
|
XDG_CONFIG_HOME="/tmp/${UID}/.config" \
|
|
exec virt-install \
|
|
--name bookworm \
|
|
--osinfo debiantesting \
|
|
--nodisks --import \
|
|
--pxe --boot loader=/usr/share/OVMF/OVMF_CODE_4M.fd,\
|
|
loader.readonly=yes,loader.type=pflash,\
|
|
nvram.template=/usr/share/OVMF/OVMF_VARS_4M.fd \
|
|
--network type=ethernet,mac=${MAC},\
|
|
target.dev=vm-macvtap,xpath1.set=./target/@managed=no $@ ${arg:-}
|