labs: add option for VM gui type

This changeset adds an environment variable and an option that can be
used to change the type of VirtualBox VM GUI used while building the
nodes.

Valid values are gui (default), sdl (minimal gui), and headless.

The resulting node VMs can then be started with or without GUI as
before.

Change-Id: If12f4ba6dc455972b6332318ed1261e2c9de8c3f
This commit is contained in:
Roger Luethi 2014-08-24 20:27:29 +02:00
parent f210af6952
commit 82689fcae3
2 changed files with 17 additions and 2 deletions

View File

@ -698,7 +698,11 @@ function vbox_boot {
local VM=$1
echo >&2 "Starting VM \"$VM\""
$VBM startvm "$VM"
if [ -n "${VM_UI:-}" ]; then
$VBM startvm "$VM" --type "$VM_UI"
else
$VBM startvm "$VM"
fi
}
#-------------------------------------------------------------------------------

View File

@ -56,11 +56,13 @@ function print_config {
${OSBASH:+:} echo "no"
echo "VM access method: $VM_ACCESS"
echo "GUI type: ${VM_UI:-gui}"
fi
}
while getopts :e:fhnw opt; do
while getopts :e:fg:hnw opt; do
case $opt in
e)
if [ "$OPTARG" = ova ]; then
@ -77,6 +79,15 @@ while getopts :e:fhnw opt; do
wbatch_reset
unset OSBASH
;;
g)
if [[ "$OPTARG" =~ (headless|gui|sdl) ]]; then
VM_UI=$OPTARG
else
echo "Error: -g argument must be gui (default), sdl, or" \
"headless"
exit
fi
;;
h)
usage
;;