2020-10-07 13:49:40 +05:00
|
|
|
#!/bin/bash -e
|
2019-12-13 09:48:00 -05:00
|
|
|
################################################################################
|
2023-11-22 21:49:23 +01:00
|
|
|
## File: install-rust.sh
|
|
|
|
|
## Desc: Install Rust
|
2019-12-13 09:48:00 -05:00
|
|
|
################################################################################
|
|
|
|
|
|
|
|
|
|
# Source the helpers for use with the script
|
2020-04-14 13:23:44 +05:00
|
|
|
source $HELPER_SCRIPTS/etc-environment.sh
|
2022-05-02 10:46:10 +02:00
|
|
|
source $HELPER_SCRIPTS/os.sh
|
2019-12-13 09:48:00 -05:00
|
|
|
|
2021-11-26 12:39:13 +03:00
|
|
|
export RUSTUP_HOME=/etc/skel/.rustup
|
|
|
|
|
export CARGO_HOME=/etc/skel/.cargo
|
2019-12-13 09:48:00 -05:00
|
|
|
|
2023-07-28 20:18:41 +02:00
|
|
|
curl -fsSL https://sh.rustup.rs | 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
|
2022-05-02 10:46:10 +02:00
|
|
|
|
2023-12-26 12:50:52 +01:00
|
|
|
if is_ubuntu22; then
|
2025-04-05 02:26:31 +05:30
|
|
|
cargo install --locked bindgen-cli cbindgen cargo-audit cargo-outdated
|
2024-04-26 23:18:26 +02:00
|
|
|
fi
|
|
|
|
|
|
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
|
|
|
|
2024-03-14 10:53:11 +01:00
|
|
|
# Update /etc/environment
|
2023-12-26 12:50:52 +01:00
|
|
|
prepend_etc_environment_path '$HOME/.cargo/bin'
|
2020-12-28 11:34:32 +03:00
|
|
|
|
2021-11-26 12:39:13 +03:00
|
|
|
invoke_tests "Tools" "Rust"
|