Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

vbox: remove ancient vbox control script

  • Loading branch information...
commit 17ff53a365ff62d266058389f3a6acc070f9f2af 1 parent d83cbdc
@falconindy authored
Showing with 0 additions and 88 deletions.
  1. +0 −88 vbox
View
88 vbox
@@ -1,88 +0,0 @@
-#! /bin/bash
-
-vbox_host=WinXP
-remote_host=localhost
-remote_port=3390
-
-vms=($(VBoxManage list vms | sed -n 's|\"\([[:alnum:]\-_]*\)\" {[0-9a-f\-]*}|\1|p'))
-
-in_array() {
- local needle=$1; shift
- for item in "$@"; do
- [[ $item == $needle ]] && echo "$item" && return 0
- done
-
- return 1;
-}
-
-usage() {
- echo "USAGE: vbox <start|stop|connect> <vm name>"
- echo
- echo "Host: $vbox_host @ $remote_host:$remote_port"
- echo "Status: $(VBoxManage showvminfo $vbox_host | grep State | cut -d" " -f12-)"
-
- exit 1
-} >&2
-
-list_vms() {
- echo "Valid VMs:"
- echo
- for vm in ${vms[@]}; do
- echo $vm
- done
-}
-
-start_vm() {
- if ! pgrep VBoxHeadless; then
- exec VBoxHeadless -startvm "$1" &
- else
- echo "ERROR: VBox '$1' is running."
- exit 1
- fi
-}
-
-stop_vm() {
- if ! pgrep VBoxHeadless; then
- echo "ERROR: VBox '$1' is not running."
- exit 1
- else
- exec VBoxManage controlvm "$1" poweroff
- fi
-}
-
-connect_vm() {
- if ! type -p rdesktop; then
- echo "rdesktop not found. connect functionality unavailable" >&2
- exit 1
- fi
-
- read -s -p "[vbox] password for $(id -nu): " PASSWORD
-
- if ! pgrep VBoxHeadless; then
- VBoxHeadless -startvm "$1" &
- sleep 5
- fi
- exec rdesktop -p"$PASSWORD" $remote_host:$remote_port
- exit 0
-}
-
-[[ $# -lt 2 ]] && usage
-
-action=$1; shift
-
-oldcasematch=$(shopt -p nocasematch);
-shopt -s nocasematch
-vm=$(in_array $1 "${vms[@]}")
-[[ -z $vm ]] && { list_vms && exit 1; }
-$oldcasematch
-
-case "$action" in
- 'start')
- start_vm "$vm" ;;
- 'stop')
- stop_vm "$vm" ;;
- 'connect')
- connect_vm "$vm" ;;
- *)
- usage ;;
-esac
Please sign in to comment.
Something went wrong with that request. Please try again.