newvm: Allow setting cfgpol branch

The script that runs on first boot of a new machine that triggers
host provisioning can read the name of the configuration policy branch
to checkout from the QEMU firmware configuration option.  This commit
adds a `--cfg-branch` argument to `newvm.sh` that sets that value.  This
will be useful for testing new policy on a new VM.
unifi-restore
Dustin 2025-02-08 15:32:52 -06:00
parent 4d30798f54
commit e7de5142f3
1 changed files with 11 additions and 0 deletions

View File

@ -75,6 +75,13 @@ while [ $# -gt 0 ]; do
--domain=*) --domain=*)
dnsdomain=${1#=*} dnsdomain=${1#=*}
;; ;;
--cfg-branch)
shift
cfg_branch=$1
;;
--cfg-branch=*)
cfg_branch=${1#*=}
;;
--group) --group)
shift shift
groups_xml="${groups_xml}<group name=\"${1}\"/>" groups_xml="${groups_xml}<group name=\"${1}\"/>"
@ -163,6 +170,10 @@ set -- \
--boot uefi \ --boot uefi \
"$@" "$@"
if [ -n "${cfg_branch}" ]; then
set -- "$@" --qemu-commandline="-fw_cfg opt/dch/cfg-branch,string=${cfg_branch}"
fi
if $console; then if $console; then
set -- "$@" --autoconsole text set -- "$@" --autoconsole text
else else