31 lines
826 B
Cheetah
31 lines
826 B
Cheetah
|
|
#!/bin/bash
|
||
|
|
# Install Rust toolchain via rustup
|
||
|
|
# This script runs once before other chezmoi operations
|
||
|
|
|
||
|
|
set -e
|
||
|
|
|
||
|
|
echo "==> Installing Rust toolchain..."
|
||
|
|
|
||
|
|
# Install rustup if not present
|
||
|
|
if ! command -v rustup &> /dev/null; then
|
||
|
|
echo "==> Installing rustup..."
|
||
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path
|
||
|
|
|
||
|
|
# Source cargo environment for this script
|
||
|
|
source "$HOME/.cargo/env"
|
||
|
|
else
|
||
|
|
echo "==> rustup already installed, updating..."
|
||
|
|
rustup update
|
||
|
|
fi
|
||
|
|
|
||
|
|
# Ensure stable toolchain is installed
|
||
|
|
rustup default stable
|
||
|
|
|
||
|
|
# Install common Rust components
|
||
|
|
echo "==> Installing Rust components..."
|
||
|
|
rustup component add rustfmt clippy rust-analyzer
|
||
|
|
|
||
|
|
echo "==> Rust toolchain installed successfully!"
|
||
|
|
echo " rustc: $(rustc --version)"
|
||
|
|
echo " cargo: $(cargo --version)"
|