Last active
August 29, 2015 14:04
-
-
Save devyn/2b73d52d913abec983a4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| PACKAGE_URL="http://static.rust-lang.org/dist/rust-nightly-x86_64-unknown-linux-gnu.tar.gz" | |
| INSTALL_TO="$HOME/.bin/rust" | |
| die() { | |
| echo -e "\e[1m\e[31merror: \e[0;1m$*\e[0m" 1>&2 | |
| exit 1 | |
| } | |
| cd /tmp | |
| mkdir update-rust.$$ || die "failed to create directory in /tmp" | |
| cd update-rust.$$ | |
| echo "Updating rust..." | |
| echo " (temp dir at `pwd`)" | |
| echo | |
| curl -#o rust.tar.gz "$PACKAGE_URL" || die "curl failed" | |
| tar xf rust.tar.gz || die "extraction failed" | |
| cd rust-* || die "rust not found" | |
| rm -r "$HOME/.bin/rust" || die "failed to remove old version" | |
| ./install.sh --prefix="$INSTALL_TO" || die "failed to install" | |
| cd ../.. | |
| rm -r update-rust.$$ || die "failed to clean up" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment