freebsd-src/release/Makefile.vagrant

125 lines
5.1 KiB
Makefile
Raw Normal View History

MFC r284893, r284895-r284897, r284942, r284968, r284996, r285005: r284893 (brd): Add initial support for building Vagrant images for VMWare. Next steps will be adding Virtualbox support and uploading to Hashicorp Atlas for others to consume. r284895: Add default VAGRANT_IMG variable. r284896: Remove _ACCOUNT and add _USERNAME, _NAME, _VERSION for the VAGRANT_${VAR} variables extracted from VAGRANT_UPLOAD_CONF. Set ATLAS_${VAR} to VAGRANT_${VAR} if VAGRANT_UPLOAD_CONF is set. There is intent to intentionally have separate variants of configuration entries, but the defaults do not yet have any reason to be different. r284897: Instead of hard-coding the PROVIDERS for upload, add the VAGRANT_PROVIDERS variable. Right now, it defaults to only vmware_desktop, virtualbox support is to follow at some point. While here, fix the hashicorp URL: s/vagrant/atlas/, which was result of a sed(1) replace (and my fault). r284942 (brd): Add Support for uploading Vagrant images to Hashicorp Atlas. r284968: Default the VAGRANT_VERSION to ${REVISION}-${BRANCH} if not set, which expands to '11.0-CURRENT', for example. If the branch is -CURRENT, -STABLE, or -PRERELEASE, suffix the VAGRANT_VERSION with the snapshot date. r284996: Fix the gcloud port/package name. r285005: Remove the HH-MM suffix from the build date suffix. It was useful when working out several kinks when testing automated image uploading when retrying was necessary, but now it is making things much too messy. Sponsored by: The FreeBSD Foundation
2015-07-02 17:17:05 +01:00
#
# $FreeBSD$
#
#
# Makefile for uploading Vagrant boxes to Hashicorp Atlas
#
VAGRANT_IMG?= ${.OBJDIR}/vagrant.vmdk
VAGRANT_UPLOAD_TGTS= vagrant-check-depends
MFC r284893, r284895-r284897, r284942, r284968, r284996, r285005: r284893 (brd): Add initial support for building Vagrant images for VMWare. Next steps will be adding Virtualbox support and uploading to Hashicorp Atlas for others to consume. r284895: Add default VAGRANT_IMG variable. r284896: Remove _ACCOUNT and add _USERNAME, _NAME, _VERSION for the VAGRANT_${VAR} variables extracted from VAGRANT_UPLOAD_CONF. Set ATLAS_${VAR} to VAGRANT_${VAR} if VAGRANT_UPLOAD_CONF is set. There is intent to intentionally have separate variants of configuration entries, but the defaults do not yet have any reason to be different. r284897: Instead of hard-coding the PROVIDERS for upload, add the VAGRANT_PROVIDERS variable. Right now, it defaults to only vmware_desktop, virtualbox support is to follow at some point. While here, fix the hashicorp URL: s/vagrant/atlas/, which was result of a sed(1) replace (and my fault). r284942 (brd): Add Support for uploading Vagrant images to Hashicorp Atlas. r284968: Default the VAGRANT_VERSION to ${REVISION}-${BRANCH} if not set, which expands to '11.0-CURRENT', for example. If the branch is -CURRENT, -STABLE, or -PRERELEASE, suffix the VAGRANT_VERSION with the snapshot date. r284996: Fix the gcloud port/package name. r285005: Remove the HH-MM suffix from the build date suffix. It was useful when working out several kinks when testing automated image uploading when retrying was necessary, but now it is making things much too messy. Sponsored by: The FreeBSD Foundation
2015-07-02 17:17:05 +01:00
CLEANFILES+= ${VAGRANT_UPLOAD_TGTS}
.if defined(VAGRANT_UPLOAD_CONF) && !empty(VAGRANT_UPLOAD_CONF)
. for VAR in _KEY _USERNAME
VAGRANT${VAR}!= grep -E ^VAGRANT${VAR} ${VAGRANT_UPLOAD_CONF} | awk -F' ' '{print $$2}'
ATLAS${VAR}:= ${VAGRANT${VAR}}
. endfor
.endif
.if ${BRANCH} == "STABLE" || ${BRANCH} == "CURRENT" || ${BRANCH} == "PRERELEASE"
SNAPSHOT_DATE!= date +-%Y%m%d
MFC r284893, r284895-r284897, r284942, r284968, r284996, r285005: r284893 (brd): Add initial support for building Vagrant images for VMWare. Next steps will be adding Virtualbox support and uploading to Hashicorp Atlas for others to consume. r284895: Add default VAGRANT_IMG variable. r284896: Remove _ACCOUNT and add _USERNAME, _NAME, _VERSION for the VAGRANT_${VAR} variables extracted from VAGRANT_UPLOAD_CONF. Set ATLAS_${VAR} to VAGRANT_${VAR} if VAGRANT_UPLOAD_CONF is set. There is intent to intentionally have separate variants of configuration entries, but the defaults do not yet have any reason to be different. r284897: Instead of hard-coding the PROVIDERS for upload, add the VAGRANT_PROVIDERS variable. Right now, it defaults to only vmware_desktop, virtualbox support is to follow at some point. While here, fix the hashicorp URL: s/vagrant/atlas/, which was result of a sed(1) replace (and my fault). r284942 (brd): Add Support for uploading Vagrant images to Hashicorp Atlas. r284968: Default the VAGRANT_VERSION to ${REVISION}-${BRANCH} if not set, which expands to '11.0-CURRENT', for example. If the branch is -CURRENT, -STABLE, or -PRERELEASE, suffix the VAGRANT_VERSION with the snapshot date. r284996: Fix the gcloud port/package name. r285005: Remove the HH-MM suffix from the build date suffix. It was useful when working out several kinks when testing automated image uploading when retrying was necessary, but now it is making things much too messy. Sponsored by: The FreeBSD Foundation
2015-07-02 17:17:05 +01:00
.endif
VAGRANT_VERSION!= date +%Y.%m.%d
VAGRANT_TARGET:= ${OSRELEASE}${SNAPSHOT_DATE}
.if !empty(CLOUDWARE)
. for _PROVIDER in ${CLOUDWARE}
_provider= ${_PROVIDER}
. if ${_provider:MVAGRANT*}
VAGRANT_PROVIDERS+= ${_PROVIDER:S/VAGRANT-//:tl}
. endif
. endfor
.endif
VAGRANT_PROVIDERS?= vmware virtualbox
MFC r284893, r284895-r284897, r284942, r284968, r284996, r285005: r284893 (brd): Add initial support for building Vagrant images for VMWare. Next steps will be adding Virtualbox support and uploading to Hashicorp Atlas for others to consume. r284895: Add default VAGRANT_IMG variable. r284896: Remove _ACCOUNT and add _USERNAME, _NAME, _VERSION for the VAGRANT_${VAR} variables extracted from VAGRANT_UPLOAD_CONF. Set ATLAS_${VAR} to VAGRANT_${VAR} if VAGRANT_UPLOAD_CONF is set. There is intent to intentionally have separate variants of configuration entries, but the defaults do not yet have any reason to be different. r284897: Instead of hard-coding the PROVIDERS for upload, add the VAGRANT_PROVIDERS variable. Right now, it defaults to only vmware_desktop, virtualbox support is to follow at some point. While here, fix the hashicorp URL: s/vagrant/atlas/, which was result of a sed(1) replace (and my fault). r284942 (brd): Add Support for uploading Vagrant images to Hashicorp Atlas. r284968: Default the VAGRANT_VERSION to ${REVISION}-${BRANCH} if not set, which expands to '11.0-CURRENT', for example. If the branch is -CURRENT, -STABLE, or -PRERELEASE, suffix the VAGRANT_VERSION with the snapshot date. r284996: Fix the gcloud port/package name. r285005: Remove the HH-MM suffix from the build date suffix. It was useful when working out several kinks when testing automated image uploading when retrying was necessary, but now it is making things much too messy. Sponsored by: The FreeBSD Foundation
2015-07-02 17:17:05 +01:00
vagrant-check-depends:
.for VAR in _KEY _USERNAME _VERSION
. if !defined(VAGRANT${VAR}) || empty(VAGRANT${VAR})
@echo "Variable VAGRANT${VAR} cannot be empty."
@false
. endif
.endfor
.if !exists(/usr/local/bin/curl)
. if !exists(${PORTSDIR}/ftp/curl/Makefile)
. if !exists(/usr/local/sbin/pkg-static)
env ASSUME_ALWAYS_YES=yes pkg bootstrap -yf
. endif
env ASSUME_ALWAYS_YES=yes pkg install -y curl
. else
make -C ${PORTSDIR}/ftp/curl BATCH=1 all install clean
. endif
.endif
.for PROVIDER in ${VAGRANT_PROVIDERS}
_provider= ${PROVIDER}
CLEANFILES+= vagrant-do-package-${PROVIDER} ${VAGRANT_TARGET}.${PROVIDER}.box
CLEANDIRS+= ${PROVIDER}
VAGRANT_UPLOAD_TGTS+= vagrant-do-upload-${PROVIDER}
MFC r284893, r284895-r284897, r284942, r284968, r284996, r285005: r284893 (brd): Add initial support for building Vagrant images for VMWare. Next steps will be adding Virtualbox support and uploading to Hashicorp Atlas for others to consume. r284895: Add default VAGRANT_IMG variable. r284896: Remove _ACCOUNT and add _USERNAME, _NAME, _VERSION for the VAGRANT_${VAR} variables extracted from VAGRANT_UPLOAD_CONF. Set ATLAS_${VAR} to VAGRANT_${VAR} if VAGRANT_UPLOAD_CONF is set. There is intent to intentionally have separate variants of configuration entries, but the defaults do not yet have any reason to be different. r284897: Instead of hard-coding the PROVIDERS for upload, add the VAGRANT_PROVIDERS variable. Right now, it defaults to only vmware_desktop, virtualbox support is to follow at some point. While here, fix the hashicorp URL: s/vagrant/atlas/, which was result of a sed(1) replace (and my fault). r284942 (brd): Add Support for uploading Vagrant images to Hashicorp Atlas. r284968: Default the VAGRANT_VERSION to ${REVISION}-${BRANCH} if not set, which expands to '11.0-CURRENT', for example. If the branch is -CURRENT, -STABLE, or -PRERELEASE, suffix the VAGRANT_VERSION with the snapshot date. r284996: Fix the gcloud port/package name. r285005: Remove the HH-MM suffix from the build date suffix. It was useful when working out several kinks when testing automated image uploading when retrying was necessary, but now it is making things much too messy. Sponsored by: The FreeBSD Foundation
2015-07-02 17:17:05 +01:00
${PROVIDER}:
@mkdir -p ${PROVIDER}
MFC r284893, r284895-r284897, r284942, r284968, r284996, r285005: r284893 (brd): Add initial support for building Vagrant images for VMWare. Next steps will be adding Virtualbox support and uploading to Hashicorp Atlas for others to consume. r284895: Add default VAGRANT_IMG variable. r284896: Remove _ACCOUNT and add _USERNAME, _NAME, _VERSION for the VAGRANT_${VAR} variables extracted from VAGRANT_UPLOAD_CONF. Set ATLAS_${VAR} to VAGRANT_${VAR} if VAGRANT_UPLOAD_CONF is set. There is intent to intentionally have separate variants of configuration entries, but the defaults do not yet have any reason to be different. r284897: Instead of hard-coding the PROVIDERS for upload, add the VAGRANT_PROVIDERS variable. Right now, it defaults to only vmware_desktop, virtualbox support is to follow at some point. While here, fix the hashicorp URL: s/vagrant/atlas/, which was result of a sed(1) replace (and my fault). r284942 (brd): Add Support for uploading Vagrant images to Hashicorp Atlas. r284968: Default the VAGRANT_VERSION to ${REVISION}-${BRANCH} if not set, which expands to '11.0-CURRENT', for example. If the branch is -CURRENT, -STABLE, or -PRERELEASE, suffix the VAGRANT_VERSION with the snapshot date. r284996: Fix the gcloud port/package name. r285005: Remove the HH-MM suffix from the build date suffix. It was useful when working out several kinks when testing automated image uploading when retrying was necessary, but now it is making things much too messy. Sponsored by: The FreeBSD Foundation
2015-07-02 17:17:05 +01:00
${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
MFC r284893, r284895-r284897, r284942, r284968, r284996, r285005: r284893 (brd): Add initial support for building Vagrant images for VMWare. Next steps will be adding Virtualbox support and uploading to Hashicorp Atlas for others to consume. r284895: Add default VAGRANT_IMG variable. r284896: Remove _ACCOUNT and add _USERNAME, _NAME, _VERSION for the VAGRANT_${VAR} variables extracted from VAGRANT_UPLOAD_CONF. Set ATLAS_${VAR} to VAGRANT_${VAR} if VAGRANT_UPLOAD_CONF is set. There is intent to intentionally have separate variants of configuration entries, but the defaults do not yet have any reason to be different. r284897: Instead of hard-coding the PROVIDERS for upload, add the VAGRANT_PROVIDERS variable. Right now, it defaults to only vmware_desktop, virtualbox support is to follow at some point. While here, fix the hashicorp URL: s/vagrant/atlas/, which was result of a sed(1) replace (and my fault). r284942 (brd): Add Support for uploading Vagrant images to Hashicorp Atlas. r284968: Default the VAGRANT_VERSION to ${REVISION}-${BRANCH} if not set, which expands to '11.0-CURRENT', for example. If the branch is -CURRENT, -STABLE, or -PRERELEASE, suffix the VAGRANT_VERSION with the snapshot date. r284996: Fix the gcloud port/package name. r285005: Remove the HH-MM suffix from the build date suffix. It was useful when working out several kinks when testing automated image uploading when retrying was necessary, but now it is making things much too messy. Sponsored by: The FreeBSD Foundation
2015-07-02 17:17:05 +01:00
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)
MFC r284893, r284895-r284897, r284942, r284968, r284996, r285005: r284893 (brd): Add initial support for building Vagrant images for VMWare. Next steps will be adding Virtualbox support and uploading to Hashicorp Atlas for others to consume. r284895: Add default VAGRANT_IMG variable. r284896: Remove _ACCOUNT and add _USERNAME, _NAME, _VERSION for the VAGRANT_${VAR} variables extracted from VAGRANT_UPLOAD_CONF. Set ATLAS_${VAR} to VAGRANT_${VAR} if VAGRANT_UPLOAD_CONF is set. There is intent to intentionally have separate variants of configuration entries, but the defaults do not yet have any reason to be different. r284897: Instead of hard-coding the PROVIDERS for upload, add the VAGRANT_PROVIDERS variable. Right now, it defaults to only vmware_desktop, virtualbox support is to follow at some point. While here, fix the hashicorp URL: s/vagrant/atlas/, which was result of a sed(1) replace (and my fault). r284942 (brd): Add Support for uploading Vagrant images to Hashicorp Atlas. r284968: Default the VAGRANT_VERSION to ${REVISION}-${BRANCH} if not set, which expands to '11.0-CURRENT', for example. If the branch is -CURRENT, -STABLE, or -PRERELEASE, suffix the VAGRANT_VERSION with the snapshot date. r284996: Fix the gcloud port/package name. r285005: Remove the HH-MM suffix from the build date suffix. It was useful when working out several kinks when testing automated image uploading when retrying was necessary, but now it is making things much too messy. Sponsored by: The FreeBSD Foundation
2015-07-02 17:17:05 +01:00
vagrant-create-vmware-metadata: vmware/vagrant.vmx