Last active
September 13, 2019 11:24
-
-
Save sierra-tango-echo/fd81027ed13f14e7607eaab142d791f5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NAME=metalcontroller1 | |
RAWIMAGE=/Users/steve/iso/metalcontroller-1309191016_generic-cloudinit.raw | |
EXTERNALBRIDGEADAPTER=en0 | |
CONSOLE=1 | |
NIC2=1 | |
ISO=/Users/steve/iso/metalcontroller_userdata.iso | |
VMPATH=/tmp/stevevm/${NAME}/ | |
mkdir -p $VMPATH | |
VBoxManage convertdd ${RAWIMAGE} ${VMPATH}/disk.vdi --format VDI | |
VBoxManage createvm --name ${NAME} --ostype RedHat_64 --register --basefolder $VMPATH | |
VBoxManage modifyvm ${NAME} --cpus 2 --memory 4096 --vrde on --vrdeport 5001 | |
VBoxManage modifyvm ${NAME} --nic1 bridged --bridgeadapter1 ${EXTERNALBRIDGEADAPTER} | |
if [ "${NIC2}" -gt 0 ]; then | |
VBoxManage modifyvm ${NAME} --nic2 intnet | |
fi | |
if [ "${CONSOLE}" -gt 0 ]; then | |
VBoxManage modifyvm ${NAME} --uart1 0x3F8 4 --uartmode1 server $VMPATH/${NAME}pipe | |
fi | |
VBoxManage storagectl ${NAME} --name "SATA" --add sata --portcount 2 | |
VBoxManage modifymedium disk $VMPATH/disk.vdi --resize 16000 | |
VBoxManage storageattach ${NAME} --storagectl SATA --port 1 --type hdd --medium $VMPATH/disk.vdi | |
if ! [ -z $ISO ]; then | |
VBoxManage storageattach ${NAME} --storagectl SATA --port 0 --type dvddrive --medium $ISO | |
fi | |
VBoxManage startvm ${NAME} --type headless | |
echo "VM started - connect to console with minicom -D unix#/$VMPATH/${NAME}pipe" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment