Merge pull request #561 from marineam/status

*: Fix PIPESTATUS checks for bash 4.3
This commit is contained in:
Michael Marineau 2016-06-22 13:57:00 -07:00 committed by GitHub
commit c7818adf2f
2 changed files with 9 additions and 3 deletions

View File

@ -383,9 +383,13 @@ install_cross_libs() {
gcc_get_latest_profile() { gcc_get_latest_profile() {
local prefix="${1}-" local prefix="${1}-"
local suffix="${2+-$2}" local suffix="${2+-$2}"
local status
gcc-config -l | cut -d' ' -f3 | grep "^${prefix}[0-9\\.]*${suffix}$" | tail -n1 gcc-config -l | cut -d' ' -f3 | grep "^${prefix}[0-9\\.]*${suffix}$" | tail -n1
# return 1 if anything in the above pipe failed # return 1 if anything in the above pipe failed
[[ -z ${PIPESTATUS[*]#0} ]] || return 1 for status in ${PIPESTATUS[@]}; do
[[ $status -eq 0 ]] || return 1
done
} }
# Update to the latest GCC profile for a given CHOST if required # Update to the latest GCC profile for a given CHOST if required

View File

@ -718,7 +718,7 @@ make_digests() {
# Usage: verify_digests [-d file.DIGESTS] file1 [file2...] # Usage: verify_digests [-d file.DIGESTS] file1 [file2...]
# If -d is not specified file1.DIGESTS will be used # If -d is not specified file1.DIGESTS will be used
verify_digests() { verify_digests() {
local digests local digests filename hash_type status
if [[ "$1" == "-d" ]]; then if [[ "$1" == "-d" ]]; then
[[ -n "$2" ]] || die "-d requires an argument" [[ -n "$2" ]] || die "-d requires an argument"
digests="$(readlink -f "$2")" digests="$(readlink -f "$2")"
@ -735,7 +735,9 @@ verify_digests() {
grep -A1 -i "^# ${hash_type} HASH$" "${digests}" | \ grep -A1 -i "^# ${hash_type} HASH$" "${digests}" | \
grep "$filename$" | ${hash_type}sum -c - --strict || return 1 grep "$filename$" | ${hash_type}sum -c - --strict || return 1
# Also check that none of the greps failed in the above pipeline # Also check that none of the greps failed in the above pipeline
[[ -z ${PIPESTATUS[*]#0} ]] || return 1 for status in ${PIPESTATUS[@]}; do
[[ $status -eq 0 ]] || return 1
done
done done
done done
popd >/dev/null popd >/dev/null