Add ISO_LABEL to patched iso

Adds ISO_LABEL to avoid boot loop if the
iso is not removed after the install.

This commit also verifies if prereq tools are
installed.

Test Plan:
Pass: build patched iso and install

Story: 2009969
Task: 46467
Signed-off-by: Luis Sampaio <luis.sampaio@windriver.com>
Change-Id: I642528dd5858d50b8cb8abfc2ff4976696775a8d
This commit is contained in:
Luis Sampaio 2022-12-14 15:28:42 -08:00
parent 3f3c66e432
commit e2c1cd3c78

18
build-tools/patch-iso-debian Normal file → Executable file
View File

@ -20,6 +20,11 @@ if [ -z "${STX_BUILD_HOME}" ]; then
exit 1 exit 1
fi fi
if [ -z "${MY_REPO}" ]; then
echo "Required environment variable MY_REPO is not set"
exit 1
fi
DEPLOY_DIR="${STX_BUILD_HOME}/localdisk/deploy" DEPLOY_DIR="${STX_BUILD_HOME}/localdisk/deploy"
OSTREE_REPO="${DEPLOY_DIR}/ostree_repo" OSTREE_REPO="${DEPLOY_DIR}/ostree_repo"
@ -190,6 +195,8 @@ function cleanup() {
} }
check_requirements
trap cleanup EXIT trap cleanup EXIT
MNTDIR=$(mktemp -d -p $PWD patchiso_mnt_XXXXXX) MNTDIR=$(mktemp -d -p $PWD patchiso_mnt_XXXXXX)
@ -232,9 +239,16 @@ echo "Extracting patch metadata"
extract_metada $PATCH_FILE extract_metada $PATCH_FILE
echo "Packing iso..." echo "Packing iso..."
# get the install label
ISO_LABEL=$(grep -ri instiso "${BUILDDIR}"/isolinux/isolinux.cfg | head -1 | xargs -n1 | awk -F= /instiso/'{print $2}')
if [ -z "${ISO_LABEL}" ] ; then
echo "Error: Failed to get iso install label"
fi
echo "ISO Label: ${ISO_LABEL}"
# Repack the ISO # Repack the ISO
mkisofs -o "${OUTPUT_ISO}" \ mkisofs -o "${OUTPUT_ISO}" \
-A 'instboot' -V 'instboot' \ -A "${ISO_LABEL}" -V "${ISO_LABEL}" \
-quiet -U -J -joliet-long -r -iso-level 2 \ -quiet -U -J -joliet-long -r -iso-level 2 \
-b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot \ -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot \
-boot-load-size 4 -boot-info-table \ -boot-load-size 4 -boot-info-table \
@ -248,7 +262,7 @@ implantisomd5 ${OUTPUT_ISO}
# Sign the .iso with the developer private key # Sign the .iso with the developer private key
openssl dgst -sha256 \ openssl dgst -sha256 \
-sign ${STX_BUILD_HOME}/repo/cgcs-root/build-tools/signing/dev-private-key.pem \ -sign ${MY_REPO}/build-tools/signing/dev-private-key.pem \
-binary \ -binary \
-out ${OUTPUT_ISO/%.iso/.sig} \ -out ${OUTPUT_ISO/%.iso/.sig} \
${OUTPUT_ISO} ${OUTPUT_ISO}