Update setup.sh
This commit is contained in:
parent
298618d148
commit
7bdbe85913
1 changed files with 57 additions and 8 deletions
65
setup.sh
65
setup.sh
|
@ -1,9 +1,58 @@
|
||||||
sudo apt update; sudo apt upgrade
|
#!/bin/bash
|
||||||
sudo add-apt-repository ppa:zhangsongcui3371/fastfetch
|
|
||||||
|
# Exit immediately if a command exits with a non-zero status.
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# --- 1. System Preparation ---
|
||||||
|
echo "▶️ Starting system preparation..."
|
||||||
sudo apt update
|
sudo apt update
|
||||||
sudo apt install fastfetch
|
echo "▶️ Upgrading system packages. This may take a while..."
|
||||||
sudo apt install btop zoxide bat
|
sudo apt upgrade -y
|
||||||
zoxide init bash >> ~/.bashrc
|
|
||||||
source ~/.bashrc
|
echo "▶️ Installing essential dependencies for Homebrew..."
|
||||||
sudo apt install -y ca-certificates curl gnupg lsb-release
|
# build-essential is recommended by Homebrew for compiling packages
|
||||||
sudo mkdir -p /etc/apt/keyrings
|
sudo apt install -y build-essential procps curl file git ca-certificates gnupg lsb-release
|
||||||
|
|
||||||
|
# --- 2. 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
|
||||||
|
|
||||||
|
# --- 3. 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
|
||||||
|
|
||||||
|
# --- 4. Install Packages via Homebrew ---
|
||||||
|
echo "▶️ Installing packages with Homebrew..."
|
||||||
|
brew install zoxide btop nvtop bat fastfetch
|
||||||
|
|
||||||
|
# --- 5. Finalizing ---
|
||||||
|
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"
|
Loading…
Add table
Add a link
Reference in a new issue