2015-04-01 00:00:17 +00:00
|
|
|
#
|
|
|
|
# $FreeBSD$
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# Makefile for creating an EC2 AMI from a disk image.
|
|
|
|
#
|
|
|
|
|
2015-06-25 13:40:00 +00:00
|
|
|
.if ${BRANCH} == "CURRENT" || ${BRANCH} == "STABLE" || ${BRANCH} == "PRERELEASE"
|
2015-07-01 14:51:26 +00:00
|
|
|
AMINAMESUFFIX!= date +-%Y-%m-%d
|
2015-04-01 00:00:17 +00:00
|
|
|
.endif
|
|
|
|
.if defined(EC2PUBLIC)
|
|
|
|
PUBLISH= --public
|
|
|
|
.endif
|
|
|
|
|
2015-05-04 15:04:39 +00:00
|
|
|
CLEANFILES+= ec2ami
|
|
|
|
|
|
|
|
.if !exists(/usr/local/bin/bsdec2-image-upload)
|
|
|
|
CW_EC2_PORTINSTALL= cw-ec2-portinstall
|
|
|
|
CLEANFILES+= ${CW_EC2_PORTINSTALL}
|
|
|
|
.else
|
|
|
|
CW_EC2_PORTINSTALL=
|
|
|
|
.endif
|
|
|
|
|
2015-04-27 21:38:12 +00:00
|
|
|
cw-ec2-portinstall:
|
|
|
|
.if exists(${PORTSDIR}/net/bsdec2-image-upload/Makefile)
|
2016-06-09 03:54:25 +00:00
|
|
|
env - PATH=$$PATH make -C ${PORTSDIR}/net/bsdec2-image-upload BATCH=1 all install clean
|
2015-04-27 21:38:12 +00:00
|
|
|
.else
|
|
|
|
. if !exists(/usr/local/sbin/pkg-static)
|
|
|
|
env ASSUME_ALWAYS_YES=yes pkg bootstrap -y
|
|
|
|
. endif
|
|
|
|
env ASSUME_ALWAYS_YES=yes pkg install -y net/bsdec2-image-upload
|
2015-04-01 00:00:17 +00:00
|
|
|
.endif
|
2015-05-04 15:04:39 +00:00
|
|
|
@touch ${.TARGET}
|
2015-04-27 21:38:12 +00:00
|
|
|
|
2015-05-04 15:04:39 +00:00
|
|
|
ec2ami: cw-ec2 ${CW_EC2_PORTINSTALL}
|
2015-04-01 00:00:17 +00:00
|
|
|
.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
|
2017-05-25 19:02:54 +00:00
|
|
|
/usr/local/bin/bsdec2-image-upload ${PUBLISH} --sriov --ena \
|
2015-06-02 17:00:31 +00:00
|
|
|
${.OBJDIR}/ec2.raw \
|
|
|
|
"${TYPE} ${REVISION}-${BRANCH}-${TARGET}${AMINAMESUFFIX}" \
|
|
|
|
"${TYPE} ${REVISION}-${BRANCH}-${TARGET}" \
|
2015-04-01 00:00:17 +00:00
|
|
|
${AWSREGION} ${AWSBUCKET} ${AWSKEYFILE}
|
2015-05-04 15:04:39 +00:00
|
|
|
@touch ${.TARGET}
|