75 lines
No EOL
2.7 KiB
Bash
75 lines
No EOL
2.7 KiB
Bash
#!/bin/bash
|
|
|
|
# Exit immediately if a command exits with a non-zero status.
|
|
set -e
|
|
|
|
# --- 1. System Preparation ---
|
|
echo "▶️ Starting system preparation..."
|
|
sudo apt update
|
|
echo "▶️ Upgrading system packages. This may take a while..."
|
|
sudo apt upgrade -y
|
|
|
|
echo "▶️ Installing essential dependencies for Homebrew..."
|
|
# build-essential is recommended by Homebrew for compiling packages
|
|
sudo apt install -y build-essential procps curl file git ca-certificates gnupg lsb-release
|
|
|
|
# --- 2. Rust Installation ---
|
|
echo "▶️ Installing Rust..."
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
|
source $HOME/.cargo/env
|
|
|
|
echo "▶️ Installing additional build dependencies for Rust packages..."
|
|
sudo apt-get install -y libssl-dev pkg-config
|
|
|
|
# --- 3. Homebrew Installation ---
|
|
# Check if Homebrew is already installed before proceeding
|
|
if command -v brew &>/dev/null; then
|
|
echo "✅ Homebrew is already installed. Skipping installation."
|
|
else
|
|
echo "▶️ Installing Homebrew..."
|
|
# Use the NONINTERACTIVE flag to prevent the script from pausing for user input.
|
|
NONINTERACTIVE=1 /bin/bash -c \
|
|
"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
|
fi
|
|
|
|
# --- 4. Configure Homebrew Environment ---
|
|
# The Homebrew installer adds its configuration path to .profile.
|
|
# We need to source it to make the 'brew' command available in this script session.
|
|
# This setup works for standard Linux installations.
|
|
echo "▶️ Configuring shell environment for Homebrew..."
|
|
if [ -f "/home/linuxbrew/.linuxbrew/bin/brew" ]; then
|
|
# Add Homebrew to PATH for the current script execution
|
|
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
|
|
|
|
# Add Homebrew to your .bashrc for future sessions, if not already present
|
|
if ! grep -q 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' ~/.bashrc; then
|
|
echo '' >>~/.bashrc
|
|
echo '# Add Homebrew to PATH' >>~/.bashrc
|
|
echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >>~/.bashrc
|
|
echo "✅ Homebrew environment configured in ~/.bashrc for future sessions."
|
|
else
|
|
echo "✅ Homebrew environment already configured in ~/.bashrc."
|
|
fi
|
|
else
|
|
echo "❌ Could not find Homebrew installation. Exiting."
|
|
exit 1
|
|
fi
|
|
|
|
# --- 5. Install Packages via Homebrew ---
|
|
echo "▶️ Installing packages with Homebrew..."
|
|
brew install zoxide btop nvtop bat fastfetch gcc eza
|
|
|
|
# --- 6. Zoxide Init ---
|
|
zoxide init bash >> ~/.bashrc
|
|
source ~/.bashrc
|
|
|
|
# --- 7. Atuin ---
|
|
curl --proto '=https' --tlsv1.2 -LsSf https://setup.atuin.sh | sh
|
|
source $HOME/.atuin/bin/env
|
|
|
|
# --- 8. Finalizing ---
|
|
source ~/.bashrc
|
|
echo ""
|
|
echo "🎉 All done! Your new tools have been installed."
|
|
echo "To start using them, please open a new terminal or run:"
|
|
echo "source ~/.bashrc" |