Skip to content

Instantly share code, notes, and snippets.

@errordeveloper
Last active October 7, 2015 13:42
Show Gist options
  • Save errordeveloper/2ca2c403376edd5615b7 to your computer and use it in GitHub Desktop.
Save errordeveloper/2ca2c403376edd5615b7 to your computer and use it in GitHub Desktop.
#!/bin/sh -x
TARGET_TUPLE='x86_64-apple-darwin'
RUST_TARBALL="rust-nightly-${TARGET_TUPLE}.tar.gz"
CARGO_TARBALL="cargo-nightly-${TARGET_TUPLE}.tar.gz"
(cd /tmp; curl -O --retry 3 \
"http://static.rust-lang.org/{dist/${RUST_TARBALL},cargo-dist/${CARGO_TARBALL}}")
CHECKSUM=$(openssl sha1 /tmp/${RUST_TARBALL} | cut -d ' ' -f2)
cd ~/Library/Local/Rust
OUTPUT=${PWD}/versions/${CHECKSUM}/
test -d ${OUTPUT} \
&& {
exit 1;
} || {
mkdir ${OUTPUT};
tar xvf /tmp/${RUST_TARBALL} -C ${OUTPUT}/;
tar xvf /tmp/${CARGO_TARBALL} -C ${OUTPUT}/;
unlink ./current-rust
unlink ./current-cargo
ln -s ${OUTPUT}/$(basename ${RUST_TARBALL} .tar.gz) ./current-rust
ln -s ${OUTPUT}/$(basename ${CARGO_TARBALL} .tar.gz) ./current-cargo
exit 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment