Remove firmware from debian based systems

Adds logic to loop through the path debian uses to remove excess
firmware binaries that are un-needed for the agent to operate.

Change-Id: I95a12215b8c5b2d52f52145f79b5f245138ebfde
This commit is contained in:
Julia Kreger 2020-12-15 09:46:34 -08:00
parent 6cb1dbcad0
commit 1b904b5dd3
2 changed files with 15 additions and 5 deletions

View File

@ -7,11 +7,16 @@ set -eu
set -o pipefail
rm -rf /tmp/ironic-python-agent
for item in ${IPA_REMOVE_FIRMWARE//,/ }; do
# Attempt removal of item, but don't error
# if it is not present already.
rm -rf /usr/lib/firmware/$item || true
# In Centos Stream, /lib is linked to /lib/firmware, so the first
# loop will likely go ahead and remove everything, but the || true
# below will keep it from erroring.
KNOWN_FIRMWARE_PATH="/lib/firmware/ /usr/lib/firmware/"
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
done
done
# TODO(dtantsur): implement the same for debian-based systems

View File

@ -0,0 +1,5 @@
---
features:
- |
Excess hardware firmware on Debian based agent ramdisks is now automatically
removed.