git: 057686379c8b - main - release/amd64: cleanup code duplication

From: Ahmad Khalifa <vexeduxr_at_FreeBSD.org>
Date: Tue, 05 Aug 2025 02:11:09 UTC
The branch main has been updated by vexeduxr:

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

commit 057686379c8bc24c3d2b78c3aa2e5d8b70221120
Author:     Ahmad Khalifa <vexeduxr@FreeBSD.org>
AuthorDate: 2025-01-11 13:33:20 +0000
Commit:     Ahmad Khalifa <vexeduxr@FreeBSD.org>
CommitDate: 2025-08-05 01:48:45 +0000

    release/amd64: cleanup code duplication
    
    Approved by:    imp (mentor)
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/1571
    Closes:         https://github.com/freebsd/freebsd-src/pull/1571
---
 release/amd64/make-memstick.sh | 6 ++----
 release/amd64/mkisoimages.sh   | 6 ++----
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/release/amd64/make-memstick.sh b/release/amd64/make-memstick.sh
index cec4b27b5b96..770b128fd9f9 100755
--- a/release/amd64/make-memstick.sh
+++ b/release/amd64/make-memstick.sh
@@ -62,11 +62,9 @@ fi
 # Make an ESP in a file.
 espfilename=$(mktemp /tmp/efiboot.XXXXXX)
 if [ -f "${BASEBITSDIR}/boot/loader_ia32.efi" ]; then
-	make_esp_file ${espfilename} ${fat32min} ${BASEBITSDIR}/boot/loader.efi bootx64 \
-	    ${BASEBITSDIR}/boot/loader_ia32.efi bootia32
-else
-	make_esp_file ${espfilename} ${fat32min} ${BASEBITSDIR}/boot/loader.efi
+	extra_args="${BASEBITSDIR}/boot/loader_ia32.efi bootia32"
 fi
+make_esp_file ${espfilename} ${fat32min} ${BASEBITSDIR}/boot/loader.efi bootx64 ${extra_args}
 
 ${MKIMG} -s mbr \
     -b ${BASEBITSDIR}/boot/mbr \
diff --git a/release/amd64/mkisoimages.sh b/release/amd64/mkisoimages.sh
index 8f7163e05261..01677ae787f9 100644
--- a/release/amd64/mkisoimages.sh
+++ b/release/amd64/mkisoimages.sh
@@ -54,11 +54,9 @@ if [ "$1" = "-b" ]; then
 	# ESP file size in KB.
 	espsize="2048"
 	if [ -f "${BASEBITSDIR}/boot/loader_ia32.efi" ]; then
-		make_esp_file ${espfilename} ${espsize} ${BASEBITSDIR}/boot/loader.efi bootx64 \
-		    ${BASEBITSDIR}/boot/loader_ia32.efi bootia32
-	else
-		make_esp_file ${espfilename} ${espsize} ${BASEBITSDIR}/boot/loader.efi
+		extra_args="${BASEBITSDIR}/boot/loader_ia32.efi bootia32"
 	fi
+	make_esp_file ${espfilename} ${espsize} ${BASEBITSDIR}/boot/loader.efi bootx64 ${extra_args}
 	bootable="$bootable -o bootimage=i386;${espfilename} -o no-emul-boot -o platformid=efi"
 
 	shift