commit:     5051834606a77afa11c0e9c96bc298872bc11650
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 30 16:37:00 2020 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Fri Oct 30 16:45:50 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=50518346

sys-kernel/linux-firmware: keep misc files

Whitelist misc files like copy-firmware.sh or WHENCE which we will use
later.

Closes: https://bugs.gentoo.org/751901
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 .../linux-firmware/linux-firmware-99999999.ebuild    | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild 
b/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild
index fcd90451c74..6a67500e679 100644
--- a/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild
+++ b/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild
@@ -114,6 +114,13 @@ src_prepare() {
                fi
        fi
 
+       # whitelist of misc files
+       local misc_files=(
+               copy-firmware.sh
+               WHENCE
+               README
+       )
+
        # whitelist of images with a free software license
        local free_software=(
                # keyspan_pda (GPL-2+)
@@ -238,9 +245,16 @@ src_prepare() {
                # everything else is confirmed (or assumed) to be 
redistributable
                # based on upstream acceptance policy
                einfo "Removing non-redistributable files ..."
-               IFS=$'\n' find ! -type d -printf "%P\n" \
-                       | grep -Fvx -e "${free_software[*]}" -e 
"${unknown_license[*]}" \
-                       | xargs -d '\n' rm -v || die
+               local OLDIFS="${IFS}"
+               local IFS=$'\n'
+               set -o pipefail
+               find ! -type d -printf "%P\n" \
+                       | grep -Fvx -e "${misc_files[*]}" -e 
"${free_software[*]}" -e "${unknown_license[*]}" \
+                       | xargs -d '\n' --no-run-if-empty rm -v
+
+               [[ ${?} -ne 0 ]] && die "Failed to remove non-redistributable 
files"
+
+               IFS="${OLDIFS}"
        fi
 
        restore_config ${PN}.conf

Reply via email to