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 <davlet.panech@windriver.com>
This commit is contained in:
Davlet Panech 2022-06-02 13:12:02 -04:00
parent c2c96ce2f0
commit 876f172b8b
1 changed files with 20 additions and 0 deletions

View File

@ -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