#!/bin/bash if [ $# -ne 6 ]; then echo "" echo "Usage:" echo "$0 FLAVOUR MACHINE_NAME MEMORY TYPE_OS DISK_SIZE DVD_PATH" echo "" exit 0 fi FLAOUR=$1 NAME=$2 MEMORY=$3 TYPE=$4 DISK_SIZE=$5 DVD=$6 PATH_VDI="/home/kbut/maquinas_virtual/" if [ "$TYPE" = "64" ]; then AUX_TYPE_OS="Ubuntu_64" else AUX_TYPE_OS="Ubuntu" fi VBoxManage createvm --name $NAME --register VBoxManage modifyvm $NAME --memory $MEMORY --acpi on --boot1 dvd if [ "$FLAOUR" = "server" ]; then VBoxManage modifyvm $NAME --nic1 intnet --intnet1 internalnetwork VBoxManage modifyvm $NAME --nic2 bridged --bridgeadapter1 eth0 elif [ "$FLAOUR" = "client" ]; then VBoxManage modifyvm $NAME --nic1 intnet --intnet1 internalnetwork else VBoxManage modifyvm $NAME --nic1 bridged --bridgeadapter1 eth0 fi VBoxManage modifyvm $NAME --ostype $AUX_TYPE_OS VBoxManage createhd --filename $PATH_VDI/$NAME.vdi --size $DISK_SIZE #VBoxManage storagectl $NAME --name "IDE Controller" --add ide VBoxManage storagectl $NAME --name "SATA Controller" --add sata VBoxManage storageattach $NAME --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium $PATH_VDI/$NAME.vdi if [ "$FLAOUR" = "server" ]; then VBoxManage createhd --filename $PATH_VDI/${NAME}_net.vdi --size $DISK_SIZE VBoxManage storageattach $NAME --storagectl "SATA Controller" --port 2 --device 0 --type hdd --medium $PATH_VDI/${NAME}_net.vdi fi #VBoxManage storageattach $NAME --storagectl "IDE Controller" --port 1 --device 0 --type dvddrive --medium $DVD VBoxManage storageattach $NAME --storagectl "SATA Controller" --port 1 --device 0 --type dvddrive --medium $DVD VBoxManage modifyvm $NAME --audio pulse