--- /dev/null
+#! /bin/sh
+
+if [ $# -le 1 -o $# -ge 7 ]; then
+ echo "Usage: $0 vm_name iso_file [os_type [disk_size [memory [video_mem]]]]" >&2
+ echo "Example: $0 Debian debian.iso Debian 10000 512" >&2
+ exit 1
+fi
+
+VM_NAME="$1"
+ISO_IMAGE="$2"
+VM_OS_TYPE="${3:-Linux}"
+DISK_SIZE="${4:-1024}"
+VM_MEM="${5:-1024}"
+VM_VMEM="${6:-128}"
+
+VBoxManage createvm --name "$VM_NAME" --ostype "$VM_OS_TYPE" --register &&
+VBoxManage modifyvm "$VM_NAME" --memory "$VM_MEM" --vram "$VM_VMEM" --ioapic on &&
+
+VBoxManage createhd --filename "$HOME/VirtualBox VMs/$VM_NAME/$VM_NAME".vdi --size "$DISK_SIZE" --format VDI &&
+VBoxManage storagectl "$VM_NAME" --name "SATA Controller" --add sata --controller IntelAhci --bootable on &&
+VBoxManage storageattach "$VM_NAME" --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium "$HOME/VirtualBox VMs/$VM_NAME/$VM_NAME".vdi &&
+
+VBoxManage storagectl "$VM_NAME" --name "IDE Controller" --add ide --controller PIIX4 &&
+VBoxManage storageattach "$VM_NAME" --storagectl "IDE Controller" --port 1 --device 0 --type dvddrive --medium "$ISO_IMAGE" &&
+VBoxManage modifyvm "$VM_NAME" --boot1 dvd --boot2 disk --boot3 none --boot4 none &&
+
+VBoxManage modifyvm "$VM_NAME" --nic1 nat &&
+VBoxManage modifyvm "$VM_NAME" --natpf1 SSH,tcp,localhost,2022,localhost,22 &&
+
+#VBoxManage showvminfo "$VM_NAME" &&
+exec VBoxManage startvm "$VM_NAME"
--- /dev/null
+#! /bin/sh
+
+if [ -z "$1" ]; then
+ echo "Usage: $0 vm_name" >&2
+ exit 1
+fi
+
+VM_NAME="$1"
+exec VBoxManage unregistervm "$VM_NAME" --delete
--- /dev/null
+#! /bin/sh
+
+if [ -z "$1" ]; then
+ echo "Usage: $0 vm_name" >&2
+ exit 1
+fi
+
+VM_NAME="$1"
+exec VBoxManage storageattach "$VM_NAME" --storagectl "IDE Controller" --port 1 --device 0 --type dvddrive --medium none
--- /dev/null
+#!/bin/sh
+
+if [ -z "$1" ]; then
+ echo "Usage: $0 version" >&2
+ exit 1
+fi
+
+cd "$HOME/VirtualBox VMs" && \
+ww "http://download.virtualbox.org/virtualbox/$1/VBoxGuestAdditions_$1.iso" \
+ "http://download.virtualbox.org/virtualbox/$1/Oracle_VM_VirtualBox_Extension_Pack-$1.vbox-extpack" &&
+
+exec sudo VBoxManage extpack install --replace \
+ "Oracle_VM_VirtualBox_Extension_Pack-$1.vbox-extpack"
--- /dev/null
+#! /bin/sh
+
+if lsmod | grep -Fq kvm; then
+ if ! sudo rmmod kvm_intel kvm; then
+ echo "Kvm modules cannot be removed, abort" 1>&2
+ exit 1
+ fi
+fi
+
+if ! lsmod | grep -Fq vboxdrv; then
+ if ! sudo modprobe vboxdrv; then
+ sudo /etc/init.d/vboxdrv setup
+ fi
+fi
+
+if ! lsmod | grep -Fq vboxdrv; then
+ echo "vboxdrv not found, abort" 1>&2
+ exit 1
+fi
+
+if [ -n "$1" ]; then
+ exec VBoxManage startvm "$@"
+else
+ exec VirtualBox
+fi
--- /dev/null
+#! /bin/sh
+
+if [ -z "$1" ]; then
+ echo "Usage: $0 vm_name [poweroff]" >&2
+ exit 1
+fi
+
+VM_NAME="$1"
+exec VBoxManage controlvm "$VM_NAME" ${2:-acpipowerbutton}