summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Deutschmann <whissi@gentoo.org>2020-11-19 19:24:44 +0100
committerThomas Deutschmann <whissi@gentoo.org>2020-11-19 19:26:05 +0100
commit57616accfd55b736e3b402ead96637e23792772a (patch)
tree9cbeee362f3f11029aef22855fd992547dc32b15 /sys-kernel
parentgames-server/bedrock-server: bump to version 1.16.100.04 (diff)
downloadgentoo-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')
-rw-r--r--sys-kernel/linux-firmware/linux-firmware-20201022-r2.ebuild11
-rw-r--r--sys-kernel/linux-firmware/linux-firmware-99999999.ebuild11
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