]> gitweb.fluxo.info Git - vbox.git/commitdiff
Initial import
authorSilvio Rhatto <rhatto@riseup.net>
Thu, 18 Sep 2014 19:38:37 +0000 (16:38 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Thu, 18 Sep 2014 19:46:56 +0000 (16:46 -0300)
README.md [new file with mode: 0644]
TODO.md [new file with mode: 0644]
vbox [new file with mode: 0755]

diff --git a/README.md b/README.md
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/TODO.md b/TODO.md
new file mode 100644 (file)
index 0000000..d3493fd
--- /dev/null
+++ b/TODO.md
@@ -0,0 +1,7 @@
+TODO
+====
+
+* Support more VBoxManage commands.
+* Iteration over a set of VMs.
+* Support for upgrading VMs.
+* Vagrant integration.
diff --git a/vbox b/vbox
new file mode 100755 (executable)
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