Skip to content

Instantly share code, notes, and snippets.

@kazuakiishiguro
Last active October 19, 2020 01:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kazuakiishiguro/00a8fe4c6099dc01941d07ec5e83c8c6 to your computer and use it in GitHub Desktop.
Save kazuakiishiguro/00a8fe4c6099dc01941d07ec5e83c8c6 to your computer and use it in GitHub Desktop.
rust install and update script
#!/bin/bash
set -eu
echo "Installing rust"
if !(type "cargo" > /dev/null 2>&1); then
curl https://sh.rustup.rs -sSf | sh
source ~/.bashrc
else
echo "Rust already installed"
fi
which rustc
rustc --version
echo "rustc settings"
rustup component add rust-src
rustup toolchain add nightly
echo "Installing cargo packages"
echo "cargo install crates....."
PACKAGES=(cargo-edit cargo-update cargo-watch racer)
for item in ${PACKAGES[@]}; do
if !(cargo install --list | grep $item > /dev/null); then
cargo install $item
fi
done
COMPONENTS=(rustfmt clippy)
for item in ${COMPONENTS[@]}; do
if !(rustup component list | grep $item > /dev/null); then
rustup component add $item
fi
done
echo "Install finished 🦀"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment