diff options
Diffstat (limited to 'Library/Homebrew/cmd/vendor-install.sh')
| -rw-r--r-- | Library/Homebrew/cmd/vendor-install.sh | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/Library/Homebrew/cmd/vendor-install.sh b/Library/Homebrew/cmd/vendor-install.sh index 8f08e49fb..fe7e26dd4 100644 --- a/Library/Homebrew/cmd/vendor-install.sh +++ b/Library/Homebrew/cmd/vendor-install.sh @@ -39,10 +39,10 @@ fetch() { if [[ -n "$HOMEBREW_QUIET" ]] then - curl_args+=(--silent) + curl_args[${#curl_args[*]}]="--silent" elif [[ -z "$HOMEBREW_VERBOSE" ]] then - curl_args+=(--progress-bar) + curl_args[${#curl_args[*]}]="--progress-bar" fi temporary_path="$CACHED_LOCATION.incomplete" @@ -76,12 +76,21 @@ fetch() { trap - SIGINT fi - if [[ -n "$(which shasum)" ]] + if [[ -x "$(which shasum)" ]] then sha="$(shasum -a 256 "$CACHED_LOCATION" | cut -d' ' -f1)" - elif [[ -n "$(which sha256sum)" ]] + 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 |
