-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup_links.sh
executable file
·86 lines (66 loc) · 2.1 KB
/
setup_links.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
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
#!/usr/bin/env bash
CUR_DIR="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
function setup_link() {
src="$1"
dst="$2"
if [[ "x$1" == "x" ]]; then
echo no src for setupLink func
exit 1
fi
if [[ "x$2" == "x" ]]; then
echo no dst for setupLink func
exit 1
fi
if [ -d "$dst" ]; then
echo "Removing $dst"
rm -rf "$dst"
elif [ -L "$dst" ] || [ -e "$dst" ]; then
echo "Removing $dst"
rm -f "$dst"
else
echo "NOT removing $dst"
fi
ln -s "$src" "$dst"
}
function setup_single() {
if [[ "x$1" == "x" ]]; then
echo no src for setupLink func
exit 1
fi
src="${CUR_DIR}/$1"
if [[ -f "$src" ]]; then
setup_link "$src" "${HOME}/$1"
else
echo weird src? $src
exit 1
fi
}
mkdir -p "${HOME}/.gnupg"
setup_link "${CUR_DIR}/gpg/gpg.conf" "${HOME}/.gnupg/gpg.conf"
chmod 600 "${HOME}/.gnupg/gpg.conf" "${HOME}/.gnupg/gpg-agent.conf"
setup_single .gitattributes
setup_single .ideavimrc
setup_single .tmux.conf
setup_single .antidoterc
setup_single .ripgreprc
if [ ! -f ${HOME}/.gitconfig ]; then
cp ${CUR_DIR}/myGitConfig ${HOME}/.gitconfig
fi
if [[ `uname` == "Darwin" ]]; then
CONF_DIRS="atuin fish kitty lazygit lsd mise taplo topgrade.d zellij"
# setup_link "${CUR_DIR}/macZsh" "${HOME}/.zshrc"
# setup_link "${CUR_DIR}/macZshEnv" "${HOME}/.zshenv"
setup_link "${CUR_DIR}/gpg/gpg-agent.m1.conf" "${HOME}/.gnupg/gpg-agent.conf"
else
CONF_DIRS="alacritty atuin fish hypr kitty lazygit lsd mako mise picom sway taplo topgrade.d waybar wpaperd zellij"
setup_single .Xresources
# setup_link "${CUR_DIR}/archAntigen" "${HOME}/.antigenrc"
# setup_link "${CUR_DIR}/archZsh" "${HOME}/.zshrc"
# setup_link "${CUR_DIR}/archZshEnv" "${HOME}/.zshenv"
# setup_link "${CUR_DIR}/archP10K" "${HOME}/.p10k.zsh"
setup_link "${CUR_DIR}/gpg/gpg-agent.conf" "${HOME}/.gnupg/gpg-agent.conf"
fi
setup_link "${CUR_DIR}/nvim" "${HOME}/.config/nvim"
for dir in $CONF_DIRS; do
setup_link "$CUR_DIR/.configs/$dir" "$HOME/.config/$dir"
done