aboutsummaryrefslogtreecommitdiff
path: root/release/Makefile.vagrant
diff options
context:
space:
mode:
authorBrad Davis <brd@FreeBSD.org>2015-07-20 16:27:44 +0000
committerBrad Davis <brd@FreeBSD.org>2015-07-20 16:27:44 +0000
commita54bd5953b805b99146f5167a2294639667d860c (patch)
tree0e36c8ac0f7b55d3d666781fa28290d61f27800e /release/Makefile.vagrant
parent5a5c6e994c6c6bbfe71f0a96374d6036617887b7 (diff)
downloadsrc-a54bd5953b805b99146f5167a2294639667d860c.tar.gz
src-a54bd5953b805b99146f5167a2294639667d860c.zip
Add support for building VirtualBox Vagrant images.
Abstract the build, package and upload to handle building either type. Approved by: re (gjb)
Notes
Notes: svn path=/head/; revision=285722
Diffstat (limited to 'release/Makefile.vagrant')
-rw-r--r--release/Makefile.vagrant128
1 files changed, 78 insertions, 50 deletions
diff --git a/release/Makefile.vagrant b/release/Makefile.vagrant
index 307e21f72745..7ae64849e0ce 100644
--- a/release/Makefile.vagrant
+++ b/release/Makefile.vagrant
@@ -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_TARGET:= ${OSRELEASE}${SNAPSHOT_DATE}.box
-VAGRANT_PROVIDERS?= vmware_desktop
-#VAGRANT_PROVIDERS+= virtualbox
+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-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
+.for PROVIDER in ${VAGRANT_PROVIDERS}
+CLEANFILES+= vagrant-do-package-${PROVIDER} ${VAGRANT_TARGET}.${PROVIDER}.box
+CLEANDIRS+= ${PROVIDER}
+VAGRANT_UPLOAD_TGTS+= vagrant-do-upload-${PROVIDER}
-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}
+${PROVIDER}:
+ @mkdir -p ${PROVIDER}
-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
+${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-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
+vagrant-create-vmware-metadata: vmware/vagrant.vmx