#!/bin/bash ls /root/ &>/dev/null || echo 'Please run as root' ls /root/ &>/dev/null || exit -1 VM='so-vm-win7' umount /dev/sda2 2>/dev/null mkdir -p /media/student/vm mount /dev/sda2 /media/student/vm rm -fr /root/VirtualBox\ VMs/ rm -fr /media/student/vm/$VM tar -C /media/student/vm -xzf /media/student/vm/$VM.tar.gz cd /media/student/vm/$VM/ vboxmanage unregistervm $VM 2>/dev/null vboxmanage createvm --name $VM --ostype "Windows7" --register vboxmanage storagectl $VM --name "IDE Controller" --add ide vboxmanage storageattach $VM --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium $VM.vmdk #vboxmanage storagectl $VM --name "IDE Controller" --add ide #vboxmanage storageattach $VM --storagectl "IDE Controller" --port 1 --device 0 --type hdd --medium $VM-hdd1.vmdk #vboxmanage storageattach $VM --storagectl "IDE Controller" --port 1 --device 1 --type hdd --medium $VM-hdd2.vmdk vboxmanage modifyvm $VM --memory 1024 --vram 64 vboxmanage startvm $VM