diff options
| author | Misty De Meo | 2017-05-29 21:48:12 -0700 |
|---|---|---|
| committer | Misty De Meo | 2017-05-30 18:48:55 -0700 |
| commit | 587f338daabfd7ee5f02bff8fc976a0d32e13c2b (patch) | |
| tree | a621c6dfd24169cc830ce7c4eac44183b76242bf | |
| parent | a40291ee4a0adfd87bb935e58a6e5335546b6364 (diff) | |
| download | brew-587f338daabfd7ee5f02bff8fc976a0d32e13c2b.tar.bz2 | |
vendor-install: use Ruby as a sha256 fallback
But still prefer shasum/sha256sum where present.
| -rw-r--r-- | Library/Homebrew/cmd/vendor-install.sh | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Library/Homebrew/cmd/vendor-install.sh b/Library/Homebrew/cmd/vendor-install.sh index 46f0c72f9..fe7e26dd4 100644 --- a/Library/Homebrew/cmd/vendor-install.sh +++ b/Library/Homebrew/cmd/vendor-install.sh @@ -82,6 +82,15 @@ fetch() { elif [[ -x "$(which sha256sum)" ]] then sha="$(sha256sum "$CACHED_LOCATION" | cut -d' ' -f1)" + elif [[ -x "$(which ruby)" ]] + then + sha="$(ruby <<EOSCRIPT + require 'digest/sha2' + digest = Digest::SHA256.new + File.open('$CACHED_LOCATION', 'rb') { |f| digest.update(f.read) } + puts digest.hexdigest +EOSCRIPT +)" else odie "Cannot verify the checksum ('shasum' or 'sha256sum' not found)!" fi |
