-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·65 lines (52 loc) · 1.43 KB
/
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
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
#!/usr/bin/env bash
set -e
set -o pipefail
readonly dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
mk_link() {
if [[ $# -ne 2 ]]; then
echo "usage: mk_link SRC DST" >&2
exit 1
fi
local s=$1; shift
local t=$1; shift
if [[ -h "$t" ]] && [[ "$(readlink "$t")" == "$s" ]]; then
printf "I %-60s exists and links to %s\n" "$t" "$s"
return 0
fi
if [[ -h "$t" ]]; then
printf "E %-60s exists but links to $(readlink "$t"), needs to be FIXED manually\n" "$t"
return 1
fi
if [[ -e "$t" ]]; then
printf "E %-60s exists but it is not a link, needs to be FIXED manually\n" "$t"
return 1
fi
printf "I %-60s does not exist, creating link to %s\n" "$s" "$t"
[[ ! -e $(dirname "$t") ]] && mkdir -p $(dirname "$t")
ln -s "$s" "$t"
}
mkdir -p "${HOME}/.config"
for f in config/* ; do
mk_link "${dir}/${f}" "${HOME}/.${f}"
done
files="$files aliases"
files="$files aliases.d"
files="$files ctags"
files="$files envs"
files="$files git_template"
files="$files gitconfig"
files="$files gitignore_global"
files="$files starship.toml"
files="$files tmux.conf"
files="$files zshrc"
#files="$files lima"
for f in $(ls local/bin) ; do
files="$files local/bin/$f"
done
for f in $files; do
s="$dir/$f"
t="$HOME/.$f"
mk_link $s $t
done
mk_link "${dir}/home/config/nvim" "${HOME}/.config/nvim"
#mk_link $dir/usr/local/bin/mux /usr/local/bin/mux