-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·187 lines (144 loc) · 5.43 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·187 lines (144 loc) · 5.43 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
#!/bin/bash
# Dotfiles installation script
# Installs development tools via Homebrew and sets up configuration symlinks
set -e
DOTFILES_DIR="$(cd "$(dirname "$0")" && pwd)"
echo "Installing dotfiles from $DOTFILES_DIR"
echo ""
# =============================================================================
# OS Detection
# =============================================================================
detect_os() {
case "$(uname -s)" in
Darwin)
echo "macos"
;;
Linux)
echo "linux"
;;
*)
echo "unknown"
;;
esac
}
OS=$(detect_os)
if [ "$OS" = "unknown" ]; then
echo "Unsupported operating system."
echo "For Windows, please use install.ps1 instead."
exit 1
fi
echo "Detected OS: $OS"
echo ""
# =============================================================================
# Homebrew Installation
# =============================================================================
install_homebrew() {
if command -v brew &> /dev/null; then
echo "Homebrew is already installed"
return 0
fi
echo "Installing Homebrew..."
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Set up Homebrew for current session (permanent PATH is in dotfiles .bashrc)
if [ "$OS" = "linux" ]; then
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
fi
echo "Homebrew installed successfully"
}
install_homebrew
# Ensure brew is in PATH for this session
if [ "$OS" = "linux" ] && [ -d "/home/linuxbrew/.linuxbrew" ]; then
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
fi
echo ""
# =============================================================================
# Package Installation via Homebrew
# =============================================================================
echo "Installing packages from Brewfile..."
brew bundle --file="$DOTFILES_DIR/packages/Brewfile"
if [ "$OS" = "macos" ]; then
echo ""
echo "Installing macOS-specific packages..."
brew bundle --file="$DOTFILES_DIR/packages/Brewfile.macos"
fi
echo ""
# =============================================================================
# NPM Global Packages
# =============================================================================
echo "Installing npm global packages..."
npm install -g @openai/codex
echo ""
# =============================================================================
# Claude Code Installation
# =============================================================================
echo "Installing Claude Code..."
curl -fsSL https://claude.ai/install.sh | bash
echo ""
# =============================================================================
# Configuration Symlinks
# =============================================================================
echo "Setting up configuration symlinks..."
# Backup and symlink function
link_file() {
local src="$1"
local dest="$2"
if [ -e "$dest" ] && [ ! -L "$dest" ]; then
echo "Backing up existing $dest to ${dest}.backup"
mv "$dest" "${dest}.backup"
elif [ -L "$dest" ]; then
rm "$dest"
fi
echo "Linking $src -> $dest"
ln -s "$src" "$dest"
}
# Create ~/.config if it doesn't exist
mkdir -p "$HOME/.config"
# Bash - link both files (works on any OS)
link_file "$DOTFILES_DIR/bash/.bash_profile" "$HOME/.bash_profile"
link_file "$DOTFILES_DIR/bash/.bashrc" "$HOME/.bashrc"
# Tmux
link_file "$DOTFILES_DIR/tmux/.tmux.conf" "$HOME/.tmux.conf"
# Neovim
link_file "$DOTFILES_DIR/nvim" "$HOME/.config/nvim"
# Git
link_file "$DOTFILES_DIR/git/.gitconfig" "$HOME/.gitconfig"
link_file "$DOTFILES_DIR/git/.gitignore" "$HOME/.gitignore"
# Note: docker/aliases and git/aliases are sourced automatically by .bashrc
# No symlinks needed - they are sourced relative to the dotfiles directory
# OpenCode
mkdir -p "$HOME/.config/opencode"
link_file "$DOTFILES_DIR/opencode/opencode.json" "$HOME/.config/opencode/opencode.json"
# Claude Code - symlink config files into ~/.claude/ (not the whole directory)
mkdir -p "$HOME/.claude"
link_file "$DOTFILES_DIR/claude/CLAUDE.md" "$HOME/.claude/CLAUDE.md"
link_file "$DOTFILES_DIR/claude/settings.json" "$HOME/.claude/settings.json"
link_file "$DOTFILES_DIR/claude/statusline.sh" "$HOME/.claude/statusline.sh"
# Obsidian CLI symlink (macOS only)
if [ "$OS" = "macos" ] && [ -x "/Applications/Obsidian.app/Contents/MacOS/Obsidian" ]; then
mkdir -p "$HOME/.local/bin"
echo "Linking Obsidian CLI to ~/.local/bin/obsidian..."
ln -sf /Applications/Obsidian.app/Contents/MacOS/Obsidian "$HOME/.local/bin/obsidian"
fi
# Install TPM (Tmux Plugin Manager) if not present
if [ ! -d "$HOME/.tmux/plugins/tpm" ]; then
echo "Installing TPM (Tmux Plugin Manager)..."
git clone https://github.com/tmux-plugins/tpm "$HOME/.tmux/plugins/tpm"
fi
echo ""
echo "============================================="
echo "Installation complete!"
echo "============================================="
echo ""
echo "Next steps:"
echo " 1. Reload bash config: source ~/.bashrc"
echo " 2. In tmux, install plugins: prefix + I (Ctrl-a + I)"
echo " 3. Open nvim to let plugins install automatically"
echo ""
if [ "$OS" = "linux" ]; then
echo "Linux note: Install xclip for tmux clipboard support:"
echo " sudo apt install xclip"
echo ""
fi
echo "Secrets (SSH keys, API keys) must be set up manually on local machines"
echo "or via Ansible on VPS deployments."
echo ""