-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.sh
More file actions
executable file
·60 lines (49 loc) · 2.19 KB
/
Copy pathinit.sh
File metadata and controls
executable file
·60 lines (49 loc) · 2.19 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
#!/usr/bin/env bash
# script from https://github.com/johngrib/dotfiles
INDENT='. '
INDENT2="$INDENT$INDENT"
INDENT3="$INDENT2$INDENT"
BACKUP_DIR="$HOME/.backup-dotfiles"
mkdir -p "$BACKUP_DIR"
echo -e "\n각종 dotfile들의 symlink를 연결합니다."
create_symlink() {
src=$1
dest=$2
if [ -L "$dest" ] && [ "$(readlink "$dest")" = "$src" ]; then
echo -e "\n$INDENT $dest 는 이미 연결되어 있습니다."
return 0
fi
if [ ! -e "$dest" ] && [ ! -L "$dest" ]; then
ln -s "$src" "$dest"
echo -e "\n$INDENT $dest 연결 완료."
return 0
fi
echo -e "\n$INDENT $dest 가 이미 있습니다."
read -p "$INDENT2 $dest 를 symlink로 replace 하시겠습니까? (y/n): " user_input
if [ "$user_input" == "y" ]; then
mv "$dest" "$BACKUP_DIR/"
ln -s "$src" "$dest"
echo "$INDENT3 $dest 가 연결되었습니다. 원본은 $BACKUP_DIR 에 백업되었습니다."
else
echo "$INDENT3 $dest 는 건너뜁니다."
fi
}
create_symlink "$HOME/dotfiles/.zshrc" ~/.zshrc
create_symlink "$HOME/dotfiles/.zprofile" ~/.zprofile
create_symlink "$HOME/dotfiles/.ideavimrc" ~/.ideavimrc
create_symlink "$HOME/dotfiles/.tmux.conf" ~/.tmux.conf
create_symlink "$HOME/dotfiles/.wezterm.lua" ~/.wezterm.lua
mkdir -p ~/.config
create_symlink "$HOME/dotfiles/nvim" ~/.config/nvim
create_symlink "$HOME/dotfiles/karabiner" ~/.config/karabiner
# create_symlink "$HOME/dotfiles/aerospace" ~/.config/aerospace
create_symlink "$HOME/dotfiles/yazi" ~/.config/yazi
create_symlink "$HOME/dotfiles/helix" ~/.config/helix
create_symlink "$HOME/dotfiles/ghostty" ~/.config/ghostty
create_symlink "$HOME/dotfiles/starship.toml" ~/.config/starship.toml
mkdir -p ~/.config/herdr
create_symlink "$HOME/dotfiles/herdr/config.toml" ~/.config/herdr/config.toml
mkdir -p "$HOME/Library/Application Support/lazygit"
create_symlink "$HOME/dotfiles/lazygit/config.yml" "$HOME/Library/Application Support/lazygit/config.yml"
[ -e "$HOME/dotfiles/colorscheme/current" ] || ln -sfn rose-pine "$HOME/dotfiles/colorscheme/current"
"$HOME/dotfiles/colorscheme/bin/theme" "$(basename "$(readlink "$HOME/dotfiles/colorscheme/current")")" >/dev/null 2>&1 || true