-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_dots.sh
executable file
·64 lines (51 loc) · 1.27 KB
/
setup_dots.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
#!/usr/bin/env bash
set -eo pipefail
os=$1
cpu=$2
repo=$3
if [[ -z ${os} || -z ${cpu} || -z ${repo} ]]; then
echo 1>&2 "Incorrect arguments given to setup_dots.sh; os: $os cpu: $cpu repo: $repo"
exit 1
fi
echo 1>&2 "**"
echo 1>&2 "** Setup dots"
echo 1>&2 "**"
if [[ -d ${repo}/shared/dots ]]; then
pushd ${repo}/shared/dots >/dev/null
for filepath in *; do
if [[ -f ${filepath} ]]; then
filename=$(basename ${filepath})
full=${repo}/shared/dots/${filename}
if [[ -f ${full} ]]; then
ln -v -f -s ${full} ~/.${filename}
fi
fi
done
popd >/dev/null
fi
if [[ -d ${repo}/${os}/dots ]]; then
pushd ${repo}/${os}/dots >/dev/null
for filepath in *; do
if [[ -f ${filepath} ]]; then
filename=$(basename ${filepath})
full=${repo}/${os}/dots/${filename}
if [[ -f ${full} ]]; then
ln -v -f -s ${full} ~/.${filename}
fi
fi
done
popd >/dev/null
fi
if [[ -d ${repo}/${os}-${cpu}/dots ]]; then
pushd ${repo}/${os}-${cpu}/dots >/dev/null
for filepath in *; do
if [[ -f ${filepath} ]]; then
filename=$(basename ${filepath})
full=${repo}/${os}-${cpu}/dots/${filename}
if [[ -f ${full} ]]; then
ln -v -f -s ${full} ~/.${filename}
fi
fi
done
popd >/dev/null
fi