-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·61 lines (49 loc) · 1.16 KB
/
install
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
#!/usr/bin/env zsh
set -eu -o pipefail
DEST=${1-}
if [[ -z "$DEST" ]]; then
echo "Install destination directory required"
exit 1
fi
if [[ ! -d "$DEST" ]]; then
echo "Destination directory \"$DEST\" does not exist"
exit 1
fi
TARGET_PREFIX=${0:a:h}
typeset -A files
files=(
# Destination file: symlink target
".config/alacritty" ""
".config/direnv/direnvrc" ""
".config/emacs" ".emacs.d"
".config/git" ""
".config/fd" ""
".config/karabiner" ""
".config/karabiner.edn" ""
".config/kitty" ""
".config/starship.toml" ""
".docker" ""
".ghc/ghci.conf" "ghc/ghci.conf"
".inputrc" ""
".pg_format" ""
".psqlrc" "postgres/psqlrc"
".tmux.conf" ""
".zlogin" "zsh/zlogin"
".zprofile" "zsh/zprofile"
".zshenv" "zsh/zshenv"
".zshrc" "zsh/zshrc"
"Library/Application Support/pip" "pip"
)
for reldest reltarget in "${(@kv)files}"; do
dest="${DEST}/${reldest}"
if [[ -e $dest ]]; then
echo "Skipping $dest: already exists."
continue
fi
destparent="${dest:a:h}"
target="${TARGET_PREFIX=}/${reltarget:-$reldest}"
if [[ $destparent != $DEST && ! -d $destparent ]]; then
mkdir -p $destparent
fi
ln -s $target $dest
done