#!/bin/bash ## # Add a virtual machine # # wildcat - 2009 ## if [ $# -lt 6 ]; then echo "$0 [if2]"; exit 42; fi echo -n "Register vm name..." VBoxManage createvm -register -name ${1} > /dev/null 2>&1 echo "done" echo -n "Creating virtual disk of ${2}..." VBoxManage createvdi -size ${2} -filename ${1}.vdi -register > /dev/null 2>&1 echo "done" echo -n "Changing setting for virtual machine ${1}.." VBoxManage modifyvm ${1} -name ${1} -memory ${3} -acpi on -hda ${1}.vdi -dvd "${4}" -hostifdev1 $6 -nic1 hostif -vrdp on -vrdpport $5 > /dev/null 2>&1 echo "done" if [ $# -eq 7 ]; then echo -n "Setting second interface to use ${7}..." VBoxManage modifyvm ${1} -hostifdev2 $7 -nic2 hostif > /dev/null 2>&1 echo "done" fi echo -n "Setting boot device order..." VBoxManage modifyvm ${1} -boot1 dvd -boot2 disk > /dev/null 2>&1 VBoxManage modifyvm ${1} --hwvirtex on --vtxvpid on > /dev/null 2>&1 echo "done" echo -n "Enabling hardware virt...." VBoxManage modifyvm ${1} --vtxvpid on --pae on --hwvirtex on > /dev/null 2>&1 echo "done";