Merge pull request #17425 from Homebrew/handle_broken_shasum
cmd/vendor-install: handle broken `shasum`.
This commit is contained in:
commit
2051e053ee
@ -186,10 +186,16 @@ EOS
|
|||||||
if [[ -x "/usr/bin/shasum" ]]
|
if [[ -x "/usr/bin/shasum" ]]
|
||||||
then
|
then
|
||||||
sha="$(/usr/bin/shasum -a 256 "${CACHED_LOCATION}" | cut -d' ' -f1)"
|
sha="$(/usr/bin/shasum -a 256 "${CACHED_LOCATION}" | cut -d' ' -f1)"
|
||||||
elif [[ -x "$(type -P sha256sum)" ]]
|
fi
|
||||||
|
|
||||||
|
if [[ -z "${sha}" && -x "$(type -P sha256sum)" ]]
|
||||||
then
|
then
|
||||||
sha="$(sha256sum "${CACHED_LOCATION}" | cut -d' ' -f1)"
|
sha="$(sha256sum "${CACHED_LOCATION}" | cut -d' ' -f1)"
|
||||||
elif [[ -x "$(type -P ruby)" ]]
|
fi
|
||||||
|
|
||||||
|
if [[ -z "${sha}" ]]
|
||||||
|
then
|
||||||
|
if [[ -x "$(type -P ruby)" ]]
|
||||||
then
|
then
|
||||||
sha="$(
|
sha="$(
|
||||||
ruby <<EOSCRIPT
|
ruby <<EOSCRIPT
|
||||||
@ -200,7 +206,13 @@ puts digest.hexdigest
|
|||||||
EOSCRIPT
|
EOSCRIPT
|
||||||
)"
|
)"
|
||||||
else
|
else
|
||||||
odie "Cannot verify checksum ('shasum' or 'sha256sum' not found)!"
|
odie "Cannot verify checksum ('shasum', 'sha256sum' and 'ruby' not found)!"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z "${sha}" ]]
|
||||||
|
then
|
||||||
|
odie "Could not get checksum ('shasum', 'sha256sum' and 'ruby' produced no output)!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${sha}" != "${VENDOR_SHA}" ]]
|
if [[ "${sha}" != "${VENDOR_SHA}" ]]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user