Add support for building VirtualBox Vagrant images.

Abstract the build, package and upload to handle building either type.

Approved by:	re (gjb)
This commit is contained in:
brd 2015-07-20 16:27:44 +00:00
parent 317b3132ab
commit 8f7cde25f2
7 changed files with 364 additions and 68 deletions

View File

@ -6,8 +6,7 @@
#
VAGRANT_IMG?= ${.OBJDIR}/vagrant.vmdk
VAGRANT_UPLOAD_TGTS= vagrant-check-depends \
atlas-do-upload
VAGRANT_UPLOAD_TGTS= vagrant-check-depends
CLEANFILES+= ${VAGRANT_UPLOAD_TGTS}
.if defined(VAGRANT_UPLOAD_CONF) && !empty(VAGRANT_UPLOAD_CONF)
@ -18,16 +17,20 @@ ATLAS${VAR}:= ${VAGRANT${VAR}}
.endif
.if ${BRANCH} == "STABLE" || ${BRANCH} == "CURRENT" || ${BRANCH} == "PRERELEASE"
SNAPSHOT_DATE!= date +-%Y-%m-%d
SNAPSHOT_DATE!= date +%Y%m%d
.endif
VAGRANT_VERSION?= ${REVISION}-${BRANCH}${SNAPSHOT_DATE}
VAGRANT_VERSION!= date +%Y.%m.%d
VAGRANT_TARGET:= ${OSRELEASE}-${SNAPSHOT_DATE}
.if !empty(CLOUDWARE)
. for _PROVIDER in ${CLOUDWARE}
. if ${_PROVIDER:MVAGRANT*}
VAGRANT_PROVIDERS+= ${_PROVIDER:S/VAGRANT-//:tl}
. endif
. endfor
.endif
VAGRANT_PROVIDERS?= vmware virtualbox
VAGRANT_TARGET:= ${OSRELEASE}${SNAPSHOT_DATE}.box
VAGRANT_PROVIDERS?= vmware_desktop
#VAGRANT_PROVIDERS+= virtualbox
vagrant-upload: ${VAGRANT_UPLOAD_TGTS}
vagrant-check-depends:
.for VAR in _KEY _USERNAME _VERSION
@ -47,48 +50,73 @@ vagrant-check-depends:
. endif
.endif
vagrant-do-package: cw-vagrant
vagrant-do-package-vmware: vagrant-create-vmware-vmx vagrant-do-package
@cd ${.OBJDIR} && echo '{"provider":"vmware_desktop"}' > metadata.json
cd ${.OBJDIR} && tar -czf ${VAGRANT_TARGET} metadata.json vagrant.vmx vagrant.vmdk
touch ${.OBJDIR}/${.TARGET}
atlas-do-upload: vagrant-do-package-vmware
.for PROVIDER in ${VAGRANT_PROVIDERS}
${.CURDIR}/scripts/atlas-upload.sh -b FreeBSD-${REVISION}-${BRANCH} -f ${VAGRANT_TARGET} -p ${PROVIDER} -k ${VAGRANT_KEY} -u ${VAGRANT_USERNAME} -v ${VAGRANT_VERSION}
.endfor
touch ${.OBJDIR}/${.TARGET}
CLEANFILES+= vagrant-do-package-${PROVIDER} ${VAGRANT_TARGET}.${PROVIDER}.box
CLEANDIRS+= ${PROVIDER}
VAGRANT_UPLOAD_TGTS+= vagrant-do-upload-${PROVIDER}
vagrant-create-vmware-vmx:
@cd ${.OBJDIR} && echo '.encoding = "UTF-8"' > vagrant.vmx
@cd ${.OBJDIR} && echo 'bios.bootorder = "hdd,CDROM"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'checkpoint.vmstate = ""' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'cleanshutdown = "TRUE"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'config.version = "8"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'displayname = "${VAGRANT_TARGET}"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'ethernet0.addresstype = "generated"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'ethernet0.bsdname = "en0"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'ethernet0.connectiontype = "nat"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'ethernet0.displayname = "Ethernet"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'ethernet0.linkstatepropagation.enable = "FALSE"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'ethernet0.pcislotnumber = "33"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'ethernet0.present = "TRUE"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'ethernet0.virtualdev = "e1000"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'ethernet0.wakeonpcktrcv = "FALSE"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'floppy0.present = "FALSE"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'guestos = "freebsd-64"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'gui.fullscreenatpoweron = "FALSE"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'gui.viewmodeatpoweron = "windowed"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'memsize = "512"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'sound.startconnected = "FALSE"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'softpoweroff = "TRUE"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'scsi0.pcislotnumber = "16"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'scsi0.present = "TRUE"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'scsi0.virtualdev = "lsilogic"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'scsi0:0.filename = "vagrant.vmdk"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'scsi0:0.present = "TRUE"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'tools.synctime = "TRUE"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'usb.present = "FALSE"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'virtualhw.productcompatibility = "hosted"' >> vagrant.vmx
@cd ${.OBJDIR} && echo 'virtualhw.version = "9"' >> vagrant.vmx
${PROVIDER}:
@mkdir -p ${PROVIDER}
${VAGRANT_TARGET}.${PROVIDER}.box: ${PROVIDER} cw-vagrant-${PROVIDER} vagrant-create-${PROVIDER}-metadata
@echo "==> PACKAGING: ${VAGRANT_TARGET}.${PROVIDER}.box in `pwd`"
@cp vagrant-${PROVIDER}.vmdk ${PROVIDER}/vagrant.vmdk
. if ${PROVIDER} == "virtualbox"
@(cd ${.OBJDIR}/${PROVIDER} && echo '{"provider":"${PROVIDER}"}' > metadata.json)
@(cd ${.OBJDIR}/${PROVIDER} && tar -czf ../${VAGRANT_TARGET}.${PROVIDER}.box metadata.json box.ovf vagrant.vmdk)
. elif ${PROVIDER} == "vmware"
@(cd ${.OBJDIR}/${PROVIDER} && echo '{"provider":"${PROVIDER}_desktop"}' > metadata.json)
@(cd ${.OBJDIR}/${PROVIDER} && tar -czf ../${VAGRANT_TARGET}.${PROVIDER}.box metadata.json vagrant.vmx vagrant.vmdk)
. endif
CLEANFILES+= vagrant-do-upload-${PROVIDER}
vagrant-do-upload-${PROVIDER}: ${VAGRANT_TARGET}.${PROVIDER}.box
. if ${PROVIDER} == "virtualbox"
${.CURDIR}/scripts/atlas-upload.sh -b ${TYPE}-${REVISION}-${BRANCH} -f ${VAGRANT_TARGET}.${PROVIDER}.box -p ${PROVIDER} -k ${VAGRANT_KEY} -u ${VAGRANT_USERNAME} -v ${VAGRANT_VERSION}
. elif ${PROVIDER} == "vmware"
${.CURDIR}/scripts/atlas-upload.sh -b ${TYPE}-${REVISION}-${BRANCH} -f ${VAGRANT_TARGET}.${PROVIDER}.box -p ${PROVIDER}_desktop -k ${VAGRANT_KEY} -u ${VAGRANT_USERNAME} -v ${VAGRANT_VERSION}
. endif
touch ${.OBJDIR}/${.TARGET}
.endfor
vagrant-upload: ${VAGRANT_UPLOAD_TGTS}
vagrant-create-virtualbox-metadata: virtualbox/box.ovf
virtualbox/box.ovf: ${.CURDIR}/scripts/box.ovf
cp ${.ALLSRC} virtualbox/
vmware/vagrant.vmx:
@(cd vmware && echo '.encoding = "UTF-8"' > vagrant.vmx)
@(cd vmware && echo 'bios.bootorder = "hdd,CDROM"' >> vagrant.vmx)
@(cd vmware && echo 'checkpoint.vmstate = ""' >> vagrant.vmx)
@(cd vmware && echo 'cleanshutdown = "TRUE"' >> vagrant.vmx)
@(cd vmware && echo 'config.version = "8"' >> vagrant.vmx)
@(cd vmware && echo 'displayname = "${VAGRANT_TARGET}"' >> vagrant.vmx)
@(cd vmware && echo 'ethernet0.addresstype = "generated"' >> vagrant.vmx)
@(cd vmware && echo 'ethernet0.bsdname = "en0"' >> vagrant.vmx)
@(cd vmware && echo 'ethernet0.connectiontype = "nat"' >> vagrant.vmx)
@(cd vmware && echo 'ethernet0.displayname = "Ethernet"' >> vagrant.vmx)
@(cd vmware && echo 'ethernet0.linkstatepropagation.enable = "FALSE"' >> vagrant.vmx)
@(cd vmware && echo 'ethernet0.pcislotnumber = "33"' >> vagrant.vmx)
@(cd vmware && echo 'ethernet0.present = "TRUE"' >> vagrant.vmx)
@(cd vmware && echo 'ethernet0.virtualdev = "e1000"' >> vagrant.vmx)
@(cd vmware && echo 'ethernet0.wakeonpcktrcv = "FALSE"' >> vagrant.vmx)
@(cd vmware && echo 'floppy0.present = "FALSE"' >> vagrant.vmx)
@(cd vmware && echo 'guestos = "freebsd-64"' >> vagrant.vmx)
@(cd vmware && echo 'gui.fullscreenatpoweron = "FALSE"' >> vagrant.vmx)
@(cd vmware && echo 'gui.viewmodeatpoweron = "windowed"' >> vagrant.vmx)
@(cd vmware && echo 'memsize = "512"' >> vagrant.vmx)
@(cd vmware && echo 'sound.startconnected = "FALSE"' >> vagrant.vmx)
@(cd vmware && echo 'softpoweroff = "TRUE"' >> vagrant.vmx)
@(cd vmware && echo 'scsi0.pcislotnumber = "16"' >> vagrant.vmx)
@(cd vmware && echo 'scsi0.present = "TRUE"' >> vagrant.vmx)
@(cd vmware && echo 'scsi0.virtualdev = "lsilogic"' >> vagrant.vmx)
@(cd vmware && echo 'scsi0:0.filename = "vagrant.vmdk"' >> vagrant.vmx)
@(cd vmware && echo 'scsi0:0.present = "TRUE"' >> vagrant.vmx)
@(cd vmware && echo 'tools.synctime = "TRUE"' >> vagrant.vmx)
@(cd vmware && echo 'usb.present = "FALSE"' >> vagrant.vmx)
@(cd vmware && echo 'virtualhw.productcompatibility = "hosted"' >> vagrant.vmx)
@(cd vmware && echo 'virtualhw.version = "9"' >> vagrant.vmx)
vagrant-create-vmware-metadata: vmware/vagrant.vmx

View File

@ -19,7 +19,8 @@ CLOUDWARE?= AZURE \
EC2 \
GCE \
OPENSTACK \
VAGRANT
VAGRANT-VIRTUALBOX \
VAGRANT-VMWARE
AZURE_FORMAT= vhdf
AZURE_DESC= Microsoft Azure platform image
AZURE_DISK= ${OSRELEASE}.${AZURE_FORMAT}
@ -32,9 +33,12 @@ GCE_DISK= disk.${GCE_FORMAT}
OPENSTACK_FORMAT=qcow2
OPENSTACK_DESC= OpenStack platform image
OPENSTACK_DISK= ${OSRELEASE}.${OPENSTACK_FORMAT}
VAGRANT_FORMAT= vmdk
VAGRANT_DESC= Vagrant Image
VAGRANT_DISK= ${OSRELEASE}.${VAGRANT_FORMAT}
VAGRANT-VIRTUALBOX_FORMAT= vmdk
VAGRANT-VIRTUALBOX_DESC= Vagrant Image for VirtualBox
VAGRANT-VIRTUALBOX_DISK= ${OSRELEASE}.vbox.${VAGRANT_FORMAT}
VAGRANT-VMWARE_FORMAT= vmdk
VAGRANT-VMWARE_DESC= Vagrant Image for VMWare
VAGRANT-VMWARE_DISK= ${OSRELEASE}.vmware.${VAGRANT_FORMAT}
.if defined(WITH_CLOUDWARE) && !empty(WITH_CLOUDWARE) && !empty(CLOUDWARE)
. for _CW in ${CLOUDWARE}

View File

@ -28,20 +28,23 @@
ATLAS_API_URL=''
ATLAS_UPLOAD_URL='https://binstore.hashicorp.com'
VERSION_DESCRIPTION="FreeBSD Snapshot Build"
DESCRIPTION="FreeBSD Snapshot Build"
usage() {
echo "${0} usage:"
echo "-b box-name -f box-to-upload -k api-key -p provider -u user -v version"
echo "-b box-name -d 'box description' -f box-to-upload -k api-key -p provider -u user -v version"
return 1
}
main () {
while getopts "b:f:k:p:u:v:" arg; do
while getopts "b:d:f:k:p:u:v:" arg; do
case "${arg}" in
b)
BOX="${OPTARG}"
;;
d)
DESCRIPTION="${OPTARG}"
;;
f)
FILE="${OPTARG}"
;;
@ -83,6 +86,7 @@ main () {
echo "Creating box: ${BOX}"
/usr/local/bin/curl -s https://atlas.hashicorp.com/api/v1/boxes -X POST -d "box[name]=${BOX}" -d "access_token=${KEY}" > /dev/null
/usr/local/bin/curl -s https://atlas.hashicorp.com/api/v1/box/${USERNAME}/${BOX} -X PUT -d "box[is_private]=false" -d "access_token=${KEY}" > /dev/null
/usr/local/bin/curl -s https://atlas.hashicorp.com/api/v1/box/${USERNAME}/${BOX} -X PUT -d "box[description]='${DESCRIPTION}'" -d "access_token=${KEY}" > /dev/null
else
echo "Box already exists"
fi
@ -97,7 +101,7 @@ main () {
if [ $? != 0 ]; then
echo "Creating version: ${VERSION}"
/usr/local/bin/curl -s https://atlas.hashicorp.com/api/v1/box/${USERNAME}/${BOX}/versions -X POST -d "version[version]=${VERSION}" -d "access_token=${KEY}" > /dev/null
/usr/local/bin/curl -s https://atlas.hashicorp.com/api/v1/box/${USERNAME}/${BOX}/version/${VERSION} -X PUT -d "version[description]=${VERSION_DESCRIPTION}" -d "access_token=${KEY}" > /dev/null
/usr/local/bin/curl -s https://atlas.hashicorp.com/api/v1/box/${USERNAME}/${BOX}/version/${VERSION} -X PUT -d "version[description]=${DESCRIPTION}" -d "access_token=${KEY}" > /dev/null
VERSIONRESULT=$(/usr/local/bin/curl -s "https://atlas.hashicorp.com/api/v1/box/${USERNAME}/${BOX}/version/${VERSION}?access_token=${KEY}")
echo $VERSIONRESULT | grep "\"version\":\"${VERSION}\"" > /dev/null
if [ $? != 0 ]; then

226
release/scripts/box.ovf Normal file
View File

@ -0,0 +1,226 @@
<?xml version="1.0"?>
<Envelope ovf:version="1.0" xml:lang="en-US" xmlns="http://schemas.dmtf.org/ovf/envelope/1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:vbox="http://www.virtualbox.org/ovf/machine">
<References>
<File ovf:href="vagrant.vmdk" ovf:id="file1"/>
</References>
<DiskSection>
<Info>List of the virtual disks used in the package</Info>
<Disk ovf:capacity="10632560640" ovf:diskId="vmdisk1" ovf:fileRef="file1" ovf:format="http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized" vbox:uuid="e349f8b6-c400-4e7a-9825-598becab2f94"/>
</DiskSection>
<NetworkSection>
<Info>Logical networks used in the package</Info>
<Network ovf:name="NAT">
<Description>Logical network used by this appliance.</Description>
</Network>
</NetworkSection>
<VirtualSystem ovf:id="freebsd">
<Info>A virtual machine</Info>
<OperatingSystemSection ovf:id="78">
<Info>The kind of installed guest operating system</Info>
<Description>FreeBSD_64</Description>
<vbox:OSType ovf:required="false">FreeBSD_64</vbox:OSType>
</OperatingSystemSection>
<VirtualHardwareSection>
<Info>Virtual hardware requirements for a virtual machine</Info>
<System>
<vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
<vssd:InstanceID>0</vssd:InstanceID>
<vssd:VirtualSystemIdentifier>freebsd</vssd:VirtualSystemIdentifier>
<vssd:VirtualSystemType>virtualbox-2.2</vssd:VirtualSystemType>
</System>
<Item>
<rasd:Caption>1 virtual CPU</rasd:Caption>
<rasd:Description>Number of virtual CPUs</rasd:Description>
<rasd:ElementName>1 virtual CPU</rasd:ElementName>
<rasd:InstanceID>1</rasd:InstanceID>
<rasd:ResourceType>3</rasd:ResourceType>
<rasd:VirtualQuantity>1</rasd:VirtualQuantity>
</Item>
<Item>
<rasd:AllocationUnits>MegaBytes</rasd:AllocationUnits>
<rasd:Caption>512 MB of memory</rasd:Caption>
<rasd:Description>Memory Size</rasd:Description>
<rasd:ElementName>512 MB of memory</rasd:ElementName>
<rasd:InstanceID>2</rasd:InstanceID>
<rasd:ResourceType>4</rasd:ResourceType>
<rasd:VirtualQuantity>512</rasd:VirtualQuantity>
</Item>
<Item>
<rasd:Address>0</rasd:Address>
<rasd:Caption>ideController0</rasd:Caption>
<rasd:Description>IDE Controller</rasd:Description>
<rasd:ElementName>ideController0</rasd:ElementName>
<rasd:InstanceID>3</rasd:InstanceID>
<rasd:ResourceSubType>PIIX4</rasd:ResourceSubType>
<rasd:ResourceType>5</rasd:ResourceType>
</Item>
<Item>
<rasd:Address>1</rasd:Address>
<rasd:Caption>ideController1</rasd:Caption>
<rasd:Description>IDE Controller</rasd:Description>
<rasd:ElementName>ideController1</rasd:ElementName>
<rasd:InstanceID>4</rasd:InstanceID>
<rasd:ResourceSubType>PIIX4</rasd:ResourceSubType>
<rasd:ResourceType>5</rasd:ResourceType>
</Item>
<Item>
<rasd:AddressOnParent>0</rasd:AddressOnParent>
<rasd:Caption>disk1</rasd:Caption>
<rasd:Description>Disk Image</rasd:Description>
<rasd:ElementName>disk1</rasd:ElementName>
<rasd:HostResource>/disk/vmdisk1</rasd:HostResource>
<rasd:InstanceID>5</rasd:InstanceID>
<rasd:Parent>3</rasd:Parent>
<rasd:ResourceType>17</rasd:ResourceType>
</Item>
<Item>
<rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
<rasd:Caption>Ethernet adapter on 'NAT'</rasd:Caption>
<rasd:Connection>NAT</rasd:Connection>
<rasd:ElementName>Ethernet adapter on 'NAT'</rasd:ElementName>
<rasd:InstanceID>6</rasd:InstanceID>
<rasd:ResourceSubType>E1000</rasd:ResourceSubType>
<rasd:ResourceType>10</rasd:ResourceType>
</Item>
</VirtualHardwareSection>
<vbox:Machine ovf:required="false" version="1.12-macosx" uuid="{8b837be7-fa96-48fc-b119-e90cfa144456}" name="freebsd" OSType="FreeBSD_64" snapshotFolder="Snapshots" lastStateChange="2014-03-13T13:50:05Z">
<ovf:Info>Complete VirtualBox machine configuration in VirtualBox format</ovf:Info>
<ExtraData>
<ExtraDataItem name="GUI/LastGuestSizeHint" value="720,400"/>
<ExtraDataItem name="GUI/LastNormalWindowPosition" value="400,183,720,421"/>
</ExtraData>
<Hardware version="2">
<CPU count="1" hotplug="false">
<HardwareVirtEx enabled="true"/>
<HardwareVirtExNestedPaging enabled="true"/>
<HardwareVirtExVPID enabled="true"/>
<HardwareVirtExUX enabled="true"/>
<PAE enabled="true"/>
<HardwareVirtExLargePages enabled="true"/>
<HardwareVirtForce enabled="false"/>
</CPU>
<Memory RAMSize="512" PageFusion="false"/>
<HID Pointing="PS2Mouse" Keyboard="PS2Keyboard"/>
<HPET enabled="false"/>
<Chipset type="PIIX3"/>
<Boot>
<Order position="1" device="HardDisk"/>
<Order position="2" device="DVD"/>
<Order position="3" device="None"/>
<Order position="4" device="None"/>
</Boot>
<Display VRAMSize="8" monitorCount="1" accelerate3D="false" accelerate2DVideo="false"/>
<VideoCapture/>
<RemoteDisplay enabled="false" authType="Null"/>
<BIOS>
<ACPI enabled="true"/>
<IOAPIC enabled="true"/>
<Logo fadeIn="true" fadeOut="true" displayTime="0"/>
<BootMenu mode="MessageAndMenu"/>
<TimeOffset value="0"/>
<PXEDebug enabled="false"/>
</BIOS>
<USBController enabled="false" enabledEhci="false"/>
<Network>
<Adapter slot="0" enabled="true" MACAddress="080027D14C66" cable="true" speed="0" type="82540EM">
<DisabledModes/>
<NAT>
<DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
<Alias logging="false" proxy-only="false" use-same-ports="false"/>
</NAT>
</Adapter>
<Adapter slot="1" enabled="false" MACAddress="080027058FF2" cable="true" speed="0" type="82540EM">
<DisabledModes>
<NAT>
<DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
<Alias logging="false" proxy-only="false" use-same-ports="false"/>
</NAT>
</DisabledModes>
</Adapter>
<Adapter slot="2" enabled="false" MACAddress="08002763A181" cable="true" speed="0" type="82540EM">
<DisabledModes>
<NAT>
<DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
<Alias logging="false" proxy-only="false" use-same-ports="false"/>
</NAT>
</DisabledModes>
</Adapter>
<Adapter slot="3" enabled="false" MACAddress="0800279C6D17" cable="true" speed="0" type="82540EM">
<DisabledModes>
<NAT>
<DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
<Alias logging="false" proxy-only="false" use-same-ports="false"/>
</NAT>
</DisabledModes>
</Adapter>
<Adapter slot="4" enabled="false" MACAddress="08002760C885" cable="true" speed="0" type="82540EM">
<DisabledModes>
<NAT>
<DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
<Alias logging="false" proxy-only="false" use-same-ports="false"/>
</NAT>
</DisabledModes>
</Adapter>
<Adapter slot="5" enabled="false" MACAddress="0800279ECE95" cable="true" speed="0" type="82540EM">
<DisabledModes>
<NAT>
<DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
<Alias logging="false" proxy-only="false" use-same-ports="false"/>
</NAT>
</DisabledModes>
</Adapter>
<Adapter slot="6" enabled="false" MACAddress="08002730E8BE" cable="true" speed="0" type="82540EM">
<DisabledModes>
<NAT>
<DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
<Alias logging="false" proxy-only="false" use-same-ports="false"/>
</NAT>
</DisabledModes>
</Adapter>
<Adapter slot="7" enabled="false" MACAddress="080027AD8EF8" cable="true" speed="0" type="82540EM">
<DisabledModes>
<NAT>
<DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
<Alias logging="false" proxy-only="false" use-same-ports="false"/>
</NAT>
</DisabledModes>
</Adapter>
</Network>
<UART>
<Port slot="0" enabled="false" IOBase="0x3f8" IRQ="4" hostMode="Disconnected"/>
<Port slot="1" enabled="false" IOBase="0x2f8" IRQ="3" hostMode="Disconnected"/>
</UART>
<LPT>
<Port slot="0" enabled="false" IOBase="0x378" IRQ="7"/>
<Port slot="1" enabled="false" IOBase="0x378" IRQ="7"/>
</LPT>
<AudioAdapter controller="AC97" driver="CoreAudio" enabled="false"/>
<RTC localOrUTC="local"/>
<SharedFolders/>
<Clipboard mode="Disabled"/>
<DragAndDrop mode="Disabled"/>
<IO>
<IoCache enabled="true" size="5"/>
<BandwidthGroups/>
</IO>
<HostPci>
<Devices/>
</HostPci>
<EmulatedUSB>
<CardReader enabled="false"/>
</EmulatedUSB>
<Guest memoryBalloonSize="0"/>
<GuestProperties>
<GuestProperty name="/VirtualBox/HostInfo/GUI/LanguageID" value="en_US" timestamp="1394718154090069000" flags=""/>
</GuestProperties>
</Hardware>
<StorageControllers>
<StorageController name="IDE Controller" type="PIIX4" PortCount="2" useHostIOCache="true" Bootable="true">
<AttachedDevice type="HardDisk" port="0" device="0">
<Image uuid="{e349f8b6-c400-4e7a-9825-598becab2f94}"/>
</AttachedDevice>
</StorageController>
</StorageControllers>
</vbox:Machine>
</VirtualSystem>
</Envelope>

View File

@ -0,0 +1,18 @@
#!/bin/sh
#
# $FreeBSD$
#
. ${WORLDDIR}/release/tools/vagrant.conf
export VM_EXTRA_PACKAGES="${VM_EXTRA_PACKAGES} virtualbox-ose-additions"
vm_extra_pre_umount () {
# VirtualBox first boot pkgs
echo 'firstboot_pkgs_list="sudo rsync virtualbox-ose-additions"' >> ${DESTDIR}/etc/rc.conf
echo 'vboxguest_enable="YES"' >> ${DESTDIR}/etc/rc.conf
echo 'vboxservice_enable="YES"' >> ${DESTDIR}/etc/rc.conf
# Setup the Vagrant common items
vagrant_common
}

View File

@ -0,0 +1,22 @@
#!/bin/sh
#
# $FreeBSD$
#
. ${WORLDDIR}/release/tools/vagrant.conf
export VM_EXTRA_PACKAGES="${VM_EXTRA_PACKAGES} open-vm-tools-nox11"
vm_extra_pre_umount () {
# VMWare first boot pkgs
echo 'firstboot_pkgs_list="sudo rsync open-vm-tools-nox11"' >> ${DESTDIR}/etc/rc.conf
echo 'vmware_guest_vmblock_enable="YES"' >> ${DESTDIR}/etc/rc.conf
echo 'vmware_guest_vmhgfs_enable="YES"' >> ${DESTDIR}/etc/rc.conf
echo 'vmware_guest_vmmemctl_enable="YES"' >> ${DESTDIR}/etc/rc.conf
echo 'vmware_guest_vmxnet_enable="YES"' >> ${DESTDIR}/etc/rc.conf
echo 'vmware_guestd_enable="YES"' >> ${DESTDIR}/etc/rc.conf
# Setup the Vagrant common items
vagrant_common
}

View File

@ -10,17 +10,14 @@ export VM_EXTRA_PACKAGES="firstboot-freebsd-update firstboot-pkgs"
# Set to a list of third-party software to enable in rc.conf(5).
export VM_RC_LIST="firstboot_freebsd_update firstboot_pkgs"
vm_extra_pre_umount() {
vagrant_common () {
# The firstboot_pkgs rc.d script will download the repository
# catalogue and install or update pkg when the instance first
# launches, so these files would just be replaced anyway; removing
# them from the image allows it to boot faster.
env ASSUME_ALWAYS_YES=yes pkg -c ${DESTDIR} delete -f -y pkg
rm ${DESTDIR}/var/db/pkg/repo-*.sqlite
# The size of the EC2 root disk can be configured at instance launch
# time; expand our filesystem to fill the disk.
echo 'growfs_enable="YES"' >> ${DESTDIR}/etc/rc.conf
env ASSUME_ALWAYS_YES=yes pkg -c ${DESTDIR} clean -y -a
# Vagrant instances use DHCP to get their network configuration.
echo 'ifconfig_DEFAULT="SYNCDHCP"' >> ${DESTDIR}/etc/rc.conf
@ -36,9 +33,6 @@ vm_extra_pre_umount() {
echo 'sendmail_outbound_enable="NO"' >> ${DESTDIR}/etc/rc.conf
echo 'sendmail_msp_queue_enable="NO"' >> ${DESTDIR}/etc/rc.conf
# sudo is required
echo 'firstboot_pkgs_list="sudo rsync"' >> ${DESTDIR}/etc/rc.conf
# Create the vagrant user with a password of vagrant
/usr/sbin/pw -R ${DESTDIR} \
groupadd vagrant -g 1001