migrate: stow → chezmoi
- 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)
This commit is contained in:
+9
-26
@@ -1,34 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
PACKAGES=("zsh" "tmux" "alacritty" "stow" "sshuttle" "eza" "zoxide")
|
||||
PACKAGES=("zsh" "tmux" "alacritty" "chezmoi" "age" "eza" "zoxide")
|
||||
|
||||
# Detect package manager and install.
|
||||
detect_and_install() {
|
||||
if command -v apt &>/dev/null; then
|
||||
echo "Detected: apt (Debian/Ubuntu)"
|
||||
sudo apt update
|
||||
sudo apt install -y "${PACKAGES[@]}"
|
||||
sudo apt update && sudo apt install -y "${PACKAGES[@]}"
|
||||
elif command -v pacman &>/dev/null; then
|
||||
echo "Detected: pacman (Arch)"
|
||||
sudo pacman -Syu --noconfirm "${PACKAGES[@]}"
|
||||
elif command -v dnf &>/dev/null; then
|
||||
echo "Detected: dnf (Fedora/RHEL)"
|
||||
sudo dnf install -y "${PACKAGES[@]}"
|
||||
elif command -v zypper &>/dev/null; then
|
||||
echo "Detected: zypper (openSUSE)"
|
||||
sudo zypper install -y "${PACKAGES[@]}"
|
||||
elif command -v brew &>/dev/null; then
|
||||
echo "Detected: brew (macOS)"
|
||||
brew install "${PACKAGES[@]}"
|
||||
else
|
||||
echo "Error: No supported package manager found"
|
||||
echo "Error: no supported package manager found"
|
||||
echo "Please install: ${PACKAGES[*]}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Check if all packages are already installed.
|
||||
check_installed() {
|
||||
local missing=()
|
||||
for pkg in "${PACKAGES[@]}"; do
|
||||
@@ -36,36 +26,29 @@ check_installed() {
|
||||
missing+=("$pkg")
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ ${#missing[@]} -gt 0 ]]; then
|
||||
echo "Missing packages: ${missing[*]}"
|
||||
echo "Missing: ${missing[*]}"
|
||||
detect_and_install
|
||||
else
|
||||
echo "All required packages already installed."
|
||||
fi
|
||||
}
|
||||
|
||||
check_installed
|
||||
|
||||
# Basic setup for this dotfiles repo.
|
||||
mkdir -p "$HOME/.ssh/sockets"
|
||||
echo "Created ~/.ssh/sockets"
|
||||
|
||||
# Apply all stow packages.
|
||||
cd "$(dirname "$0")"
|
||||
echo "Running: stow -t $HOME */"
|
||||
stow -t "$HOME" */
|
||||
# Apply dotfiles via chezmoi
|
||||
DOTFILES_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
chezmoi apply --source "$DOTFILES_DIR"
|
||||
|
||||
# Set zsh as default shell.
|
||||
# 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 changed to: $zsh_path"
|
||||
echo "Default shell: $zsh_path"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user