Allow dib build to remove firmware in a structure.

In some cases, a vendor may do many things and we only need to remove
a specific subset of firmware blobs.

An example is Mellanox and their Spectrum series of switch controllers.

In change id Ic8ecf289f1e03e5ee7f36cc6ded707a25cb138c8 we added a
command to attempt to remove a huge amount of firmware blobs from
multiple revisions of spectrum series switch controllers
(i.e. spectrum, spectrum2, spectrum3).

Where as the prior pattern of the removal script was to just remove whole
folders, becuase there was a historical pattern of clean delineation.

Anyhow, now we'll check to see if there is a slash in the path, and only
then allow for the glob expansion to take place which was in the original
logic of the removal code when it was first submitted, but where we were
also concerned someone would override the list and accidently remove all
firmware blobs. In this case, we also check to ensure its not an empty
string.

Change-Id: Iab766228cac801d29457e8bee5a05834f1a0f04a
Signed-off-by: Julia Kreger <juliaashleykreger@gmail.com>
This commit is contained in:
Julia Kreger
2025-07-09 08:54:06 -07:00
parent 608465b83d
commit e06a6cf64c

View File

@@ -15,7 +15,15 @@ for folder in $KNOWN_FIRMWARE_PATH; do
for item in ${IPA_REMOVE_FIRMWARE//,/ }; do
# Attempt removal of item, but don't error
# if it is not present already.
rm -rf $folder$item || true
if [[ "$item" != "" ]] && [[ "$item" =~ "/" ]]; then
# We're deleting targetted contents in a folder,
# and not an entire folder. Since we're checking for an
# an empty string, we should be fine letting it do the
# expansion.
rm -r -f $folder$item*
else
rm -rf $folder$item || true
fi
done
done