summaryrefslogtreecommitdiffstats
path: root/release/Makefile.ec2
blob: 45a08e4872981273f2a105b388c8a226b5b541c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#
# $FreeBSD$
#
#
# Makefile for creating an EC2 AMI from a disk image.
#

.if ${BRANCH} == "CURRENT" || ${BRANCH} == "STABLE" || ${BRANCH} == "PRERELEASE"
AMINAMESUFFIX!=	date +-%Y-%m-%d
.endif
.if defined(EC2PUBLIC)
PUBLISH=	--public
.endif

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

cw-ec2-portinstall:
.if exists(${PORTSDIR}/net/bsdec2-image-upload/Makefile)
	env - PATH=$$PATH make -C ${PORTSDIR}/net/bsdec2-image-upload BATCH=1 all install clean
.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
.endif
	@touch ${.TARGET}

ec2ami: cw-ec2 ${CW_EC2_PORTINSTALL}
.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} --sriov \
	    ${.OBJDIR}/ec2.raw \
	    "${TYPE} ${REVISION}-${BRANCH}-${TARGET}${AMINAMESUFFIX}" \
	    "${TYPE} ${REVISION}-${BRANCH}-${TARGET}" \
	    ${AWSREGION} ${AWSBUCKET} ${AWSKEYFILE}
	@touch ${.TARGET}
OpenPOWER on IntegriCloud