2020-10-07 13:49:40 +05:00
|
|
|
#!/bin/bash -e
|
2019-12-13 09:48:00 -05:00
|
|
|
################################################################################
|
|
|
|
|
## File: rust.sh
|
|
|
|
|
## Desc: Installs Rust
|
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
|
|
# Source the helpers for use with the script
|
2020-04-14 13:23:44 +05:00
|
|
|
source $HELPER_SCRIPTS/etc-environment.sh
|
2019-12-13 09:48:00 -05:00
|
|
|
|
|
|
|
|
export RUSTUP_HOME=/usr/share/rust/.rustup
|
|
|
|
|
export CARGO_HOME=/usr/share/rust/.cargo
|
|
|
|
|
|
2020-03-23 07:54:11 +07:00
|
|
|
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain=stable --profile=minimal
|
2019-12-13 09:48:00 -05:00
|
|
|
|
2020-03-02 14:13:53 +03:00
|
|
|
# Initialize environment variables
|
2019-12-13 09:48:00 -05:00
|
|
|
source $CARGO_HOME/env
|
|
|
|
|
|
|
|
|
|
# Install common tools
|
2020-03-23 07:54:11 +07:00
|
|
|
rustup component add rustfmt clippy
|
2021-01-25 20:55:03 +03:00
|
|
|
cargo install --locked bindgen cbindgen cargo-audit cargo-outdated
|
2019-12-13 09:48:00 -05:00
|
|
|
|
|
|
|
|
# Permissions
|
|
|
|
|
chmod -R 777 $(dirname $RUSTUP_HOME)
|
|
|
|
|
|
2020-05-25 12:25:41 +03:00
|
|
|
# Cleanup Cargo cache
|
2020-07-13 12:16:14 +03:00
|
|
|
rm -rf ${CARGO_HOME}/registry/*
|
2020-05-25 12:25:41 +03:00
|
|
|
|
2020-04-14 13:23:44 +05:00
|
|
|
# Update /etc/environemnt
|
|
|
|
|
prependEtcEnvironmentPath "${CARGO_HOME}/bin"
|
|
|
|
|
|
2019-12-13 09:48:00 -05:00
|
|
|
# Rust Symlinks are added to a default profile /etc/skel
|
|
|
|
|
pushd /etc/skel
|
|
|
|
|
ln -sf $RUSTUP_HOME .rustup
|
|
|
|
|
ln -sf $CARGO_HOME .cargo
|
|
|
|
|
popd
|
2020-12-28 11:34:32 +03:00
|
|
|
|
|
|
|
|
invoke_tests "Tools" "Rust"
|