Add setup/modules/shell-setup-new.sh
parent
c6f3b54cc5
commit
85212e3919
|
|
@ -0,0 +1,136 @@
|
|||
|
||||
#!/bin/bash
|
||||
set -e # Exit on error
|
||||
|
||||
#="\e[0m"# Colors for better UX
|
||||
|
||||
log() { echo -e "${GREEN}✔ $1${RESET}"; }
|
||||
skip() { echo -e "${YELLOW}↷ $1${RESET}"; }
|
||||
|
||||
# Update system
|
||||
log "Updating system..."
|
||||
sudo pacman -Syu --noconfirm
|
||||
|
||||
# Install base packages (including nvim)
|
||||
PACKAGES=(zsh neovim curl pyright bash atftp bash-language-server btop clang fastfetch fzf hyfetch lua-language-server micro nano pulsemixer yazi z qrencode distrobox dysk python python-pip)
|
||||
for pkg in "${PACKAGES[@]}"; do
|
||||
if ! pacman -Qi "$pkg" &>/dev/null; then
|
||||
log "Installing $pkg..."
|
||||
sudo pacman -S --noconfirm "$pkg"
|
||||
else
|
||||
skip "$pkg already installed."
|
||||
fi
|
||||
done
|
||||
|
||||
# Install yay if not installed
|
||||
if ! command -v yay &>/dev/null; then
|
||||
log "Installing yay..."
|
||||
sudo pacman -S --noconfirm git base-devel
|
||||
git clone https://aur.archlinux.org/yay.git /tmp/yay
|
||||
cd /tmp/yay && makepkg -si --noconfirm
|
||||
cd ~
|
||||
else
|
||||
skip "yay already installed."
|
||||
fi
|
||||
|
||||
# Install Rust & Cargo if not installed
|
||||
if ! command -v cargo &>/dev/null; then
|
||||
log "Installing Rust & Cargo..."
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
||||
source "$HOME/.cargo/env"
|
||||
else
|
||||
skip "Rust & Cargo already installed."
|
||||
fi
|
||||
|
||||
# Install nvm and Node.js if not installed
|
||||
if ! command -v node &>/dev/null; then
|
||||
log "Installing nvm and Node.js..."
|
||||
if [ ! -d "$HOME/.nvm" ]; then
|
||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.2/install.sh | bash
|
||||
fi
|
||||
source "$HOME/.nvm/nvm.sh"
|
||||
nvm install 22
|
||||
else
|
||||
skip "Node.js already installed."
|
||||
fi
|
||||
|
||||
# Verify npm
|
||||
if ! command -v npm &>/dev/null; then
|
||||
log "npm should be installed with Node.js. Please check your PATH."
|
||||
else
|
||||
skip "npm already available."
|
||||
fi
|
||||
|
||||
# Git config
|
||||
git config --global core.editor nvim
|
||||
|
||||
# Dotfiles setup
|
||||
log "Setting up dotfiles..."
|
||||
mkdir -p ~/.config ~/Pictures
|
||||
|
||||
ln -sf ~/Dotfiles/.bashrc ~/.bashrc
|
||||
ln -sf ~/Dotfiles/.zshrc ~/.zshrc
|
||||
ln -sf ~/Dotfiles/starship.toml ~/.config/starship.toml
|
||||
|
||||
rm -rf ~/.config/micro
|
||||
cp -r ~/Dotfiles/micro ~/.config/
|
||||
|
||||
# Vim Plug installer
|
||||
if [ ! -f ~/.local/share/nvim/site/autoload/plug.vim ]; then
|
||||
curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \
|
||||
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||
fi
|
||||
|
||||
rm -rf ~/.config/nvim
|
||||
ln -sf ~/Dotfiles/nvim ~/.config/nvim
|
||||
mkdir -p ~/.local/share/nvim/site/plugged/vim-airline-themes/autoload/airline/themes
|
||||
cp -f ~/Dotfiles/nvim/cyberqueer.vim ~/.local/share/nvim/site/plugged/vim-airline-themes/autoload/airline/themes/
|
||||
|
||||
rm -rf ~/.config/yazi
|
||||
ln -sf ~/Dotfiles/yazi ~/.config/yazi
|
||||
|
||||
rm -rf ~/.config/spotify-tui
|
||||
ln -sf ~/Dotfiles/spotify-tui ~/.config/spotify-tui
|
||||
|
||||
cp -f ~/Dotfiles/resources/fflogo.svg ~/Pictures/fflogo.svg
|
||||
|
||||
# Install Starship if not installed
|
||||
if ! command -v starship &>/dev/null; then
|
||||
log "Installing Starship..."
|
||||
curl -sS https://starship.rs/install.sh | sh
|
||||
else
|
||||
skip "Starship already installed."
|
||||
fi
|
||||
|
||||
# Install oh-my-zsh if not installed
|
||||
if [ ! -d "$HOME/.oh-my-zsh" ]; then
|
||||
log "Installing oh-my-zsh..."
|
||||
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
|
||||
else
|
||||
skip "oh-my-zsh already installed."
|
||||
fi
|
||||
|
||||
# Install oh-my-zsh plugins if not installed
|
||||
ZSH_CUSTOM=${ZSH_CUSTOM:-~/.oh-my-zsh/custom}
|
||||
if [ ! -d "$ZSH_CUSTOM/plugins/zsh-syntax-highlighting" ]; then
|
||||
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git "$ZSH_CUSTOM/plugins/zsh-syntax-highlighting"
|
||||
else
|
||||
skip "zsh-syntax-highlighting already installed."
|
||||
fi
|
||||
if [ ! -d "$ZSH_CUSTOM/plugins/zsh-autosuggestions" ]; then
|
||||
git clone https://github.com/zsh-users/zsh-autosuggestions "$ZSH_CUSTOM/plugins/zsh-autosuggestions"
|
||||
else
|
||||
skip "zsh-autosuggestions already installed."
|
||||
fi
|
||||
|
||||
# Set zsh as default shell if not already
|
||||
if [ "$SHELL" != "/usr/bin/zsh" ]; then
|
||||
log "Setting zsh as default shell..."
|
||||
chsh -s /usr/bin/zsh
|
||||
else
|
||||
skip "zsh is already the default shell."
|
||||
fi
|
||||
|
||||
log "✅ Setup complete!"
|
||||
GREEN="\e[32m"
|
||||
YELLOW="\e[33m"
|
||||
Loading…
Reference in New Issue