08adf5eb10
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. MFC after: 3 days Sponsored by: The FreeBSD Foundation
95 lines
3.9 KiB
Makefile
95 lines
3.9 KiB
Makefile
#
|
|
# $FreeBSD$
|
|
#
|
|
#
|
|
# Makefile for uploading Vagrant boxes to Hashicorp Atlas
|
|
#
|
|
|
|
VAGRANT_IMG?= ${.OBJDIR}/vagrant.vmdk
|
|
VAGRANT_UPLOAD_TGTS= vagrant-check-depends \
|
|
atlas-do-upload
|
|
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
|
|
.endif
|
|
|
|
VAGRANT_VERSION?= ${REVISION}-${BRANCH}${SNAPSHOT_DATE}
|
|
|
|
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
|
|
. 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
|
|
|
|
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}
|
|
|
|
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
|