blob: 5f3d03a32219e4ee3d1456bebf5790810255ad80 (
plain)
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
|
#!/bin/sh
set -eu
die() {
echo "$@" 1>&2
exit 1
}
abspath() {
(cd "$1" && pwd)
}
src() {
dirname="$1"
file="$2"
hosted="$dirname/$(hostname)/$file"
plain="$dirname/$file"
if [ -e "$hosted" ]; then
echo "$hosted"
elif [ -e "$plain" ]; then
echo "$plain"
else
die "$file does not exist"
fi
}
dirname="$(abspath "$(dirname "$0")")"
echo "$dirname"
files="
abcde.conf
bash_profile
bashrc
emacs.d
git-global-ignore
mailcap
profile
screenrc
signature
vimrc
xsessionrc
ssh/config
ssh/config-pers
config/starship/config.toml
config/vmadm/config.yaml
"
install -d "$HOME/.config"
for x in $files; do
src "$dirname" "$x"
done
for x in $files; do
y="$(src "$dirname" "$x")"
d="$(dirname "$x")"
if [ ! -e "$HOME/.$d" ]; then
mkdir -p "$HOME/.$d"
fi
ln -sf "$y" "$HOME/.$x"
done
|