From 82689fcae3515d55c2c8d7b5c0123b755135290d Mon Sep 17 00:00:00 2001 From: Roger Luethi Date: Sun, 24 Aug 2014 20:27:29 +0200 Subject: [PATCH] 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 --- labs/lib/osbash/virtualbox.functions | 6 +++++- labs/osbash.sh | 13 ++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/labs/lib/osbash/virtualbox.functions b/labs/lib/osbash/virtualbox.functions index d27967c9..3b2714be 100644 --- a/labs/lib/osbash/virtualbox.functions +++ b/labs/lib/osbash/virtualbox.functions @@ -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 } #------------------------------------------------------------------------------- diff --git a/labs/osbash.sh b/labs/osbash.sh index 9420a539..3f9144e1 100755 --- a/labs/osbash.sh +++ b/labs/osbash.sh @@ -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 ;;