-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcreate-links
executable file
·73 lines (63 loc) · 1.85 KB
/
create-links
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
66
67
68
69
70
71
72
73
#!/bin/sh
if [ "$#" -ge 1 ]; then
dst_base="$1"
else
dst_base="$HOME"
fi
dst_base=$(realpath "$dst_base")
src_base=$(dirname "$(realpath "$0")")
create_xdg_base_dirs() {
xdg_dirs="
.cache
.config
.local/bin
.local/lib
.local/share
.local/state
"
for dir in $xdg_dirs; do
mkdir -p -m 0700 "$dst_base/$dir"
done
}
install() {
src="$src_base/$1"
dst="$dst_base/$2"
name="$2"
if [ -e "$dst" ]; then
[ "$(realpath "$dst")" = "$src" ] || echo "$dst already exists"
return
fi
dst_dir=$(dirname "$dst")
if ! mkdir -p -m 0700 "$dst_dir"; then
return
fi
src_rel=$(realpath --relative-to="$dst_dir" "$src")
if ln -sfn "$src_rel" "$dst"; then
echo "$name installed"
fi
}
create_xdg_base_dirs
install "alacritty.toml" ".config/alacritty/alacritty.toml"
install "fontconfig-fonts.conf" ".config/fontconfig/fonts.conf"
install "gdbearlyinit" ".config/gdb/gdbearlyinit"
install "gdbinit" ".config/gdb/gdbinit"
install "gitconfig" ".config/git/config"
touch "$dst_base/.config/git/credentials"
install "i3status-config" ".config/i3status/config"
install "msmtp-aliases" ".config/msmtp/aliases"
install "msmtprc" ".config/msmtp/config"
install "sh-aliases.sh" ".config/sh/aliases.sh"
install "sh-paths.sh" ".config/sh/paths.sh"
install "sh-rc.sh" ".config/sh/rc.sh"
install "sh-rc.sh" ".bashrc"
install "sh-rc.sh" ".bash_profile"
install "ssh-config" ".ssh/config"
install "sway-config" ".config/sway/config"
install "sway-portals.conf" ".config/xdg-desktop-portal/sway-portals.conf"
install "sway-session" ".local/bin/sway-session"
install "sway-session-autostart" ".local/bin/sway-session-autostart"
install "systemd-fetch-repos.service" ".config/systemd/user/fetch-repos.service"
install "systemd-fetch-repos.timer" ".config/systemd/user/fetch-repos.timer"
install "tmux.conf" ".config/tmux/tmux.conf"
install "vimrc" ".vim/vimrc"
install "vim-pack" ".vim/pack"