7c8a4893de
- restructure repo to chezmoi conventions (dot_ prefix, private_dot_ssh/) - add nvim config (was untracked) - encrypt restic pass.txt with age - remove stow artifacts (.stow-local-ignore, stow package dirs) - update bootstrap.sh to use chezmoi apply - remove runtime files from tracking (micro buffers, zed backup)
57 lines
1.4 KiB
Bash
Executable File
57 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
PACKAGES=("zsh" "tmux" "alacritty" "chezmoi" "age" "eza" "zoxide")
|
|
|
|
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!"
|