1
0
mirror of https://github.com/rancher/os.git synced 2025-06-21 20:47:04 +00:00
os/scripts/build-vbox-vm

47 lines
1.4 KiB
Plaintext
Raw Normal View History

#!/bin/bash
2015-03-09 09:56:22 +00:00
set -x -e
2015-03-09 09:56:22 +00:00
## DOC: create a RancherOS VM for VirtualBox
## the VM uses 2 network interfaces: eth0 (NAT) is for Internet access
## eth1 (host-only) is for internal virtual network
## NOTE: host-only NIC `vboxnet1` should already exist!
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}"
2015-03-09 09:56:22 +00:00
VBoxManage createhd --format vmdk --filename ./dist/artifacts/$VM.vmdk --size 40000
VBoxManage createvm --name $VM --ostype "Linux_64" --register
2015-03-09 09:56:22 +00:00
VBoxManage storagectl $VM --name "SATA" --add sata
VBoxManage storageattach $VM --storagectl "SATA" --port 0 --type hdd --medium ./dist/artifacts/$VM.vmdk
VBoxManage storageattach $VM --storagectl "SATA" --port 1 --type dvddrive --medium ${RANCHER_ISO}
2015-03-09 09:56:22 +00:00
VBoxManage modifyvm $VM --memory 1024 --acpi on --boot1 disk --boot2 dvd
VBoxManage modifyvm $VM --rtcuseutc on
VBoxManage modifyvm $VM --usb off
VBoxManage modifyvm $VM --audio none
2015-03-09 09:56:22 +00:00
VBoxManage modifyvm $VM --nic1 nat
VBoxManage modifyvm $VM --nictype1 virtio
VBoxManage modifyvm $VM --nic2 hostonly
VBoxManage modifyvm $VM --nictype2 virtio
VBoxManage modifyvm $VM --hostonlyadapter2 vboxnet1
#VBoxManage startvm $VM