Initial dotfiles: portable shell configs, Brewfile, and setup guide
Cleaned up for new machine portability: removed hardcoded paths, EOL packages, and redundant version managers. Consolidated NVM loading, added work git identity support via includeIf. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
64
install.sh
Executable file
64
install.sh
Executable file
@@ -0,0 +1,64 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
DOTFILES_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
|
||||
# Colors for output
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
RED='\033[0;31m'
|
||||
NC='\033[0m'
|
||||
|
||||
info() { echo -e "${GREEN}[OK]${NC} $1"; }
|
||||
warn() { echo -e "${YELLOW}[SKIP]${NC} $1"; }
|
||||
err() { echo -e "${RED}[ERROR]${NC} $1"; }
|
||||
|
||||
link_file() {
|
||||
local src="$DOTFILES_DIR/$1"
|
||||
local dest="$HOME/$2"
|
||||
local dest_dir
|
||||
dest_dir="$(dirname "$dest")"
|
||||
|
||||
# Create parent directory if needed
|
||||
[[ -d "$dest_dir" ]] || mkdir -p "$dest_dir"
|
||||
|
||||
if [[ -L "$dest" ]]; then
|
||||
# Already a symlink — update it
|
||||
rm "$dest"
|
||||
ln -s "$src" "$dest"
|
||||
info "Updated symlink: $dest -> $src"
|
||||
elif [[ -e "$dest" ]]; then
|
||||
# Real file exists — back it up
|
||||
mv "$dest" "${dest}.backup.$(date +%s)"
|
||||
ln -s "$src" "$dest"
|
||||
warn "Backed up existing $dest and created symlink"
|
||||
else
|
||||
ln -s "$src" "$dest"
|
||||
info "Created symlink: $dest -> $src"
|
||||
fi
|
||||
}
|
||||
|
||||
echo ""
|
||||
echo "=== Dotfiles Installer ==="
|
||||
echo "This will symlink dotfiles from $DOTFILES_DIR into your home directory."
|
||||
echo "Existing files will be backed up with a .backup.* suffix."
|
||||
echo ""
|
||||
|
||||
# Symlink dotfiles
|
||||
link_file "zshrc" ".zshrc"
|
||||
link_file "zshenv" ".zshenv"
|
||||
link_file "p10k.zsh" ".p10k.zsh"
|
||||
link_file "bashrc" ".bashrc"
|
||||
link_file "bash_profile" ".bash_profile"
|
||||
link_file "profile" ".profile"
|
||||
link_file "gitconfig" ".gitconfig"
|
||||
link_file "gitignore_global" ".gitignore_global"
|
||||
link_file "fzf.zsh" ".fzf.zsh"
|
||||
|
||||
echo ""
|
||||
echo "=== Symlinks complete ==="
|
||||
echo ""
|
||||
echo "Next steps:"
|
||||
echo " 1. Run: source ~/.zshrc"
|
||||
echo " 2. Run: p10k configure (if you want to re-run the Powerlevel10k wizard)"
|
||||
echo ""
|
||||
Reference in New Issue
Block a user