mirror of
https://github.com/actions/runner-images.git
synced 2025-12-14 05:07:02 +00:00
* migrate rust * Migrate PHP composer * Migrate dotnet core sdk * rename `var_*` to `variable_*` * rename *etcEnvironmentVar functions to *etcEnvironmentVariable * add AppendEtcEnvironmentVariable and PrependEtcEnvironmentVariable * rename addEtcEnvironmentPathElement to prependEtcEnvironmentPath * Remove updatepath.sh Co-authored-by: Sergey Dolin <v-sedoli@micorosoft.com>
54 lines
1.9 KiB
Bash
54 lines
1.9 KiB
Bash
#!/bin/bash
|
|
################################################################################
|
|
## File: rust.sh
|
|
## Desc: Installs Rust
|
|
################################################################################
|
|
|
|
# Source the helpers for use with the script
|
|
source $HELPER_SCRIPTS/etc-environment.sh
|
|
source $HELPER_SCRIPTS/document.sh
|
|
|
|
export RUSTUP_HOME=/usr/share/rust/.rustup
|
|
export CARGO_HOME=/usr/share/rust/.cargo
|
|
|
|
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain=stable --profile=minimal
|
|
|
|
# Initialize environment variables
|
|
source $CARGO_HOME/env
|
|
|
|
# Install common tools
|
|
rustup component add rustfmt clippy
|
|
cargo install bindgen cbindgen
|
|
|
|
echo "Test installation of the Rust toochain"
|
|
|
|
# Permissions
|
|
chmod -R 777 $(dirname $RUSTUP_HOME)
|
|
|
|
for cmd in rustup rustc rustdoc cargo rustfmt cargo-clippy bindgen cbindgen; do
|
|
if ! command -v $cmd --version; then
|
|
echo "$cmd was not installed or is not found on the path"
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
# Update /etc/environemnt
|
|
prependEtcEnvironmentPath "${CARGO_HOME}/bin"
|
|
|
|
# Rust Symlinks are added to a default profile /etc/skel
|
|
pushd /etc/skel
|
|
ln -sf $RUSTUP_HOME .rustup
|
|
ln -sf $CARGO_HOME .cargo
|
|
popd
|
|
|
|
# Document what was added to the image
|
|
echo "Lastly, document what was added to the metadata file"
|
|
DocumentInstalledItem "rustup ($(rustup --version 2>&1 | cut -d ' ' -f 2))"
|
|
DocumentInstalledItem "rust ($(rustc --version 2>&1 | cut -d ' ' -f 2))"
|
|
DocumentInstalledItem "cargo ($(cargo --version 2>&1 | cut -d ' ' -f 2))"
|
|
DocumentInstalledItem "rustfmt ($(rustfmt --version 2>&1 | cut -d ' ' -f 2))"
|
|
DocumentInstalledItem "clippy ($(cargo-clippy --version 2>&1 | cut -d ' ' -f 2))"
|
|
DocumentInstalledItem "rustdoc ($(rustdoc --version 2>&1 | cut -d ' ' -f 2))"
|
|
DocumentInstalledItem "bindgen ($(bindgen --version 2>&1 | cut -d ' ' -f 2))"
|
|
DocumentInstalledItem "cbindgen ($(cbindgen --version 2>&1 | cut -d ' ' -f 2))"
|