-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.sh
executable file
·391 lines (344 loc) · 9.84 KB
/
setup.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
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
#!/bin/bash
# Special requirements:
# ctags:
# universal-ctags
# hyprland:
# xdg-desktop-portal-hyprland wofi rofi-lbonn-wayland rofi-pass
# swaylock-effects swaybg slurp grim wl-clipboard wireplumber pipewire
# pipewire-pulse wdisplays kanshi playerctl brightnessctl hyprpicker
# xdg-utils copyq tessen wtype imv qt5ct qt6ct swaync nwg-look
# qogir-cursor-theme-git qogir-gtk-theme qogir-icon-theme terminator
# ttf-mulish polkit-kde-agent noto-fonts-emoji xwaylandvideobridge
# i3:
# i3blocks i3status i3lock-color picom polybar rofi rofi-pass playerctl
# wireplumber pipewire pipewire-pulse brightnessctl playerctl terminator
# nvim:
# neovim>=0.8.0 wget curl
# npm yarn ripgrep fd tree-sitter tree-sitter-cli
# luarocks python-pynvim lua-jsregexp
# liquidsoap-prettier
# pywal16:
# pywal-16-colors
###################
## FEATURE FLAGS ##
###################
# Available modules:
# bash
# ctags
# chrome
# copyq
# dunst
# env
# git
# gnuplot
# gtk
# htop
# hyprland
# i3
# kanshi
# minimics
# nvim
# pywal16
# rofi
# scide
# swaync
# taskwarrior
# terminator
# vim
# waybar
# zsh
# By default, install selected modules:
modules=(bash zsh terminator chrome copyq ctags env git gtk htop hyprland \
minimics nvim pywal16 rofi waybar scide swaync taskwarrior kanshi \
gnuplot)
# Dotfiles path
MIN_PATH="${HOME}/.minimics"
OHMYZSH_PATH="${HOME}/.oh-my-zsh"
# Backup dir in ~/.minimics/.backup.<timestamp>
_BACKUPDIR="${MIN_PATH}/.backup.$(date +%s)"
echo "You will find backups in ${_BACKUPDIR}."
echo
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-
###########
## TOOLS ##
###########
# Configuration file linking method, taking care of old conf if necessary
# backing it up in a new directory : $_BACKUPDIR
makelink () {
_SOURCE="${1}"
_DEST="${2}"
# Source doesn't exist
if [ ! -e "${_SOURCE}" ]; then
echo "ERROR: Source file doesn't exist" 1>&2
return 1
fi
# Destination exists as a symbolic link
if [ -L "${_DEST}" ]; then
echo " Unlinking $_DEST first..."
# Unlink
if ! rm "${_DEST}"; then
echo "ERROR: Can't unlink file." 1>&2
return 2
fi
fi
# Destination exists as a file or folder
if [ -e "${_DEST}" ]; then
echo " Making backup dir ${_DEST}..."
# Created backup folder
mkdir -p "${_BACKUPDIR}" 2>/dev/null
# Move the file/folder and check results
if ! mv "${_DEST}" "${_BACKUPDIR}"; then
echo "ERROR: Can't make backup. Please check permissions." 1>&2
return 3
fi
fi
# Make the new link
ln -s "${_SOURCE}" "${_DEST}"
return 0
}
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-
##########################
## INSTALLATION SCRIPTS ##
##########################
_bash () {
echo "[bash]"
echo " Linking configuration files..."
makelink "${MIN_PATH}/bash/bashrc" "${HOME}/.bashrc"
echo
return
}
_chrome () {
echo "[google-chrome]"
echo " Linking configuration files..."
makelink "${MIN_PATH}/chrome/chrome-flags.conf" "${HOME}/.config/chrome-flags.conf"
echo
return
}
_ctags () {
echo "[ctags]"
echo " Linking Universal Ctags configuration files..."
makelink "${MIN_PATH}/ctags" "${HOME}/.ctags.d"
echo
return
}
_dunst () {
echo "[dunst]"
echo " Linking configuration files..."
makelink "${MIN_PATH}/dunst" "${HOME}/.config/dunst"
echo
return
}
_swaync () {
echo "[swaync]"
echo " Linking configuration files..."
makelink "${MIN_PATH}/swaync" "${HOME}/.config/swaync"
echo
return
}
_env () {
echo "[env]"
echo " Linking configuration files..."
mkdir -p "${HOME}/.config/environment.d"
makelink "${MIN_PATH}/environment.d/minimics.cedilla.conf" "${HOME}/.config/environment.d/minimics.cedilla.conf"
makelink "${MIN_PATH}/environment.d/minimics.path.conf" "${HOME}/.config/environment.d/minimics.path.conf"
echo
return
}
_taskwarrior () {
echo "[taskwarrior]"
echo " Linking configuration files..."
makelink "${MIN_PATH}/taskwarrior/taskrc" "${HOME}/.taskrc"
echo
return
}
_terminator () {
echo "[terminator]"
echo " Linking configuration files..."
makelink "${MIN_PATH}/terminator" "${HOME}/.config/terminator"
echo
return
}
_copyq () {
echo "[copyq]"
echo " Linking configuration files..."
mkdir -p "${HOME}/.config/copyq/themes"
makelink "${MIN_PATH}/copyq/copyq.conf" "${HOME}/.config/copyq/copyq.conf"
makelink "${HOME}/.cache/wal/colors-copyq.css" "${HOME}/.config/copyq/themes/pywal.css"
echo
return
}
_git () {
echo "[git]"
echo " Linking configuration files..."
makelink "${MIN_PATH}/git/gitconfig" "${HOME}/.gitconfig"
echo " What is your github login? [Default: Youenn Piolet]"
read -r GIT_LOGIN
echo " What is your github email? [Default: [email protected]]"
read -r GIT_EMAIL
GIT_LOGIN="${GIT_LOGIN:-Youenn Piolet}"
GIT_EMAIL="${GIT_EMAIL:[email protected]}"
echo " name = ${GIT_LOGIN}"
echo " email = ${GIT_EMAIL}"
git config --global user.name "${GIT_LOGIN}"
git config --global user.email "${GIT_EMAIL}"
sed -i 's/^[\t]/ /g' "${MIN_PATH}/git/gitconfig"
echo "export GIT_USERNAME=${GIT_LOGIN}" >> ~/.aliases.local
echo "export GIT_EMAIL=${GIT_EMAIL}" >> ~/.aliases.local
echo
return
}
_gnuplot () {
echo "[gnuplot]"
echo " Linking configuration files..."
makelink "${MIN_PATH}/gnuplot/gnuplot" "${HOME}/.gnuplot"
echo
return
}
_vim () {
echo "[vim]"
echo " Linking configuration files..."
makelink "${MIN_PATH}/vim/vimrc" "${HOME}/.vimrc"
makelink "${MIN_PATH}/vim" "${HOME}/.vim"
makelink "${MIN_PATH}/nvim" "${HOME}/.config/nvim"
echo
return
}
_nvim () {
echo "[nvim]"
echo " Linking configuration files..."
makelink "${MIN_PATH}/nvim" "${HOME}/.config/nvim"
if [ ! -f "${HOME}/.cache/wal/colors-wal.vim" ]; then
echo " Cheating the absence of pywal for the colorscheme..."
mkdir -p "${HOME}/.cache/wal" 2>/dev/null
cp "${MIN_PATH}/pywal16/.walcachefornvim" "${HOME}/.cache/wal/colors-wal.vim"
fi
echo
return
}
_htop () {
echo "[htop]"
echo " Linking configuration files..."
makelink "${MIN_PATH}/htop/htoprc" "${HOME}/.config/htop/htoprc"
echo
return
}
_i3 () {
echo "[i3]"
echo " Linking i3, picom, polybar, rofi, rofi-pass and xprofile configuration files..."
makelink "${MIN_PATH}/i3" "${HOME}/.config/i3"
makelink "${MIN_PATH}/picom" "${HOME}/.config/picom"
makelink "${MIN_PATH}/polybar" "${HOME}/.config/polybar"
makelink "${MIN_PATH}/xprofile/xprofile" "${HOME}/.xprofile"
echo
return
}
_hyprland () {
echo "[hyprland]"
echo " Linking hyprland and xprofile configuration files..."
makelink "${MIN_PATH}/hyprland" "${HOME}/.config/hypr"
makelink "${MIN_PATH}/xprofile/xprofile" "${HOME}/.xprofile"
if [ ! -f "${HOME}/.cache/wal/colors-hyprland.conf" ]; then
echo " Cheating the absence of pywal for the colorscheme..."
mkdir -p "${HOME}/.cache/wal" 2>/dev/null
cp "${MIN_PATH}/pywal16/.walcacheforhyprland" "${HOME}/.cache/wal/colors-hyprland.conf"
fi
echo
return
}
_rofi () {
echo "[rofi]"
echo " Linking rofi/rofi-pass configuration"
makelink "${MIN_PATH}/rofi" "${HOME}/.config/rofi"
makelink "${MIN_PATH}/rofi-pass" "${HOME}/.config/rofi-pass"
echo
return
}
_pywal16 () {
echo "[pywal16]"
echo " Linking configuration files..."
makelink "${MIN_PATH}/pywal16" "${HOME}/.config/wal"
echo ""
return
}
_waybar () {
echo "[pywal16]"
echo " Linking configuration files..."
makelink "${MIN_PATH}/waybar" "${HOME}/.config/waybar"
echo ""
return
}
_kanshi () {
echo "[kanshi]"
echo " Linking configuration files..."
makelink "${MIN_PATH}/kanshi" "${HOME}/.config/kanshi"
echo ""
return
}
_zsh () {
echo "[zsh]"
echo " Linking configuration files..."
makelink "${MIN_PATH}/zsh/zshrc" "${HOME}/.zshrc"
makelink "${MIN_PATH}/zsh/p10k.zsh" "${HOME}/.p10k.zsh"
if [ ! -e "${OHMYZSH_PATH}" ]; then
echo " Downloading oh-my-zsh..."
git clone https://github.com/robbyrussell/oh-my-zsh.git "${OHMYZSH_PATH}"
fi
echo " Creating custom aliases file in ~/.aliases.local ..."
touch ~/.aliases.local > /dev/null 2>&1
echo ""
return
}
_gtk () {
# Useful for terminator configuration
echo "[gtk]"
echo " Linking GTK2/GTK3 configuration files..."
makelink "${MIN_PATH}/icons" "${HOME}/.config/icons"
makelink "${MIN_PATH}/gtk-2.0/gtkrc-2.0" "${HOME}/.gtkrc-2.0"
makelink "${MIN_PATH}/gtk-3.0" "${HOME}/.config/gtk-3.0"
makelink "${MIN_PATH}/xsettingsd" "${HOME}/.config/xsettingsd"
echo ""
return
}
_scide () {
echo "[Supercollider IDE]"
echo " Linking sc configuration files..."
mkdir -p "${HOME}/.config/SuperCollider" 2>/dev/null
makelink "${MIN_PATH}/supercollider/sc_ide_conf.yaml" "${HOME}/.config/SuperCollider/sc_ide_conf.yaml"
makelink "${MIN_PATH}/supercollider/sclang_conf.yaml" "${HOME}/.config/SuperCollider/sclang_conf.yaml"
makelink "${MIN_PATH}/supercollider/startup.scd" "${HOME}/.config/SuperCollider/startup.scd"
echo ""
return
}
_minimics () {
echo "[minimics]"
echo " Creating ${HOME}/.config if needed..."
mkdir -p "${HOME}/.config" 2>/dev/null
# Update submodules
echo " Updating submodules..."
MY_DIR="$(pwd)"
if cd "${MIN_PATH}"; then
git submodule init
git submodule update
fi
echo " Create ${HOME}/.minimicsrc..."
if [ ! -f "${HOME}/.minimicsrc" ] &&
[ -f "${MIN_PATH}/minimicsrc.dist" ]; then
cp minimicsrc.dist "${HOME}/.minimicsrc"
fi
cd "${MY_DIR}" || echo "Can't cd to previous folder.'"
echo
return
}
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-
if [ $# -gt 0 ]; then
# Install modules in arguments
while (($#)); do
eval "_${1}"
shift
done
else
# Install default modules
for module in "${modules[@]}"; do
eval "_${module}"
done
fi