-
Notifications
You must be signed in to change notification settings - Fork 3
/
install_bruteforce.bash
executable file
·108 lines (88 loc) · 2.57 KB
/
install_bruteforce.bash
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/usr/bin/env bash
function make-link
{
local link_to="$1"
local link_destination="$2"
# When linking `src/bar` to `foo/`
# $link_destination should be `foo/bar`
#
# NOTE: in bash, ${foo:(-N)} takes last N chars
# Ref: https://stackoverflow.com/a/19858692
if [[ "${link_destination:(-1)}" == "/" ]]; then
link_destination="${link_destination}$(basename "$link_to")"
fi
local old_link_to="$(readlink "$link_destination" || true)"
if [[ "$link_to" == "$old_link_to" ]]; then
echo "nothing to do, '$link_destination' already points to '$link_to'"
return
fi
if [[ "$DRYRUN_ONLY" == "true" ]]; then
local before before_short
if [[ -n "$old_link_to" ]]; then
before_short=R
before="was '$old_link_to'"
else
before_short=N
before="to create"
fi
echo "DRYRUN[$before_short]: '$link_destination' -> '$link_to' ($before)"
else
ln -vsf --no-dereference "$link_to" "$link_destination"
fi
}
function label
{
echo
echo "---- $1"
}
function skip
{
echo "SKIPPED: $*"
}
# opt-in apply
DRYRUN_ONLY=true
if [[ "$1" == "--apply" ]]; then
DRYRUN_ONLY=false
fi
DOTS_PATH=$(dirname $(realpath "$0"))
label "Bootstraping .dot symlinks"
make-link "$DOTS_PATH" ~/.dot
label "bin links"
make-link ~/.dot/bin ~/.bin
make-link ~/.dot/gui/bin ~/.bin-gui
skip label "shell links"
skip make-link ~/.dot/zsh/zshrc ~/.zshrc
skip make-link ~/.dot/zsh/zshenv ~/.zshenv
skip make-link ~/.dot/zsh/zlogin ~/.zlogin
make-link ~/.dot/nushell ~/.config/nushell
skip label "nvim link"
skip make-link ~/.dot/nvim ~/.config/nvim
label "git links"
make-link ~/.dot/git ~/.config/git
make-link ~/.dot/gh ~/.config/gh
label "Nix stuff"
make-link ~/.dot/nix/nix-self-config ~/.config/nix
label "other cli tools"
make-link ~/.dot/gui/htop ~/.config/htop
make-link ~/.dot/tmux/tmux.conf ~/.tmux.conf
make-link ~/.dot/gdb ~/.config/gdb
mkdir -vp ~/.ipython/profile_default/startup
make-link ~/.dot/ipy-startup/00-custom-config.py ~/.ipython/profile_default/startup/
label "X apps configs"
# terms
make-link ~/.dot/gui/wezterm ~/.config/wezterm
# Desktop env
make-link ~/.dot/gui/dunst ~/.config/dunst
make-link ~/.dot/gui/flameshot ~/.config/flameshot
make-link ~/.dot/gui/copyq ~/.config/copyq
# tools
make-link ~/.dot/gui/tridactyl ~/.config/tridactyl
# vscode (if I ever want to have it..)
if [[ -d ~/.config/"Code - OSS" ]]; then
make-link ~/.dot/gui/vscode-user-config ~/.config/"Code - OSS"/User
fi
if $DRYRUN_ONLY; then
echo
echo "### To apply the above config, re-run with '--apply"
echo
fi