-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·70 lines (54 loc) · 1.97 KB
/
install.sh
File metadata and controls
executable file
·70 lines (54 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
# Dotfiles install script - restores configs from this repo
set -e
DOTFILES_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
echo "Installing dotfiles from $DOTFILES_DIR..."
# Backup existing configs
BACKUP_DIR=~/.dotfiles_backup_$(date +%Y%m%d_%H%M%S)
mkdir -p "$BACKUP_DIR"
echo "→ Backing up existing configs to $BACKUP_DIR..."
# Function to safely symlink
link_file() {
local src=$1
local dest=$2
if [ -e "$dest" ] || [ -L "$dest" ]; then
mv "$dest" "$BACKUP_DIR/"
fi
ln -sf "$src" "$dest"
}
# Zsh configs
echo "→ Linking zsh configs..."
link_file "$DOTFILES_DIR/zsh/.zshrc" ~/.zshrc
# Git config
echo "→ Linking git config..."
link_file "$DOTFILES_DIR/git/.gitconfig" ~/.gitconfig
# VSCode configs
echo "→ Linking VSCode configs..."
mkdir -p ~/Library/Application\ Support/Code/User
link_file "$DOTFILES_DIR/vscode/settings.json" ~/Library/Application\ Support/Code/User/settings.json
link_file "$DOTFILES_DIR/vscode/keybindings.json" ~/Library/Application\ Support/Code/User/keybindings.json
# GitHub CLI config
if [ -d "$DOTFILES_DIR/gh" ]; then
echo "→ Linking GitHub CLI config..."
mkdir -p ~/.config
link_file "$DOTFILES_DIR/gh" ~/.config/gh
fi
# Homebrew
if ! command -v brew &> /dev/null; then
echo "→ Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
echo "→ Installing Homebrew packages..."
brew bundle --file="$DOTFILES_DIR/homebrew/Brewfile"
# Claude configs
if [ -d "$DOTFILES_DIR/.claude" ]; then
echo "→ Linking Claude configs..."
mkdir -p ~/.claude
link_file "$DOTFILES_DIR/.claude/CLAUDE.md" ~/.claude/CLAUDE.md
link_file "$DOTFILES_DIR/.claude/settings.json" ~/.claude/settings.json
link_file "$DOTFILES_DIR/.claude/commands" ~/.claude/commands
link_file "$DOTFILES_DIR/.claude/agents" ~/.claude/agents
link_file "$DOTFILES_DIR/.claude/skills" ~/.claude/skills
fi
echo "✓ Installation complete!"
echo " Backups saved to: $BACKUP_DIR"