-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·38 lines (32 loc) · 1016 Bytes
/
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
#!/bin/bash
set -Cue
READLINK=realpath
curd=$(dirname "$(${READLINK} "$0")")
BLOCKLIST="${curd}/.blocklist"
mkdir -p "$HOME/bin"
mkdir -p "$HOME/.tmux"
for x in *; do
grep "^${x}$" "${BLOCKLIST}" && continue
case $x in
config)
XDG_CONFIG_HOME=$HOME/.config
if [ ! -d "${XDG_CONFIG_HOME}" ]; then
mkdir "${XDG_CONFIG_HOME}"
fi
while read -r y; do
source=$(${READLINK} "$y")
target=${XDG_CONFIG_HOME}/$(basename "$y")
[ -L "${target}" ] && unlink "${target}"
echo ln -sf "${source}" "${target}"
ln -sf "${source}" "${target}"
done < <(find config -type d -not -wholename config)
;;
*)
source=$x
target=$HOME/.${source}
[ -L "${target}" ] && unlink "${target}"
echo ln -sf "$(${READLINK} "${source}")" "${target}"
ln -sf "$(${READLINK} "${source}")" "${target}"
;;
esac
done