-
Notifications
You must be signed in to change notification settings - Fork 7
/
link.sh
executable file
·46 lines (33 loc) · 969 Bytes
/
link.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
#!/bin/bash -e
DIR=$(readlink -f "$0") && DIR=$(dirname "$DIR") && cd "$DIR" || exit 1
cd "${DIR}/dotfiles"
for FILE in *; do
SRC="${DIR}/dotfiles/${FILE}"
if [ ! -f "$SRC" ]; then
continue
fi
TARGET="${HOME}/.${FILE}"
if [ "$FILE" == "gitconfig" ] && [ ! -e "${HOME}/.ssh/id_ecdsa.pub" ]; then
grep -E -v '\[url|insteadOf' "$SRC" > "$TARGET"
continue
fi
echo "$TARGET"
ln -sf "$SRC" "$TARGET"
done
if [ ! -e "${HOME}/.npmrc" ]; then
echo "prefix=${HOME}/.npm" > "${HOME}/.npmrc"
fi
if [ -z "$DISPLAY" ]; then
cp -R "${DIR}/dotfiles/moc" ~/.moc
chmod 600 ~/.moc/config
chmod 600 ~/.moc/keymap_vim
fi
ln -sf "${DIR}/zsh/index.zsh" "${HOME}/.zshrc"
mkdir -p ~/.config/tig
ln -sf "${DIR}/dotfiles/other/tigrc" ~/.config/tig/config
if [ -n "$DISPLAY" ]; then
mkdir -p ~/.config/kitty
ln -sf "${DIR}/dotfiles/other/kitty.conf" ~/.config/kitty
mkdir -p ~/.config/fontconfig
ln -sf "${DIR}/dotfiles/other/fonts.conf" ~/.config/fontconfig
fi