dotfiles/install/install.sh
Brian Pooe c3cd129478 feat: manage bat and Claude Code configs; add --unlink mode
- New managed configs: .config/bat (ANSI theme so bat follows the
  terminal palette) and .claude/settings.json, with a .gitignore guard
  so only settings.json under .claude/ is trackable.
- dotfiles.sh: drive linking from a single link map and add
  unlink_dotfiles; install.sh grows --unlink to cleanly remove every
  symlink pointing into the repo.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-06 21:17:37 +02:00

94 lines
2.6 KiB
Bash
Executable file

#!/bin/bash
# Pop!_OS / Ubuntu installer for these dotfiles.
#
# What it does (idempotent — safe to re-run):
# 1. apt: system base + Mason prerequisites (Python venv/pip, LuaRocks).
# 2. Vendor apt repos: WezTerm, Brave Beta (GUI apps stay on apt).
# 3. Homebrew + Brewfile: fzf, fd, bat, eza, zoxide, ripgrep, tmux,
# neovim, lazygit, starship, gh, zsh plugins — always latest,
# updated later with a single `brew upgrade`.
# 4. nvm + latest LTS Node.js + tmux plugin manager (tpm).
# 5. Symlinks dotfiles into ~ and ~/.config.
# 6. Switches login shell to zsh.
#
# Usage:
# install/install.sh Full install
# install/install.sh --packages-only Only packages/tools (apt + brew)
# install/install.sh --dotfiles-only Only link dotfiles + tpm/nvm + chsh
# install/install.sh --unlink Remove symlinks pointing into this repo
# install/install.sh --help
set -eEo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/lib/common.sh"
source "$SCRIPT_DIR/lib/packages.sh"
source "$SCRIPT_DIR/lib/brew.sh"
source "$SCRIPT_DIR/lib/extras.sh"
source "$SCRIPT_DIR/lib/fonts.sh"
source "$SCRIPT_DIR/lib/dotfiles.sh"
usage() {
sed -n '2,19p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'
}
MODE=all
for arg in "$@"; do
case $arg in
--packages-only) MODE=packages ;;
--dotfiles-only) MODE=dotfiles ;;
--unlink) MODE="unlink" ;;
-h | --help)
usage
exit 0
;;
*) die "Unknown argument: $arg (try --help)" ;;
esac
done
preflight() {
command -v apt-get >/dev/null 2>&1 || die "apt-get not found — this installer targets Debian/Ubuntu/Pop!_OS."
((EUID != 0)) || die "Do not run as root; run as your regular user."
require_cmd sudo
require_cmd curl
require_cmd sha256sum
}
main() {
# Unlinking only removes symlinks; skip preflight and the closing hints.
if [[ $MODE == unlink ]]; then
unlink_dotfiles
return
fi
preflight
case $MODE in
packages)
install_all_packages
install_brew_packages
install_all_extras
install_nerd_font
;;
dotfiles)
link_dotfiles
install_tpm
install_nvm
set_zsh_as_shell
;;
all)
install_all_packages
install_brew_packages
install_all_extras
install_nerd_font
link_dotfiles
set_zsh_as_shell
;;
esac
info "Done. Open a new shell (or log out + back in) to pick up the new login shell."
info "First tmux launch: prefix + I to fetch tpm plugins."
info "Keep tools current with: brew upgrade && sudo apt update && sudo apt upgrade -y"
}
main