-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
98 lines (86 loc) · 2.99 KB
/
install.sh
File metadata and controls
98 lines (86 loc) · 2.99 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
#!/usr/bin/env bash
set -e
# Install uv
if ! command -v uv &> /dev/null; then
echo "Installing uv..."
curl -LsSf https://astral.sh/uv/install.sh | sh
export PATH="$HOME/.local/bin:$PATH"
fi
# Install packages
bash packages/install_packages.sh
# Check zsh is installed
if ! command -v zsh &> /dev/null; then
echo "zsh is not installed. Please install zsh first."
exit 1
fi
# backup dotfiles with timestamp (handle both regular files and symlinks)
BACKUP_TIMESTAMP=$(date +%Y%m%d%H%M%S)
BACKUP_DIR="${HOME}/.dotfiles_backup/${BACKUP_TIMESTAMP}"
BACKUP_COUNT=0
for target in ~/.zshrc ~/.p10k.zsh ~/.vimrc ~/.tmux.conf; do
if [ -e "$target" ] || [ -L "$target" ]; then
mkdir -p "$BACKUP_DIR"
mv "$target" "$BACKUP_DIR/$(basename "$target")"
BACKUP_COUNT=$((BACKUP_COUNT + 1))
fi
done
if [ -e ~/.claude ] || [ -L ~/.claude ]; then
mkdir -p "$BACKUP_DIR"
mv ~/.claude "$BACKUP_DIR/.claude"
BACKUP_COUNT=$((BACKUP_COUNT + 1))
fi
if [ -e ~/.opencode ] || [ -L ~/.opencode ]; then
mkdir -p "$BACKUP_DIR"
mv ~/.opencode "$BACKUP_DIR/.opencode"
BACKUP_COUNT=$((BACKUP_COUNT + 1))
fi
if [ -e ~/.agents/.skill-lock.json ] || [ -L ~/.agents/.skill-lock.json ]; then
mkdir -p "$BACKUP_DIR/.agents"
mv ~/.agents/.skill-lock.json "$BACKUP_DIR/.agents/.skill-lock.json"
BACKUP_COUNT=$((BACKUP_COUNT + 1))
fi
mkdir -p ~/.config
if [ -e ~/.config/opencode ] || [ -L ~/.config/opencode ]; then
mkdir -p "$BACKUP_DIR/.config"
mv ~/.config/opencode "$BACKUP_DIR/.config/opencode"
BACKUP_COUNT=$((BACKUP_COUNT + 1))
fi
if [ -e ~/.config/ghostty ] || [ -L ~/.config/ghostty ]; then
mkdir -p "$BACKUP_DIR/.config"
mv ~/.config/ghostty "$BACKUP_DIR/.config/ghostty"
BACKUP_COUNT=$((BACKUP_COUNT + 1))
fi
if [ "$BACKUP_COUNT" -gt 0 ]; then
echo "기존 dotfiles 백업 완료: $BACKUP_DIR"
fi
# Install oh-my-zsh
bash zsh/install-omz.sh
# Link dotfiles
ln -sf ${HOME}/.dotfiles/vim/vimrc ~/.vimrc
ln -sf ${HOME}/.dotfiles/zsh/p10k.zsh ~/.p10k.zsh
ln -sf ${HOME}/.dotfiles/tmux/tmux.conf ~/.tmux.conf
ln -sfn ${HOME}/.dotfiles/claude ~/.claude
ln -sfn ${HOME}/.dotfiles/.opencode ~/.opencode
mkdir -p ~/.agents
ln -sf ${HOME}/.dotfiles/agents/.skill-lock.json ~/.agents/.skill-lock.json
ln -sfn ${HOME}/.dotfiles/config/opencode ~/.config/opencode
ln -sfn ${HOME}/.dotfiles/config/ghostty ~/.config/ghostty
mkdir -p ~/.local/bin
ln -sf ${HOME}/.dotfiles/bin/dotfiles-pr ~/.local/bin/dotfiles-pr
# Install opencode CLI
if ! command -v opencode &> /dev/null; then
if command -v npm &> /dev/null; then
echo "Installing opencode..."
npm install -g opencode-ai
else
echo "Warning: npm is not installed. Skipping opencode CLI installation."
fi
fi
# Install plugins
bash plugins/install_plugins.sh
ln -sf ${HOME}/.dotfiles/zsh/zshrc ~/.zshrc
# Setup pre-commit hooks
cd ${HOME}/.dotfiles
uv sync --group dev
uv run pre-commit install
echo "Please change shell to zsh by running 'chsh -s $(which zsh)' and then restart your terminal."