commit f44797a1514c12e59521865b49dd536725d479b1
parent 2d18c45f95e4e4435f91eeba14d7b9704368b07f
Author: Alex Balgavy <alex@balgavy.eu>
Date: Mon, 8 Mar 2021 14:50:41 +0100
vbox: open the GUI for a headless machine
Diffstat:
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/scripts/vbox b/scripts/vbox
@@ -15,6 +15,11 @@ stop() {
VBoxManage controlvm "$1" acpipowerbutton
}
+open() {
+ [ $# -eq 1 ] || die "Only one argument: VM name"
+ VBoxManage startvm "$1" --type separate
+}
+
pause() {
[ $# -eq 1 ] || die "Only one argument: VM name"
VBoxManage controlvm "$1" pause
@@ -89,6 +94,7 @@ while (( "$#" )); do
echo "Usage:"
echo "start vmname start a VM"
echo "stop vmname stop a VM"
+ echo "open vmname open a VM, starting it if necessary"
echo "list, ls ls VMs"
echo "running list running VMs"
echo "share /local/path vmname /mount/point share a local folder"
@@ -128,6 +134,10 @@ case "$1" in
shift;
stop "$@";
;;
+ "open")
+ shift;
+ open "$@";
+ ;;
"ls"|"list")
ls;
;;
diff --git a/shell/zsh-completions-mine/_vbox b/shell/zsh-completions-mine/_vbox
@@ -9,6 +9,7 @@ _vbox() {
arguments=(
'start:start a VM'
'stop:stop a VM'
+ 'open:open a VM, starting it if necessary'
'pause:pause a VM'
'suspend:suspend a VM'
'resume:resume a paused VM'
@@ -42,7 +43,7 @@ _vbox() {
':hostpath:_files -/' \
:machine:_vboxmachines
;;
- start|stop|status|info|shared|pause|suspend|resume)
+ start|stop|open|status|info|shared|pause|suspend|resume)
_arguments \
:machine:_vboxmachines
;;