2015-04-01 02:00:17 +02:00
|
|
|
#
|
|
|
|
# $FreeBSD$
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# Makefile for creating an EC2 AMI from a disk image.
|
|
|
|
#
|
|
|
|
|
2015-06-25 15:40:00 +02:00
|
|
|
.if ${BRANCH} == "CURRENT" || ${BRANCH} == "STABLE" || ${BRANCH} == "PRERELEASE"
|
2020-08-12 18:25:25 +02:00
|
|
|
AMINAMESUFFIX!= date +-${BUILDDATE}
|
2015-04-01 02:00:17 +02:00
|
|
|
.endif
|
2018-07-18 01:16:05 +02:00
|
|
|
.if defined(EC2PUBLIC) && !empty(EC2PUBLIC)
|
2015-04-01 02:00:17 +02:00
|
|
|
PUBLISH= --public
|
|
|
|
.endif
|
2018-08-06 21:21:32 +02:00
|
|
|
.if defined(EC2PUBLICSNAP) && !empty(EC2PUBLICSNAP)
|
2018-08-07 02:51:49 +02:00
|
|
|
PUBLICSNAP= --publicsnap
|
2018-08-06 21:21:32 +02:00
|
|
|
.endif
|
2018-07-18 01:16:05 +02:00
|
|
|
.if defined(EC2SNSTOPIC) && !empty(EC2SNSTOPIC)
|
2018-07-17 21:05:30 +02:00
|
|
|
EC2SNSREL= ${REVISION}-${BRANCH}
|
Makefile.inc1:
- New file. Adds logic to search for the git binary, as well
as determining the branch and revision, used in various
places.
Makefile:
- Remove searching for the svn{,lite} binary.
Makefile.ec2:
- Reduce duplicated code, removing searching for the svn{,lite}
binary, in addition to EC2_SVN{BRANCH,REV}.
- Rename EC2_SVN* with GIT* for consistency.
Makefile.mirrors:
- Remove the SRCBRANCH declaration, replaced with the exported
GITBRANCH variable.
- Update _SNAP_SUFFIX from SVNREVISION to GITREV, and remove
the leading 'r' from it, since it will break git hashes.
- Remove yet another instance of duplicated code to search for
the svn{,version}lite binary.
Sponsored by: Rubicon Communications, LLC (netgate.com)
2020-07-16 22:34:26 +02:00
|
|
|
EC2SNSVERS= ${GITBRANCH}@${GITREV}
|
2018-07-17 21:05:30 +02:00
|
|
|
.endif
|
2019-03-20 08:19:09 +01:00
|
|
|
.if ${TARGET_ARCH} != "amd64"
|
|
|
|
EC2ARCH= --${TARGET_ARCH:S/aarch64/arm64/}
|
|
|
|
.endif
|
2021-09-16 04:15:44 +02:00
|
|
|
.if !defined(AMIBOOTMETHOD)
|
2023-06-08 00:17:12 +02:00
|
|
|
AMIBOOTMETHOD= UEFI-PREFERRED
|
2021-09-16 04:15:44 +02:00
|
|
|
.endif
|
|
|
|
.if ${AMIBOOTMETHOD} == "UEFI" && ${TARGET_ARCH} == "amd64"
|
|
|
|
BOOTMODEOPT= --uefi
|
|
|
|
.endif
|
2023-06-08 00:17:12 +02:00
|
|
|
.if ${AMIBOOTMETHOD} == "UEFI-PREFERRED" && ${TARGET_ARCH} == "amd64"
|
|
|
|
BOOTMODEOPT= --uefi-preferred
|
|
|
|
.endif
|
2015-04-01 02:00:17 +02:00
|
|
|
|
2015-05-04 17:04:39 +02: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 23:38:12 +02:00
|
|
|
cw-ec2-portinstall:
|
|
|
|
.if exists(${PORTSDIR}/net/bsdec2-image-upload/Makefile)
|
2021-03-04 15:22:45 +01:00
|
|
|
env - UNAME_r=${UNAME_r} PATH=$$PATH make -C ${PORTSDIR}/net/bsdec2-image-upload BATCH=1 all install clean
|
2015-04-27 23:38:12 +02: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 02:00:17 +02:00
|
|
|
.endif
|
2015-05-04 17:04:39 +02:00
|
|
|
@touch ${.TARGET}
|
2015-04-27 23:38:12 +02:00
|
|
|
|
2023-08-07 03:56:18 +02:00
|
|
|
.for _FS in ${EC2_FSLIST}
|
|
|
|
.if defined(SSMPREFIX) && !empty(SSMPREFIX)
|
|
|
|
SSMOPTS_${_FS}= --ssm-name ${SSMPREFIX}/${TARGET_ARCH:S/aarch64/arm64/}/base/${_FS}/${REVISION}/${BRANCH}
|
|
|
|
.endif
|
|
|
|
EC2AMILIST+= ec2ami-${_FS}
|
|
|
|
ec2ami-${_FS}: cw-ec2-${_FS} ${CW_EC2_PORTINSTALL}
|
2015-04-01 02:00:17 +02: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
|
2019-03-20 08:19:09 +01:00
|
|
|
/usr/local/bin/bsdec2-image-upload ${PUBLISH} ${PUBLICSNAP} \
|
2023-08-07 03:56:18 +02:00
|
|
|
${EC2ARCH} ${SSMOPTS_${_FS}} ${BOOTMODEOPT} --sriov --ena \
|
|
|
|
${.OBJDIR}/${EC2${_FS:tu}IMAGE} \
|
|
|
|
"${TYPE} ${REVISION}-${BRANCH}-${TARGET}${AMINAMESUFFIX} ${AMIBOOTMETHOD} ${_FS:tu}" \
|
Makefile.inc1:
- New file. Adds logic to search for the git binary, as well
as determining the branch and revision, used in various
places.
Makefile:
- Remove searching for the svn{,lite} binary.
Makefile.ec2:
- Reduce duplicated code, removing searching for the svn{,lite}
binary, in addition to EC2_SVN{BRANCH,REV}.
- Rename EC2_SVN* with GIT* for consistency.
Makefile.mirrors:
- Remove the SRCBRANCH declaration, replaced with the exported
GITBRANCH variable.
- Update _SNAP_SUFFIX from SVNREVISION to GITREV, and remove
the leading 'r' from it, since it will break git hashes.
- Remove yet another instance of duplicated code to search for
the svn{,version}lite binary.
Sponsored by: Rubicon Communications, LLC (netgate.com)
2020-07-16 22:34:26 +02:00
|
|
|
"${TYPE}/${TARGET} ${GITBRANCH}@${GITREV}" \
|
2018-07-17 21:05:30 +02:00
|
|
|
${AWSREGION} ${AWSBUCKET} ${AWSKEYFILE} \
|
|
|
|
${EC2SNSTOPIC} ${EC2SNSREL} ${EC2SNSVERS}
|
2015-05-04 17:04:39 +02:00
|
|
|
@touch ${.TARGET}
|
2023-08-07 03:56:18 +02:00
|
|
|
.endfor
|
2023-08-07 03:55:37 +02:00
|
|
|
|
|
|
|
ec2ami: ec2ami-${VMFS}
|
2023-08-07 03:56:18 +02:00
|
|
|
ec2amis: ${EC2AMILIST}
|