linux-firmware/debian-firmware/debian/scripts/remove-firmware
2023-03-03 23:53:16 +03:00

28 lines
542 B
Bash
Executable File

#!/bin/bash -eu
#
# Remove firmware files and/or directories
#
if [ $# -ne 1 ] ; then
echo "Usage: remove-firmware <dirname>" >&2
exit 2
fi
if ! [ -d "${1}" ] ; then
echo "No such directory: ${1}" >&2
exit 1
fi
echo "Remove firmware files in ${1} ..."
while IFS= read -r item ; do
# Don't quote 'item' to allow globs in remove-firmware.list
# shellcheck disable=SC2086
for fw in "${1:?}"/${item} ; do
if [ -e "${fw}" ] ; then
echo " ${fw}"
rm -rf "${fw}"
fi
done
done < <(sed -E '/^#|^$/d' debian/remove-firmware.list)