-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdeploy.sh
More file actions
153 lines (135 loc) · 3.01 KB
/
Copy pathdeploy.sh
File metadata and controls
153 lines (135 loc) · 3.01 KB
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#!/usr/bin/env bash
set -Eeuo pipefail
# Utility functions
## For ease of iterative experimentation
doo () {
$@
# echo $@
}
# This function was originally named errm to be short for "error message", but
# then I realized that it sounds like a person saying, "Errm, excuse me, I don't
# think that's what you meant to do."
errm () {
2>&1 echo -e "$@"
}
# START HERE.
main () {
cd $HOME
confirm_no_clobber
confirm_have_goodies
for i in ${DOTS[@]}; do
link_dot $i
done
# TODO: Make sure permissions are legit. .ssh and .ghci, I'm lookin at you.
}
# Subroutines
confirm_no_clobber() {
NOTADOT=''
for i in ${DOTS[@]}; do
dst=.$i
if [ ! -L $dst -a -e $dst ]; then
NOTADOT="${NOTADOT}$dst "
fi
done
if [ -n "$NOTADOT" ]; then
errm "\n ABORT"
errm "\n These exist but are not symlinks:"
errm " $NOTADOT"
exit 2
fi
}
confirm_have_goodies() {
NOFINDINGS=''
if [ ! -e "$EXPORT_DIR" ]; then
errm "\n ABORT\n\n Where ya gonna copy them files from again?"
errm " Couldn't find export dir: '$EXPORT_DIR'"
exit 2
fi
for i in ${DOTS[@]}; do
goody="$EXPORT_DIR/$i"
# Exists, is readable?
if [ ! -r "$goody" ]; then
NOFINDINGS="${NOFINDINGS}$i "
# Searchable if directory?
elif [ -d "$goody" -a ! -x "$goody" ]; then
NOFINDINGS="${NOFINDINGS}$i "
fi
done
if [ -n "$NOFINDINGS" ]; then
errm "\n ABORT\n\n These goodies don't exist in a state we can use!"
errm " $NOFINDINGS"
exit 2
fi
}
link_dot() {
src=$1
dst=.$1
doo rm -f "$dst"
doo mkdir -p $(dirname "$dst")
doo ln -s $EXPORT_DIR/$src $dst
}
# Initialize globals
EXPORT_DIR=$(dirname "${PWD}/$0")
DOTS=(
Xresources
ackrc
bash
bash_login
bashrc
claude/CLAUDE.md
claude/architecture-defaults.md
claude/haskell-exceptions.md
claude/keybindings.json
claude/notify
claude/settings.json
config/astroid
config/ctags
config/hat/hat.conf
config/ghostty
config/git/config
config/git/allowed-signers
config/keynav/keynavrc
config/systemd/user/lorri.service
config/systemd/user/lorri.socket
config/systemd/user/offlineimap.service
config/systemd/user/offlineimap.timer
config/Yubico/u2f_keys
cvsrc
direnvrc
dput.cf
extract_urlview
emacs.d/init.el
ghci
gnupg/gpg-agent.conf
ignore
inputrc
irssi
jshintrc
local/share/bash-completion
mailcap
mutt
nethackrc
notion/cfg_bindings.lua
notion/cfg_statusbar.lua
notion/cfg_notion.lua
notion/cfg_tiling.lua
notion/cfg_kludges.lua
notion/notion-lock
notion/toggle-desktop-colors
notion/statusd_disp.lua
notion/statusd_bat.lua
notmuch-config
offlineimap
offlineimaprc
terminfo
tmux
tmux.conf
vim
vimrc
w3m
weechat
xmonad
xsession
)
# Fire missiles
main