From 876f172b8b363d768863965c0a864abce2caf173 Mon Sep 17 00:00:00 2001 From: Davlet Panech Date: Thu, 2 Jun 2022 13:12:02 -0400 Subject: [PATCH] build-tools: discover firmware files for installer The script build-tools/update-pxe-network-installer allows one to add additional firmware files to the installer by specifying an environment variable, UPDATE_FW_LIST. This is inconvenient, because it requires the user to know the exact path to the firmware file to be included. Solution: search for files names "centos_firmware.inc" in the source tree and take firmware files from there. Story: 2010067 Task: 45529 Change-Id: I7673bd2c1bab4061936d8558a64f016a3661feec Signed-off-by: Davlet Panech --- build-tools/update-pxe-network-installer | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/build-tools/update-pxe-network-installer b/build-tools/update-pxe-network-installer index bb5ae2dd..efd31e26 100755 --- a/build-tools/update-pxe-network-installer +++ b/build-tools/update-pxe-network-installer @@ -38,6 +38,17 @@ find_and_copy_rpm () { fi } +find_firmware() { + ( + set -e + pattern="centos_firmware.inc" + cd $MY_REPO_ROOT_DIR + repo forall -c 'echo $REPO_PATH' \ + | xargs -r -i find '{}' -mindepth 1 -maxdepth 1 -xtype f -name "$pattern" \ + | xargs -r grep -E -v '^\s*(#.*)?$' \ + | sort -u + ) +} echo "Start to update pxe-network-installer images .... " timestamp=$(date +%F_%H%M) @@ -55,6 +66,15 @@ fi if [ -n "${UPDATE_FW_LIST}" ] && [ -f "${UPDATE_FW_LIST}" ]; then cp -f ${UPDATE_FW_LIST} ${firmware_list_file} fi +find_firmware >"${firmware_list_file}.tmp" +if [[ -s "${firmware_list_file}.tmp" ]] ; then + cat "${firmware_list_file}.tmp" >>"${firmware_list_file}" +fi +\rm -f "${firmware_list_file}.tmp" +if [[ -f "${firmware_list_file}" ]] ; then + echo "Including firmware files in installer:" >&2 + cat "${firmware_list_file}" | sed -r 's/^/\t/' >&2 +fi cd $pxe_network_installer_dir