Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Jun 2015 04:39:34 +0000 (UTC)
From:      Glen Barber <gjb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r284661 - stable/10/release
Message-ID:  <201506210439.t5L4dY3O091055@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gjb
Date: Sun Jun 21 04:39:34 2015
New Revision: 284661
URL: https://svnweb.freebsd.org/changeset/base/284661

Log:
  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

Added:
  stable/10/release/Makefile.azure
     - copied unchanged from r284567, head/release/Makefile.azure
Modified:
  stable/10/release/Makefile.vm
Directory Properties:
  stable/10/   (props changed)

Copied: stable/10/release/Makefile.azure (from r284567, head/release/Makefile.azure)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/10/release/Makefile.azure	Sun Jun 21 04:39:34 2015	(r284661, copy of r284567, head/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}
+

Modified: stable/10/release/Makefile.vm
==============================================================================
--- stable/10/release/Makefile.vm	Sun Jun 21 04:34:57 2015	(r284660)
+++ stable/10/release/Makefile.vm	Sun Jun 21 04:39:34 2015	(r284661)
@@ -154,3 +154,4 @@ cloudware-install:
 .endif
 
 .include "${.CURDIR}/Makefile.ec2"
+.include "${.CURDIR}/Makefile.azure"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201506210439.t5L4dY3O091055>