Created
December 31, 2014 01:06
-
-
Save splbio/84bd4d2122782e99fc5c 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
#!/bin/sh | |
# Make freebsd vm | |
# fetch ftp://ftp.freebsd.org/pub/FreeBSD/releases/VM-IMAGES/10.1-RELEASE/amd64/Latest/FreeBSD-10.1-RELEASE-amd64.raw.xz | |
VM="FreeBSD10" | |
RAW_IMG="$1" | |
BASE_IMG="${RAW_IMG%.raw}" | |
VMDK_IMG="${BASE_IMG}.vmdk" | |
OSTYPE="FreeBSD_64" | |
OVA_IMG="${VM}.ova" | |
set -e | |
if VBoxManage list vms | sed -e 's/^"//' -e 's/".*//g' | grep "^${VM}\$" ; then | |
echo "VM '$VM' already exists. delete? (y/N)" | |
read resp | |
if [ "$resp" = "y" -o "$resp" = "Y" ] ; then | |
VBoxManage unregistervm "$VM" --delete | |
fi | |
fi | |
set -x | |
rm -f "${VMDK_IMG}" "${OVA_IMG}" | |
# storage controller | |
STORAGE_CONTROLLER_NAME="IDE Controller" | |
VBoxManage convertfromraw "${RAW_IMG}" "${VMDK_IMG}" --format VMDK | |
VBoxManage createvm --name "$VM" --ostype "${OSTYPE}" --register | |
#VBoxManage storagectl "$VM" --name "SATA Controller" --add sata --controller IntelAHCI | |
VBoxManage storagectl "$VM" --name "${STORAGE_CONTROLLER_NAME}" --add ide --controller PIIX4 | |
VBoxManage storageattach "$VM" --storagectl "${STORAGE_CONTROLLER_NAME}" \ | |
--port 0 --device 0 --type hdd --medium "${VMDK_IMG}" | |
VBoxManage modifyvm "$VM" --ioapic on --boot1 disk --memory 768 --vram 12 | |
# XXX: NAT instead? | |
VBoxManage modifyvm "$VM" --nic1 nat | |
VBoxManage modifyvm "$VM" --macaddress1 auto | |
VBoxManage modifyvm "$VM" --pae off | |
VBoxManage export "$VM" -o "${VM}.ova" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This script will create a virtualbox usable .ova file for use with FreeBSD.
Otherwise users have to set many options as detailed here:
http://blog.kidicarus.cool/blog/2014/12/24/freebsd-guest-on-mac-osx-host-via-virtualbox/
Suggest adding this to the release process.