diff options
author | gjb <gjb@FreeBSD.org> | 2015-06-21 04:39:34 +0000 |
---|---|---|
committer | gjb <gjb@FreeBSD.org> | 2015-06-21 04:39:34 +0000 |
commit | 964ee5e924b5e0ab8fa3866fa26b2c4f8642d656 (patch) | |
tree | 0f47ceb7ee5d1e08844a0493b1555282cc488151 | |
parent | 93e43c433dd31d17afecc5a78db42aec66e02b95 (diff) | |
download | FreeBSD-src-964ee5e924b5e0ab8fa3866fa26b2c4f8642d656.zip FreeBSD-src-964ee5e924b5e0ab8fa3866fa26b2c4f8642d656.tar.gz |
MFC r284567:
Add Makefile.azure, used to upload VHD images to the
Microsoft Azure environment, similar to the EC2 AMIs.
Sponsored by: The FreeBSD Foundation
-rw-r--r-- | release/Makefile.azure | 53 | ||||
-rw-r--r-- | release/Makefile.vm | 1 |
2 files changed, 54 insertions, 0 deletions
diff --git a/release/Makefile.azure b/release/Makefile.azure new file mode 100644 index 0000000..01e2204 --- /dev/null +++ b/release/Makefile.azure @@ -0,0 +1,53 @@ +# +# $FreeBSD$ +# +# +# Makefile for uploading Microsoft Azure disk images. +# + +AZURE_IMG?= ${.OBJDIR}/azure.vhdf +AZURE_UPLOAD_TGTS= azure-check-depends \ + azure-do-upload +CLEANFILES+= ${AZURE_UPLOAD_TGTS} + +.if defined(AZURE_UPLOAD_CONF) && !empty(AZURE_UPLOAD_CONF) +. for VAR in _STORAGE _ACCOUNT _KEY +AZURE${VAR}!= grep -E ^AZURE${VAR} ${AZURE_UPLOAD_CONF} | awk -F' ' '{print $$2}' +. endfor +.endif + +.if ${BRANCH} == "STABLE" || ${BRANCH} == "CURRENT" +SNAPSHOT_DATE!= date +-%Y-%m-%d +.endif + +AZURE_TARGET:= ${OSRELEASE}${SNAPSHOT_DATE}.vhd + +azure-upload: ${AZURE_UPLOAD_TGTS} + +azure-check-depends: +.for VAR in _STORAGE _ACCOUNT _KEY +. if !defined(AZURE${VAR}) || empty(AZURE${VAR}) + @echo "Variable AZURE${VAR} cannot be empty." + @false +. endif +.endfor +.if !exists(/usr/local/bin/azure) +. if !exists(/usr/local/bin/npm) +. if !exists(${PORTSDIR}/www/npm/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 www/npm +. else + make -C ${PORTSDIR}/www/npm BATCH=1 all install clean +. endif +. endif + npm install -g azure-cli +.endif + +azure-do-upload: + /usr/local/bin/azure storage blob upload \ + ${AZURE_IMG} ${AZURE_STORAGE} ${AZURE_TARGET} \ + -t page -a ${AZURE_ACCOUNT} -k "${AZURE_KEY}" + touch ${.OBJDIR}/${.TARGET} + diff --git a/release/Makefile.vm b/release/Makefile.vm index a2dc14d..68fb2f3 100644 --- a/release/Makefile.vm +++ b/release/Makefile.vm @@ -154,3 +154,4 @@ cloudware-install: .endif .include "${.CURDIR}/Makefile.ec2" +.include "${.CURDIR}/Makefile.azure" |