-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·257 lines (207 loc) · 7.06 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·257 lines (207 loc) · 7.06 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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
#!/bin/bash
set -e
DOTFILES_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BACKUP_DIR="$HOME/.dotfiles_backup_$(date +%Y%m%d_%H%M%S)"
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
NC='\033[0m'
info() { echo -e "${GREEN}[INFO]${NC} $1"; }
warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
error() {
echo -e "${RED}[ERROR]${NC} $1"
exit 1
}
backup_and_copy() {
local src="$1"
local dest="$2"
if [ -e "$dest" ] || [ -L "$dest" ]; then
mkdir -p "$BACKUP_DIR"
warn "Backing up $dest"
mv "$dest" "$BACKUP_DIR/"
fi
cp -r "$src" "$dest"
info "Copied $dest"
}
# ============================================
# FASTFETCH (config)
# ============================================
setup_fastfetch() {
info "=== Setting up Fastfetch ==="
mkdir -p "$HOME/.config/fastfetch"
backup_and_copy "$DOTFILES_DIR/fastfetch/config.jsonc" "$HOME/.config/fastfetch/config.jsonc"
info "=== Fastfetch done ==="
}
# ============================================
# ALACRITTY (themes + config)
# ============================================
setup_alacritty() {
info "=== Setting up Alacritty ==="
# Create config directory
mkdir -p "$HOME/.config/alacritty"
# Clone alacritty-theme if not exists
if [ ! -d "$HOME/.config/alacritty/themes" ]; then
info "Cloning alacritty-theme..."
git clone https://github.com/alacritty/alacritty-theme "$HOME/.config/alacritty/themes"
else
info "Alacritty themes already installed"
fi
# Link config
backup_and_copy "$DOTFILES_DIR/alacritty/alacritty.toml" "$HOME/.config/alacritty/alacritty.toml"
info "=== Alacritty done ==="
}
# ============================================
# ZSH (oh-my-zsh + theme + config)
# ============================================
setup_zsh() {
info "=== Setting up ZSH ==="
# Install Oh My Zsh
if [ ! -d "$HOME/.oh-my-zsh" ]; then
info "Installing Oh My Zsh..."
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
else
info "Oh My Zsh already installed"
fi
# Install theme
local theme_file="$HOME/.oh-my-zsh/themes/agnosterzak.zsh-theme"
if [ ! -f "$theme_file" ]; then
info "Installing agnosterzak theme..."
curl -fsSL https://raw.githubusercontent.com/zakaziko99/agnosterzak-ohmyzsh-theme/master/agnosterzak.zsh-theme -o "$theme_file"
else
info "Agnosterzak theme already installed"
fi
# Install zsh-autosuggestions
local autosuggestions_dir="$HOME/.oh-my-zsh/custom/plugins/zsh-autosuggestions"
if [ ! -d "$autosuggestions_dir" ]; then
info "Installing zsh-autosuggestions..."
git clone https://github.com/zsh-users/zsh-autosuggestions "$autosuggestions_dir"
else
info "zsh-autosuggestions already installed"
fi
# Install zsh-syntax-highlighting
local syntax_dir="$HOME/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting"
if [ ! -d "$syntax_dir" ]; then
info "Installing zsh-syntax-highlighting..."
git clone https://github.com/zsh-users/zsh-syntax-highlighting "$syntax_dir"
else
info "zsh-syntax-highlighting already installed"
fi
# Link config
backup_and_copy "$DOTFILES_DIR/zsh/.zshrc" "$HOME/.zshrc"
info "=== ZSH done ==="
}
# ============================================
# TMUX (tpm + config)
# ============================================
setup_tmux() {
info "=== Setting up TMUX ==="
# Install TPM (Tmux Plugin Manager)
if [ ! -d "$HOME/.tmux/plugins/tpm" ]; then
info "Installing TPM..."
git clone https://github.com/tmux-plugins/tpm "$HOME/.tmux/plugins/tpm"
else
info "TPM already installed"
fi
# Link config
backup_and_copy "$DOTFILES_DIR/tmux/tmux.conf" "$HOME/.tmux.conf"
info "=== TMUX done ==="
}
# ============================================
# NVIM (neovim + config)
# ============================================
setup_nvim() {
info "=== Setting up NVIM ==="
# Install neovim (latest stable via AppImage)
if ! command -v nvim &>/dev/null; then
info "Installing Neovim (latest stable)..."
curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim.appimage
chmod u+x nvim.appimage
sudo mv nvim.appimage /usr/local/bin/nvim
else
info "Neovim already installed: $(nvim --version | head -1)"
fi
# Init config submodule
info "Initializing nvim config..."
git -C "$DOTFILES_DIR" submodule update --init --recursive
# Link config
mkdir -p "$HOME/.config"
backup_and_copy "$DOTFILES_DIR/nvim" "$HOME/.config/nvim"
info "=== NVIM done ==="
}
# ============================================
# CLAUDE CODE (notification hooks + script)
# ============================================
setup_claude() {
info "=== Setting up Claude Code ==="
# Install terminal-notifier for custom notification icons
if ! command -v terminal-notifier &>/dev/null; then
if command -v brew &>/dev/null; then
info "Installing terminal-notifier..."
brew install terminal-notifier
else
warn "Homebrew not found; skipping terminal-notifier (osascript fallback will be used)"
fi
else
info "terminal-notifier already installed"
fi
mkdir -p "$HOME/.claude"
# Notification script
cp "$DOTFILES_DIR/claude/notify.sh" "$HOME/.claude/notify.sh"
chmod +x "$HOME/.claude/notify.sh"
info "Installed notify.sh"
# Custom icon (optional)
if [ -f "$DOTFILES_DIR/claude/claude-icon.png" ]; then
cp "$DOTFILES_DIR/claude/claude-icon.png" "$HOME/.claude/claude-icon.png"
info "Installed claude-icon.png"
fi
# Settings with hooks
backup_and_copy "$DOTFILES_DIR/claude/settings.json" "$HOME/.claude/settings.json"
info "=== Claude Code done ==="
}
# ============================================
# MAIN
# ============================================
usage() {
echo "Usage: ./install.sh [command]"
echo ""
echo "Commands:"
echo " all Setup everything (default)"
echo " zsh Setup zsh (oh-my-zsh + theme + plugins + config)"
echo " tmux Setup tmux (tpm + config)"
echo " nvim Setup nvim (neovim + config)"
echo " alacritty Setup alacritty (themes + config)"
echo " fastfetch Setup fastfetch (config)"
echo " claude Setup Claude Code (notification hooks + script)"
echo " help Show this message"
}
main() {
local cmd="${1:-all}"
case "$cmd" in
all)
setup_zsh
setup_tmux
setup_nvim
setup_alacritty
setup_fastfetch
setup_claude
;;
zsh) setup_zsh ;;
tmux) setup_tmux ;;
nvim) setup_nvim ;;
alacritty) setup_alacritty ;;
fastfetch) setup_fastfetch ;;
claude) setup_claude ;;
help | --help | -h)
usage
exit 0
;;
*)
error "Unknown command: $cmd"
;;
esac
echo ""
info "Done!"
[ -d "$BACKUP_DIR" ] && warn "Backups saved to: $BACKUP_DIR"
}
main "$@"