-
Notifications
You must be signed in to change notification settings - Fork 0
/
endeavour-setup
executable file
·434 lines (350 loc) · 11.4 KB
/
endeavour-setup
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
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
#!/usr/bin/env bash
# shellcheck disable=SC2015
##############
# Functions #
############
step-header() {
echo -e '\n\e[93m\e[1m------------------------------'
echo "$1"
echo -e '------------------------------\e[0m'
}
fail() {
echo "$1"
exit 1
}
#########
# Init #
#######
set -e
if [ "$USER" = root ]; then
# We need $USER to be our regular user, not root, so this script shouldn't be run with sudo.
echo "Please run this script without sudo and as a regular user. Sudo will be added where necessary."
exit 1
fi
##########################
# Configuration (early) #
########################
step-header "Dotfiles"
[ -d ~/dev ] || mkdir ~/dev
if [ ! -d ~/dev/dotfiles ]; then
cd ~/dev &&
git clone [email protected]:rafalglowacz/dotfiles.git ||
fail "Dotfiles error"
fi
step-header "Symlinks (early)"
# Directory symlinks need to be deleted.
rm -rf ~/.config/atuin
rm -rf ~/.config/git
rm -rf ~/.config/helix
rm -rf ~/.config/ideavim
rm -rf ~/.config/kitty
rm -rf ~/.config/mpv
rm -rf ~/.config/nvim
rm -rf ~/.config/vim
mkdir -p ~/.config/Code\ -\ OSS/User
mkdir -p ~/.var/app/com.visualstudio.code/config/Code/User
true &&
ln -sf ~/dev/dotfiles/atuin ~/.config/atuin &&
ln -sf ~/dev/dotfiles/git/gitconfig.conf ~/.config/git/config &&
ln -sf ~/dev/dotfiles/helix ~/.config/helix &&
ln -sf ~/dev/dotfiles/idea-vim ~/.config/ideavim &&
ln -sf ~/dev/dotfiles/kitty ~/.config/kitty &&
ln -sf ~/dev/dotfiles/mpv ~/.config/mpv &&
ln -sf ~/dev/dotfiles/nvim ~/.config/nvim &&
ln -sf ~/dev/dotfiles/tmux/new.conf ~/.tmux.conf &&
ln -sf ~/dev/dotfiles/vcs-exclusions ~/.vcs-exclusions &&
ln -sf ~/dev/dotfiles/vim ~/.config/vim &&
ln -sf ~/dev/dotfiles/vscode/vscode-settings.json ~/.config/Code\ -\ OSS/User/settings.json &&
ln -sf ~/dev/dotfiles/vscode/vscode-shortcuts.json ~/.config/Code\ -\ OSS/User/keybindings.json &&
ln -sf ~/dev/dotfiles/vscode/vscode-settings.json ~/.var/app/com.visualstudio.code/config/Code/User/settings.json &&
ln -sf ~/dev/dotfiles/vscode/vscode-shortcuts.json ~/.var/app/com.visualstudio.code/config/Code/User/keybindings.json ||
fail "Symlinks error"
step-header "SSH"
if [ ! -f ~/.ssh/id_ed25519.pub ]; then
# shellcheck disable=SC2034
ssh-keygen -t ed25519 &&
cat ~/.ssh/id_ed25519.pub &&
read -rp "Press Enter after saving the SSH key to Github" confirm ||
fail "SSH error"
fi
if [ ! -f ~/.ssh/config ]; then
echo 'AddKeysToAgent yes' > ~/.ssh/config
fi
step-header "Global settings"
if ! $(timedatectl show --property=LocalRTC | grep -q yes); then
sudo timedatectl set-local-rtc 1 ||
fail "Settings error"
fi
if ! $(groups | grep -q vboxusers) || ! $(groups | grep -q docker); then
sudo groupadd vboxusers || true
sudo groupadd docker || true
sudo usermod -aG docker,vboxusers "$USER" ||
fail "Usermod error"
fi
yay --save --answerdiff All --answerclean None --noconfirm -Y
#########################
# Installation (early) #
#######################
step-header "Pacman packages (early)"
pkg=()
pkg+=( flatpak )
pkg+=( keepassxc )
pkg+=( kitty )
pkg+=( nextcloud-client )
sudo pacman -S --needed --noconfirm ${pkg[*]} || fail "Pacman installation (early) error"
step-header "Flatpak packages (early)"
pkg=()
pkg+=( org.freefilesync.FreeFileSync )
sudo flatpak install -y flathub ${pkg[*]} || fail "Flatpak installation (early) error"
#################
# Installation #
###############
step-header "Pacman packages"
pkg=()
pkg+=( atuin )
pkg+=( audacity )
pkg+=( baobab )
pkg+=( base-devel )
pkg+=( bat )
pkg+=( btop )
pkg+=( calibre )
pkg+=( certbot )
pkg+=( composer )
pkg+=( curl )
pkg+=( dbeaver )
pkg+=( docker )
pkg+=( docker-compose )
pkg+=( eos-update-notifier )
pkg+=( eza )
pkg+=( fd )
pkg+=( freecad )
pkg+=( freerdp )
pkg+=( fx )
pkg+=( gimp )
pkg+=( git-delta )
pkg+=( gparted )
pkg+=( helix )
pkg+=( htop )
pkg+=( hunspell-en_us )
pkg+=( hunspell-pl )
pkg+=( inkscape )
pkg+=( iotop )
pkg+=( jq )
pkg+=( jdk-openjdk )
pkg+=( kdeconnect )
pkg+=( kdenlive )
pkg+=( kfind )
pkg+=( kwalletmanager )
pkg+=( libreoffice-fresh )
pkg+=( libvncserver )
pkg+=( libxcrypt-compat )
pkg+=( ttf-lilex-nerd )
pkg+=( lldb )
pkg+=( lynx )
pkg+=( most )
pkg+=( meld )
pkg+=( ncdu )
pkg+=( neovim )
pkg+=( net-tools )
pkg+=( noto-fonts-emoji )
pkg+=( openshot )
pkg+=( partitionmanager )
pkg+=( php )
pkg+=( php-gd )
pkg+=( php-pgsql )
pkg+=( php-redis )
pkg+=( php-sodium )
pkg+=( php-xsl )
pkg+=( qbittorrent )
pkg+=( qmk )
pkg+=( qt5-imageformats )
pkg+=( redis )
pkg+=( remmina )
pkg+=( ripgrep )
pkg+=( rpi-imager )
pkg+=( rustup )
pkg+=( smplayer )
pkg+=( strawberry )
pkg+=( teensy_loader_cli )
pkg+=( thefuck )
pkg+=( ttc-iosevka )
pkg+=( ttf-fantasque-sans-mono )
pkg+=( ttf-monofur )
pkg+=( ttf-monofur-nerd )
pkg+=( ttf-nerd-fonts-symbols-mono )
pkg+=( thunderbird )
pkg+=( tmux )
pkg+=( tree )
pkg+=( virtualbox )
pkg+=( vorbisgain )
pkg+=( vlc )
pkg+=( wl-clipboard )
pkg+=( yay )
pkg+=( zsh )
sudo pacman -S --needed --noconfirm ${pkg[*]} || fail "Pacman installation error"
step-header "Pacman packages (theming)"
pkg=( cutefish-wallpapers )
pkg+=( deepin-wallpapers )
pkg+=( deepin-community-wallpapers )
pkg+=( elementary-wallpapers )
pkg+=( endeavouros-theming )
pkg+=( ukui-wallpapers )
sudo pacman -S --needed --noconfirm ${pkg[*]} || fail "Theming packages error"
step-header "AUR packages"
aur=""
# aur="${aur} anki"
# aur="${aur} joplin-appimage"
# aur="${aur} mp3gain"
aur="${aur} php-amqp"
# aur="${aur} plover"
if [[ "$aur" != '' ]]; then
yay -S --needed --noconfirm $aur || fail 'AUR installation error'
fi
step-header "Flatpak packages"
pkg=()
pkg+=( com.getpostman.Postman )
pkg+=( com.spotify.Client )
pkg+=( com.visualstudio.code )
pkg+=( cc.arduino.IDE2 )
pkg+=( io.github.ungoogled_software.ungoogled_chromium )
pkg+=( net.ankiweb.Anki )
pkg+=( net.cozic.joplin_desktop )
pkg+=( org.gnome.SimpleScan )
pkg+=( org.nickvision.tubeconverter )
sudo flatpak install -y flathub ${pkg[*]} || fail "Flatpak installation error"
step-header "Node"
if ! which fnm >> /dev/null; then
curl -o /tmp/fnm-install https://raw.githubusercontent.com/Schniz/fnm/master/.ci/install.sh &&
sh /tmp/fnm-install --skip-shell ||
fail "FNM install error"
fi
if ! which node >> /dev/null; then
export PATH="$HOME/.local/share/fnm:$PATH" &&
eval "`fnm env`" &&
fnm install --lts ||
fail "Node install error"
fi
step-header "Bluetooth"
sudo systemctl enable bluetooth &&
sudo systemctl start bluetooth ||
fail "Bluetooth service error"
step-header 'Docker'
sudo systemctl enable docker ||
fail "Docker service enabling error"
step-header "Endeavour extras"
# Remove wallpapers without sufficient resolution.
if [ ! -f ~/.local/state/wallpaper-cleanup ]; then
sudo ~/bin/image-small-delete /usr/share/endeavouros/backgrounds >> ~/.local/state/wallpaper-cleanup
fi
step-header "Firewall"
sudo firewall-cmd -q --permanent --zone=public --add-service=kdeconnect ||
fail "Firewall error"
step-header "FZF"
if [ ! -d ~/.fzf ]; then
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf &&
~/.fzf/install --key-bindings --completion --update-rc ||
fail 'FZF error'
fi
step-header "Keyboardio"
if [ ! -f /etc/udev/rules.d/60-kaleidoscope.rules ]; then
sudo wget -O /etc/udev/rules.d/60-kaleidoscope.rules \
https://raw.githubusercontent.com/keyboardio/Kaleidoscope/master/etc/60-kaleidoscope.rules
sudo udevadm control --reload-rules && sudo udevadm trigger
fi
step-header "Git Trim"
if ! which git-trim >> /dev/null; then
npm install -g git-trim ||
fail "Git Trim installation error"
fi
step-header "Gnome"
if [[ $XDG_CURRENT_DESKTOP == 'GNOME' ]]; then
if ! grep -q 'QT_QPA_PLATFORM=xcb' /etc/environment; then
echo 'QT_QPA_PLATFORM=xcb' | sudo tee -a /etc/environment
fi
sudo pacman -S --needed --noconfirm gnome-browser-connector ||
fail "Gnome error"
fi
step-header "KDE"
if [[ $XDG_CURRENT_DESKTOP == 'KDE' ]]; then
sudo pacman -S --needed --noconfirm \
kdeplasma-addons ||
fail "KDE packages error"
fi
step-header "PHP"
sudo perl -i -pe 's/;(extension=amqp)/\1/' /etc/php/conf.d/amqp.ini &&
sudo perl -i -pe 's/;(extension=exif)/\1/' /etc/php/php.ini &&
sudo perl -i -pe 's/;(extension=gd)/\1/' /etc/php/php.ini &&
sudo perl -i -pe 's/;(extension=igbinary)/\1/' /etc/php/conf.d/igbinary.ini &&
sudo perl -i -pe 's/;(extension=iconv)/\1/' /etc/php/php.ini &&
sudo perl -i -pe 's/;(extension=intl)/\1/' /etc/php/php.ini &&
sudo perl -i -pe 's/;(extension=pdo_pgsql)/\1/' /etc/php/php.ini &&
sudo perl -i -pe 's/;(extension=redis)/\1/' /etc/php/conf.d/redis.ini &&
sudo perl -i -pe 's/;(extension=sodium)/\1/' /etc/php/php.ini &&
sudo perl -i -pe 's/;(extension=soap)/\1/' /etc/php/php.ini &&
sudo perl -i -pe 's/;(extension=xsl)/\1/' /etc/php/php.ini ||
fail "PHP extension enabling error"
step-header "QMK"
sudo groupadd -f dialout &&
sudo usermod -aG dialout $USER ||
fail "Failed to add user to dialout group"
step-header "Rust"
rustup default stable
step-header "TLDR"
if ! which tldr >> /dev/null; then
npm install -g tldr &&
tldr -u ||
fail "TLDR installation error"
fi
step-header "ZSH"
if [ ! -d ~/.oh-my-zsh ]; then
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended ||
fail "OMZ error"
fi
if [[ "$SHELL" != '/usr/bin/zsh' ]]; then
sudo chsh -s "$(which zsh)" "$USER" ||
fail "Default shell change error"
fi
if [ ! -d ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions ]; then
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions ||
fail "ZSH autosuggestions error"
fi
if [ ! -d ~/.oh-my-zsh/custom/plugins/command-time ]; then
git clone https://github.com/popstas/zsh-command-time.git ~/.oh-my-zsh/custom/plugins/command-time ||
fail "ZSH command time error"
fi
if [ ! -d ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting ]; then
git clone https://github.com/zsh-users/zsh-syntax-highlighting \
~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting ||
fail "ZSH syntax highlighting error"
fi
###############################
# Configuration, themes etc. #
#############################
step-header "Boot"
if [ -f /etc/default/grub ] && ! grep -q 'GRUB_TIMEOUT=1' /etc/default/grub; then
sudo perl -i -pe 's/(GRUB_TIMEOUT)=./\1=1/' /etc/default/grub &&
sudo update-grub ||
fail "Grub error"
fi
if sudo sh -c '[ -f /efi/loader/loader.conf ]' && ! sudo grep -q 'timeout 0' /efi/loader/loader.conf; then
sudo perl -i -pe 's/(timeout) ./\1 0/' /efi/loader/loader.conf ||
fail "Systemd boot error"
fi
step-header "Symlinks"
ln -sf ~/dev/dotfiles/zsh/candy.zsh-theme ~/.oh-my-zsh/custom/themes/candy.zsh-theme &&
ln -sf ~/dev/dotfiles/zsh/zshrc.zshrc ~/.zshrc ||
fail "Symlinks error"
step-header "Update"
updateTimer=~/.config/systemd/user/eos-update-notifier.timer
if [ ! -f $updateTimer ]; then
eos-update-notifier -init ||
fail "Update init error"
fi
perl -i -pe 's/^(OnStartupSec)/# \1/' $updateTimer &&
perl -i -pe 's/^(RandomizedDelaySec)/# \1/' $updateTimer &&
perl -i -pe 's/^#?\s*(Persistent)=.*/\1=true/' $updateTimer &&
perl -i -pe 's/^#?\s*(OnCalendar)=.*/\1=Weekly/' $updateTimer ||
fail "Update config error"
echo -e '\n\e[32m\e[1m------------------------------'
echo "Done"
echo -e '------------------------------\e[0m'