aboutsummaryrefslogtreecommitdiff
path: root/vbox
diff options
context:
space:
mode:
Diffstat (limited to 'vbox')
-rwxr-xr-xvbox39
1 files changed, 39 insertions, 0 deletions
diff --git a/vbox b/vbox
new file mode 100755
index 0000000..42dd8af
--- /dev/null
+++ b/vbox
@@ -0,0 +1,39 @@
+#!/bin/bash
+#
+# Simple wrapper around VBoxManage.
+#
+
+# Parameters
+BASENAME="`basename $0`"
+COMMAND="$1"
+VM="$2"
+
+# Usage
+function usage {
+ echo "usage: $BASENAME <command> [vm]"
+ exit 1
+}
+
+# Build options
+if [ ! -z "$VM" ]; then
+ if [ "$COMMAND" == "up" ]; then
+ OPTIONS=""
+ COMMAND="startvm"
+ elif [ "$COMMAND" == "down" ]; then
+ OPTIONS="savestate"
+ COMMAND="controlvm"
+ elif [ "$COMMAND" == "halt" ]; then
+ OPTIONS="poweroff"
+ COMMAND="controlvm"
+ else
+ usage
+ fi
+elif [ "$COMMAND" == "status" ]; then
+ OPTIONS="runningvms"
+ COMMAND="list"
+else
+ usage
+fi
+
+# Dispatch
+VBoxManage $COMMAND $VM $OPTIONS