Skip to content

rustup: add support for caching of old nightlies, download resumption and verification #19927

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
rustup: allow the use of either sha256sum or shasum to verify the dow…
…nload hash
  • Loading branch information
erickt committed Dec 29, 2014
commit 6465cb85a73fc1f0465d56867d6c3cee71d44b67
18 changes: 16 additions & 2 deletions src/etc/rustup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,21 @@ create_tmp_dir() {
probe_need CFG_CURL curl
probe_need CFG_TAR tar
probe_need CFG_FILE file
probe_need CFG_SHASUM shasum

probe CFG_SHA256SUM sha256sum
probe CFG_SHASUM shasum

if [ -z "$CFG_SHA256SUM" -a -z "$CFG_SHASUM" ]; then
err "unable to find either sha256sum or shasum"
fi

calculate_hash() {
if [ -n "$CFG_SHA256SUM" ]; then
${CFG_SHA256SUM} $@
else
${CFG_SHASUM} -a 256 $@
fi
}

CFG_SRC_DIR="$(cd $(dirname $0) && pwd)/"
CFG_SELF="$0"
Expand Down Expand Up @@ -474,7 +488,7 @@ verify_hash() {
fi

msg "Verifying hash"
local_sha256=`"${CFG_SHASUM}" -a 256 "${local_file}"`
local_sha256=$(calculate_hash "${local_file}")
if [ "$?" -ne 0 ]; then
rm -Rf "${CFG_TMP_DIR}"
err "Failed to compute hash for ${local_tarball}"
Expand Down