From 04718fa6d013ec3abc014c25690356660d7f0a9b Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Mon, 14 Jul 2025 15:44:33 -0500 Subject: [PATCH] newvm: Avoid adding graphics adapter by default VMs don't really need graphical consoles; serial terminals are good enough, or even better given that they are logged. For the few cases where a graphical console is actually necessary, the `newvm.sh` script can add one with the `--graphics` argument. --- newvm.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/newvm.sh b/newvm.sh index 4e63e7a..7150d7e 100755 --- a/newvm.sh +++ b/newvm.sh @@ -12,6 +12,7 @@ network=network=kube dnsdomain=host.pyrocufflink.black console=true default_groups=true +graphics=false usage() { printf 'usage: %s [options] name\n' "${0##*/}" @@ -76,6 +77,9 @@ while [ $# -gt 0 ]; do --domain=*) dnsdomain=${1#=*} ;; + --with-graphics) + graphics=true + ;; --cfg-branch) shift cfg_branch=$1 @@ -105,6 +109,7 @@ while [ $# -gt 0 ]; do name="$1" else usage >&2 + printf 'unknown option: %s\n' "${1}" >&2 exit 2 fi esac @@ -183,6 +188,10 @@ if [ -n "${cfg_branch}" ]; then set -- "$@" --qemu-commandline="-fw_cfg opt/dch/cfg-branch,string=${cfg_branch}" fi +if ! $graphics; then + set -- "$@" --graphics=none +fi + if $console; then set -- "$@" --autoconsole text else