git: c482d65cd187 - main - EC2: Drop UEFI-PREFERRED from AMI names

From: Colin Percival <cperciva_at_FreeBSD.org>
Date: Mon, 19 Aug 2024 18:11:30 UTC
The branch main has been updated by cperciva:

URL: https://cgit.FreeBSD.org/src/commit/?id=c482d65cd187a5cc311ede3e328270bfcd014e73

commit c482d65cd187a5cc311ede3e328270bfcd014e73
Author:     Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2024-08-18 02:05:52 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2024-08-19 18:11:17 +0000

    EC2: Drop UEFI-PREFERRED from AMI names
    
    Starting in September 2021 EC2 AMI names have included the boot method:
    "BIOS", "UEFI", or "UEFI-PREFERRED".  The third option became available
    in June 2023 and allows AMIs to boot via UEFI on EC2 instance types
    which support that, but fall back to (much slower) BIOS booting on the
    instance types which don't support UEFI.
    
    Since UEFI-PREFERRED is basically a best-of-both-worlds option and is
    now the default, there's no point mentioning it in the AMI names.  If
    for some reason an AMI is built with the boot method forced to BIOS or
    UEFI, that will still be included in the AMI name.
    
    This will not be MFCed, in case anyone has scripts which look at the AMI
    names on 13.x/14.x.
    
    Sponsored by:   Amazon
---
 release/Makefile.ec2 | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/release/Makefile.ec2 b/release/Makefile.ec2
index 4363aac21369..27e6340dca2b 100644
--- a/release/Makefile.ec2
+++ b/release/Makefile.ec2
@@ -29,6 +29,11 @@ BOOTMODEOPT=	--uefi
 .if ${AMIBOOTMETHOD} == "UEFI-PREFERRED" && ${TARGET_ARCH} == "amd64"
 BOOTMODEOPT=	--uefi-preferred
 .endif
+.if ${AMIBOOTMETHOD} == "UEFI-PREFERRED"
+AMIBASENAME=${TYPE} ${REVISION}-${BRANCH}-${TARGET}${AMINAMESUFFIX}
+.else
+AMIBASENAME=${TYPE} ${REVISION}-${BRANCH}-${TARGET}${AMINAMESUFFIX} ${AMIBOOTMETHOD}
+.endif
 
 CLEANFILES+=		ec2ami
 
@@ -83,7 +88,7 @@ ec2ami-${_FL}-${_FS}: cw-ec2-${_FL}-${_FS} ${CW_EC2_PORTINSTALL}
 	/usr/local/bin/bsdec2-image-upload ${PUBLISH} ${PUBLICSNAP} \
 	    ${EC2ARCH} ${SSMOPTS_${_FL}_${_FS}} ${BOOTMODEOPT} --sriov --ena \
 	    ${.OBJDIR}/${EC2-${_FL:tu}${_FS:tu}IMAGE} \
-	    "${TYPE} ${REVISION}-${BRANCH}-${TARGET}${AMINAMESUFFIX} ${AMIBOOTMETHOD} ${_FL} ${_FS:tu}" \
+	    "${AMIBASENAME} ${_FL} ${_FS:tu}" \
 	    "${TYPE}/${TARGET} ${GITBRANCH}@${GITREV}" \
 	    ${AWSREGION} ${AWSBUCKET} ${AWSKEYFILE} \
 	    ${EC2SNSTOPIC} ${EC2SNSREL} ${EC2SNSVERS}