Add code for creating an EC2 AMI.

This commit is contained in:
Colin Percival 2015-04-01 00:00:17 +00:00
parent 6f102967c4
commit 73d4ced07c
2 changed files with 46 additions and 0 deletions

44
release/Makefile.ec2 Normal file
View File

@ -0,0 +1,44 @@
#
# $FreeBSD$
#
#
# Makefile for creating an EC2 AMI from a disk image.
#
.if ${BRANCH} == "CURRENT" || ${BRANCH} == "STABLE"
AMINAMESUFFIX!= date +-%Y-%m-%d
.endif
.if defined(EC2PUBLIC)
PUBLISH= --public
.endif
ec2ami: cw-ec2
.if !exists(/usr/local/bin/bsdec2-image-upload)
@echo "--------------------------------------------------------------"
@echo ">>> Creating EC2 AMIs requires bsdec2-image-upload"
@echo "--------------------------------------------------------------"
@false
.endif
.if !defined(AWSKEYFILE) || !exists(${AWSKEYFILE})
@echo "--------------------------------------------------------------"
@echo ">>> AWSKEYFILE must point at AWS keys for EC2 AMI creation"
@echo "--------------------------------------------------------------"
@false
.endif
.if !defined(AWSREGION)
@echo "--------------------------------------------------------------"
@echo ">>> AWSREGION must be specified EC2 AMI creation"
@echo "--------------------------------------------------------------"
@false
.endif
.if !defined(AWSBUCKET)
@echo "--------------------------------------------------------------"
@echo ">>> AWSBUCKET must be specified for EC2 AMI creation"
@echo "--------------------------------------------------------------"
@false
.endif
/usr/local/bin/bsdec2-image-upload ${PUBLISH} \
${.OBJDIR}/ec2.raw \
"${TYPE} ${REVISION}-${BRANCH}${AMINAMESUFFIX}" \
"${TYPE} ${REVISION}-${BRANCH}" \
${AWSREGION} ${AWSBUCKET} ${AWSKEYFILE}

View File

@ -152,3 +152,5 @@ cloudware-install:
.if defined(WITH_CLOUDWARE) && !empty(WITH_CLOUDWARE) && !empty(CLOUDWARE)
${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} ${CLOUDINSTALL}
.endif
.include "${.CURDIR}/Makefile.ec2"