From d8ab1e08037e3e30207c185b83ddcd3352277a33 Mon Sep 17 00:00:00 2001 From: Bill Maxwell Date: Fri, 20 Feb 2015 14:54:07 -0700 Subject: [PATCH] Builds a VirtualBox VM that boots the new ISO and attaches a drive --- scripts/build-vbox-vm | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 scripts/build-vbox-vm diff --git a/scripts/build-vbox-vm b/scripts/build-vbox-vm new file mode 100755 index 00000000..bd508b38 --- /dev/null +++ b/scripts/build-vbox-vm @@ -0,0 +1,35 @@ +#!/bin/bash + +set -e + +cd $(dirname $0)/.. +: RANCHER_ISO=${RANCHER_ISO:="./dist/artifacts/rancheros.iso"} + +if [[ -z $RANCHER_ISO ]]; then + echo "Need an ISO..." 1>&2 + exit 1 +fi + +if [ ! -e ${RANCHER_ISO} ]; then + echo "Could not find ISO ${RANCHER_ISO}..." 1>&2 + echo "have you run build.sh yet?" 1>&2 + exit 1 +fi + +GITSHA=$(git rev-parse --short HEAD) +VM="RancherOS-${GITSHA}" + +VBoxManage createhd --format vhd --filename ./dist/artifacts/$VM.vhd --size 8000 + +VBoxManage createvm --name $VM --ostype "Linux_64" --register + +VBoxManage storagectl $VM --name "IDE Controller" --add ide +VBoxManage storageattach $VM --storagectl "IDE Controller" --port 0 --device 0 \ + --type hdd --medium ./dist/artifacts/$VM.vhd +VBoxManage storageattach $VM --storagectl "IDE Controller" --port 1 \ + --device 0 --type dvddrive --medium ${RANCHER_ISO} + +VBoxManage modifyvm $VM --memory 1024 --acpi on --boot1 dvd --boot2 disk +VBoxManage modifyvm $VM --usb off +VBoxManage modifyvm $VM --audio none +VBoxManage startvm $VM