-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
52 lines (41 loc) · 1.44 KB
/
install.sh
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
#!/bin/bash
SELF_PATH="$( cd "$( dirname "$0" )" && pwd )"
set_symlink() {
path="$1"
symlink_path="$2"
should_overwrite_all="$3"
if [ ! -e "$symlink_path" ] || [ "$should_overwrite_all" = "1" ]; then
echo "will be created $path $symlink_path $should_overwrite_all"
rm -rf "$symlink_path"
ln -sv "$path" "$symlink_path"
fi
}
######## Creating symlinks
should_overwrite_all=0
read -p "Do you want to overwrite existing files in your home dirrectory? [y/n] " -e force
if [[ $force =~ ^[Yy]$ ]]; then
echo "Existing config files will be overwritten!"
should_overwrite_all=1
else
echo "Existing config files will not be overwritten!"
should_overwrite_all=0
fi
if [ ! -f "$SELF_PATH/.zshenv" ]; then
touch "$SELF_PATH/.zshenv"
fi
echo "Creating symlinks"
nvim_src="$SELF_PATH/.config/nvim"
nvim_dest="$HOME/.config/nvim"
kitty_src="$SELF_PATH/.config/kitty"
kitty_dest="$HOME/.config/kitty"
karabiner_src"$SELF_PATH/.config/karabiner"
karabiner_dest="$HOME/.config/karabiner"
zshrc_src="$SELF_PATH/.zshrc"
zshrc_dest="$HOME/.zshrc"
tmux_conf_src="$SELF_PATH/.tmux.conf"
tmux_conf_dest="$HOME/.tmux.conf"
set_symlink "$nvim_src" "$nvim_dest" "$should_overwrite_all"
set_symlink "$kitty_src" "$kitty_dest" "$should_overwrite_all"
set_symlink "$karabiner_src" "$karabiner_dest" "$should_overwrite_all"
set_symlink "$zshrc_src" "$zshrc_dest" "$should_overwrite_all"
set_symlink "$tmux_conf_src" "$tmux_conf_dest" "$should_overwrite_all"