-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinstall_rust.sh
More file actions
executable file
·29 lines (21 loc) · 855 Bytes
/
install_rust.sh
File metadata and controls
executable file
·29 lines (21 loc) · 855 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
# This script installs the necessary requirements for building Rust projects.
# Exit script if any command fails
set -e
# Check if Rust is already installed by looking for the 'cargo' command.
if command -v cargo &> /dev/null
then
echo "Rust is already installed."
else
echo "Rust is not installed. Installing Rust..."
# Install Rust using rustup. The '-y' flag automates the installation.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
# Add cargo to the current shell's PATH.
source "$HOME/.cargo/env"
echo "Rust has been installed successfully."
fi
# Verify the installation by checking the versions of rustc and cargo.
echo "Verifying installation..."
rustc --version
cargo --version
echo "All requirements for building Rust sources are installed and ready to use."