Skip to content

Instantly share code, notes, and snippets.

@jedahan
Last active December 11, 2015 00:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jedahan/4516147 to your computer and use it in GitHub Desktop.
Save jedahan/4516147 to your computer and use it in GitHub Desktop.
#!/bin/sh
VBM=VBoxManage
VMNAME="smartos2"
VBDIR=$($VBM list systemproperties | awk '/^Default.machine.folder/ { print $4 }')
DISK=1024 # MB
RAM=512 # MB
VRAM=128 # MB
mkdir -p "${VBDIR}/${VMNAME}" && cd $_
[[ -f ${VMNAME}.iso ]] || curl -C - -o "${VMNAME}.iso" https://download.joyent.com/pub/iso/latest.iso
MD5=$(curl -C - https://download.joyent.com/pub/iso/md5sums.txt | awk '/latest.iso$/ { print $1}')
[ "${MD5}" != $(md5sum ${VMNAME.iso}) ] && echo "ERROR: md5 checksums do not match" && exit 1
$VBM createvm --name $VMNAME --ostype OpenSolaris_64 --register
$VBM modifyvm $VMNAME --pae off --boot1 dvd --boot2 disk --boot3 none --memory $RAM --vram $VRAM --clipboard disabled --nic1 hostonly --nictype1 82540EM
$VBM createhd --filename "$VMNAME-zones.vdi" --size $DISK
$VBM storagectl $VMNAME --name "SATA Controller" --add sata --controller IntelAHCI
$VBM storagectl $VMNAME --name "IDE Controller" --add ide
$VBM storageattach $VMNAME --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium ${VMNAME}-zones.vdi
$VBM storageattach $VMNAME --storagectl "IDE Controller" --port 1 --device 0 --type dvddrive --medium ${VMNAME}.iso --mtype readonly
VirtualBox --startvm $VMNAME &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment