#!/usr/bin/env bash set -euo pipefail PACKAGES=("zsh" "tmux" "alacritty" "kitty" "chezmoi" "age" "fzf" "fd" "bat" "ripgrep" "eza" "zoxide" "htop") detect_and_install() { if command -v apt &>/dev/null; then sudo apt update && sudo apt install -y "${PACKAGES[@]}" elif command -v pacman &>/dev/null; then sudo pacman -Syu --noconfirm "${PACKAGES[@]}" elif command -v dnf &>/dev/null; then sudo dnf install -y "${PACKAGES[@]}" elif command -v brew &>/dev/null; then brew install "${PACKAGES[@]}" else echo "Error: no supported package manager found" echo "Please install: ${PACKAGES[*]}" exit 1 fi } check_installed() { local missing=() for pkg in "${PACKAGES[@]}"; do if ! command -v "$pkg" &>/dev/null; then missing+=("$pkg") fi done if [[ ${#missing[@]} -gt 0 ]]; then echo "Missing: ${missing[*]}" detect_and_install fi } check_installed mkdir -p "$HOME/.ssh/sockets" # Apply dotfiles via chezmoi DOTFILES_DIR="$(cd "$(dirname "$0")" && pwd)" chezmoi apply --source "$DOTFILES_DIR" # Set zsh as default shell set_default_shell() { local zsh_path zsh_path=$(command -v zsh) read -p "Set zsh as default shell? (y/n) " -n 1 -r echo if [[ $REPLY =~ ^[Yy]$ ]]; then chsh -s "$zsh_path" echo "Default shell: $zsh_path" fi } set_default_shell echo "Bootstrap complete!"