diff options
author | Thomas Deutschmann <whissi@gentoo.org> | 2020-11-19 19:24:44 +0100 |
---|---|---|
committer | Thomas Deutschmann <whissi@gentoo.org> | 2020-11-19 19:26:05 +0100 |
commit | 57616accfd55b736e3b402ead96637e23792772a (patch) | |
tree | 9cbeee362f3f11029aef22855fd992547dc32b15 /sys-kernel/linux-firmware | |
parent | games-server/bedrock-server: bump to version 1.16.100.04 (diff) | |
download | gentoo-57616accfd55b736e3b402ead96637e23792772a.tar.gz gentoo-57616accfd55b736e3b402ead96637e23792772a.tar.bz2 gentoo-57616accfd55b736e3b402ead96637e23792772a.zip |
sys-kernel/linux-firmware: check each command in pipeline manually
We cannot use Bash's pipefail option because grep can return exit status 1
to indicate that no line was selected which isn't an error.
Fixes: 9bf0896d9 ("sys-kernel/linux-firmware: use copy-firmware.sh to install firmwares")
Closes: https://bugs.gentoo.org/754960
Package-Manager: Portage-3.0.9, Repoman-3.0.2
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
Diffstat (limited to 'sys-kernel/linux-firmware')
-rw-r--r-- | sys-kernel/linux-firmware/linux-firmware-20201022-r2.ebuild | 11 | ||||
-rw-r--r-- | sys-kernel/linux-firmware/linux-firmware-99999999.ebuild | 11 |
2 files changed, 18 insertions, 4 deletions
diff --git a/sys-kernel/linux-firmware/linux-firmware-20201022-r2.ebuild b/sys-kernel/linux-firmware/linux-firmware-20201022-r2.ebuild index bc7bc76e3b09..01b85b27a4f0 100644 --- a/sys-kernel/linux-firmware/linux-firmware-20201022-r2.ebuild +++ b/sys-kernel/linux-firmware/linux-firmware-20201022-r2.ebuild @@ -276,12 +276,19 @@ src_install() { [[ -s "${files_to_keep}" ]] || die "grep failed, empty config file?" einfo "Applying USE=savedconfig; Removing all files not listed in config ..." - set -o pipefail find ! -type d -printf "%P\n" \ | grep -Fvx -f "${files_to_keep}" \ | xargs -d '\n' --no-run-if-empty rm -v - [[ ${?} -ne 0 ]] && die "Failed to remove files not listed in config" + if [[ ${PIPESTATUS[0]} -ne 0 ]]; then + die "Find failed to print installed files" + elif [[ ${PIPESTATUS[1]} -eq 2 ]]; then + # grep returns exit status 1 if no lines were selected + # which is the case when we want to keep all files + die "Grep failed to select files to keep" + elif [[ ${PIPESTATUS[2]} -ne 0 ]]; then + die "Failed to remove files not listed in config" + fi fi fi diff --git a/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild b/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild index bc7bc76e3b09..01b85b27a4f0 100644 --- a/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild +++ b/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild @@ -276,12 +276,19 @@ src_install() { [[ -s "${files_to_keep}" ]] || die "grep failed, empty config file?" einfo "Applying USE=savedconfig; Removing all files not listed in config ..." - set -o pipefail find ! -type d -printf "%P\n" \ | grep -Fvx -f "${files_to_keep}" \ | xargs -d '\n' --no-run-if-empty rm -v - [[ ${?} -ne 0 ]] && die "Failed to remove files not listed in config" + if [[ ${PIPESTATUS[0]} -ne 0 ]]; then + die "Find failed to print installed files" + elif [[ ${PIPESTATUS[1]} -eq 2 ]]; then + # grep returns exit status 1 if no lines were selected + # which is the case when we want to keep all files + die "Grep failed to select files to keep" + elif [[ ${PIPESTATUS[2]} -ne 0 ]]; then + die "Failed to remove files not listed in config" + fi fi fi |