-
Notifications
You must be signed in to change notification settings - Fork 0
/
usercustom.sh
474 lines (385 loc) · 19.5 KB
/
usercustom.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
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
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
#! /bin/bash
## This is an installation script for a customizing your Arch Linux. It is modified for my personal needs. Feel free to use or customize!
###
### ---- Start: Define programs for this installation script ----
###
## Desktop manager list
# Window manager
awesomePkgs="awesome"
swayPkgs="sway swaybg swayidle swaylock wf-recorder way-accel-rotate-git sway-alttab-bin sway-audio-idle-inhibit-git swaylock-blur-multimonitor-git swaysettings-git xdg-desktop-portal xdg-desktop-portal-gtk xdg-desktop-portal-wlr"
# Desktop enviroments
gnomePkgs="adw-gtk3 clamtk-gnome dconf-editor endeavour gedit gnome-appfolders-manager gnome-applets gnome-disk-utility gnome-power-manager gnome-shell gnome-shell-extension-appindicator gnome-shell-extension-caffeine gnome-shell-extension-clipboard-indicator gnome-shell-extension-gamemode gnome-shell-extension-gsconnect gnome-shell-extension-gtk4-desktop-icons-ng gnome-shell-extension-media-controls gnome-shell-extension-privacy-menu gnome-shell-extension-sound-output-device-chooser gnome-shell-extension-tiling-assistant gnome-shell-extension-tray-icons-reloaded gnome-shell-extension-vitals gnome-shell-extension-x11gestures gnome-terminal gnome-themes-extra gnome-tweaks gnome-usage gnome-usage xdg-desktop-portal xdg-desktop-portal-gnome xdg-desktop-portal-gtk"
plasmaPkgs=""
xfcePkgs="xfce4 xfce4-goodies"
# Login manager
systemPkgs="alsa archiso backintime calf cantarell-fonts cifs-utils clamtk libebur128 libpamac-full-git lsp-plugins networkmanager-openvpn nlohmann-json nm-connection-editor ntfs-3g pamac-all-git powerline pv rclone-browser rnnoise rubberband timeshift ttf-dejavu ttf-liberation ttf-meslo-nerd zam-plugins zita-convolver zsh zsh-autosuggestions zsh-completions zsh-history-substring-search zsh-syntax-highlighting zsh-theme-powerlevel10k"
###
### ---- End: Define programs for this installation script ----
###
###
### ---- Start: Define functions for this installation script ----
###
## Function for sartup message
function_startup_message() {
whiptail --nocancel --title "Start installation" --msgbox "This script will guide you through the installation of customized settings for Arch Liunx. Notice, that this script will only work on Arch Linux (and maybe arch-based systems)." 32 128 3>&1 1>&2 2>&3
}
## Function to start the installation guide
function_start_installation_guide() {
whiptail --title "Start installation guide" --yesno "Do you want to start the installation guide?" 32 128 3>&1 1>&2 2>&3
if [[ $? -eq 0 ]]; then
## Detect if the script is compatible with the operation system / host system
case "$OSTYPE" in
linux*)
if grep -q 'Arch Linux' /etc/os-release; then
echo 'Supported system detected. Continue installation...'
function_installation_guide
fi
;;
## If an unsupported system gets detected.
*)
whiptail --title "ERROR - Unsupported system detected!" --yesno "Your system is not officially supported by this script. It is not recommended to run this script on not officially supported systems, as it can cause damage to your installed systems or it might not work properly. If you decide to run this script anyway - you have been warned! Do you want to continue?" 32 128 3>&1 1>&2 2>&3
if [[ $? -eq 0 ]]; then
function_installation_guide
elif [[ $? -eq 1 ]]; then
whiptail --title "MESSAGE" --msgbox "Cancelling Process since user pressed <NO>." 32 128 3>&1 1>&2 2>&3
elif [[ $? -eq 255 ]]; then
whiptail --title "MESSAGE" --msgbox "User pressed ESC. Exiting the script" 32 128 3>&1 1>&2 2>&3
fi
;;
esac
elif [[ $? -eq 1 ]]; then
whiptail --title "MESSAGE" --msgbox "Cancelling Process since user pressed <NO>." 32 128 3>&1 1>&2 2>&3
elif [[ $? -eq 255 ]]; then
whiptail --title "MESSAGE" --msgbox "User pressed ESC. Exiting the script" 32 128 3>&1 1>&2 2>&3
fi
}
## Function to configurate the Desktop environment / Window Manager
function_select_enviroment() {
CHOSEN_USERSPACE=$(whiptail --nocancel --title "Package Selection" --checklist "Which desktop environment or window manager do you want to install?" 32 128 16 \
'Plasma' 'X11 + Wayland' on \
'Gnome' 'X11 + Wayland' off \
'XFCE' 'X11' off \
'Sway' 'Wayland' off \
'AwesomeWM' 'X11' off \
3>&1 1>&2 2>&3)
echo $CHOSEN_USERSPACE
}
## Function to configurate the Login-Manager
function_select_login_manager() {
CHOSEN_LOGINMANAGER=$(whiptail --nocancel --title "Package Selection" --radiolist "Which Login-Manager do you want to use?" 32 128 16 \
'SDDM' 'Recommended for Plasma' on \
'GDM' 'Recommended for Gnomme' off \
'LightDM' 'Recommended for XFCE' off \
3>&1 1>&2 2>&3)
echo $CHOSEN_LOGINMANAGER
}
## Function to configurate user specific packages
function_select_package() {
CHOSEN_USERPACKAGES=$(whiptail --nocancel --title "Package Selection" --checklist "Which desktop environment or window manager do you want to install?" 32 128 16 \
'Base' 'Browser, Editor, File manager, Calculator etc.' on \
'Editing' 'Photo-, Video-, Audiotools' off \
'Flatpaks' 'Flatpaksupport, Discord, Fluentreader' off \
'Gaming' 'Steam, Lutris, Heroic' off \
'Multimedia' 'RSS-Client, Videoclient, Mediaplayer' off \
'Office' 'Mailclient, Office suite, Calendar, Printing' off \
'Printing' 'CUPS, Scantools' off \
'Privacy' 'Tor, Onineshare, Anonymous Messanger etc.' off \
'Programming' 'IDEs, Tools, Language support' off \
'Server' 'WebDAV, Nextcloud, PiHole, Jellyfin, Invidious' off \
'Tools' 'Some usefull stuff' off \
'VM' 'Virtualisation, QEMU, Libvirt' off \
3>&1 1>&2 2>&3)
echo $CHOSEN_USERPACKAGES
}
## Function to configurate portable device optimizations
function_select_portable_device_optimization() {
whiptail --nocancel --title "Package Selection" --yesno "Do you want to install portable device optimizations like TLP for longer battery life and enable touch support?" 32 128 3>&1 1>&2 2>&3
if [[ $? -eq 0 ]]; then
BATTERY_OPTIMIZATION=true
else
BATTERY_OPTIMIZATION=false
fi
}
## Function to configurate the system wide theming
function_select_theme() {
CHOSEN_THEME=$(whiptail --nocancel --title "Theming" --radiolist "Which system wide theme do you prefer?" 32 128 16 \
'Default' 'Default theme - No modifications' on \
'Catppuccin Latte' 'Light theme' off \
'Catppuccin Frappé' 'Light dark theme' off \
'Catppuccin Macchiato' 'Dark theme' off \
'Catppuccin Mocha' 'Dark dark theme' off \
3>&1 1>&2 2>&3)
echo $CHOSEN_THEME
}
## Function to configurate the timeshift backup system
function_timeshift_setup() {
# Set the backup directory
backup_dir="/backup"
# Set the backup frequency
backup_frequency=$(whiptail --nocancel --title "Backup Frequency" --menu "Choose how often you want to backup:" 15 60 4 \
"1" "Daily" \
"2" "Weekly" \
"3" "Monthly" \
"4" "Yearly" 3>&1 1>&2 2>&3)
# Set the backup time
backup_time=$(whiptail --nocancel --title "Backup Time" --inputbox "Enter the time you want to backup (HH:MM):" 10 60 3>&1 1>&2 2>&3)
# Set the backup retention period
backup_retention=$(whiptail --nocancel --title "Backup Retention Period" --inputbox "Enter the number of backups you want to keep:" 10 60 3>&1 1>&2 2>&3)
# Create the backup schedule
case $backup_frequency in
"1") cron_schedule="0 $backup_time * * *";;
"2") cron_schedule="0 $backup_time * * 0";;
"3") cron_schedule="0 $backup_time 1 * *";;
"4") cron_schedule="0 $backup_time 1 1 *";;
esac
# Create the backup script
echo "#!/bin/bash" > /usr/local/bin/timeshift-backup.sh
echo "" >> /usr/local/bin/timeshift-backup.sh
echo "# Run timeshift with the specified parameters" >> /usr/local/bin/timeshift-backup.sh
echo "/usr/bin/timeshift --create --comments \"Automated backup\" --tags DAILY --scripted --snapshot-device /dev/sda1 --snapshot-boot --exclude /backup/* --exclude /home/*/.cache/* --exclude /var/tmp/* --exclude /var/cache/* --exclude /var/log/* --exclude /var/backups/* --exclude /var/lib/docker/* --exclude /var/lib/snapd/*" >> /usr/local/bin/timeshift-backup.sh
# Make the script executable
chmod +x /usr/local/bin/timeshift-backup.sh
# Add the script to crontab
(crontab -l ; echo "$cron_schedule /usr/local/bin/timeshift-backup.sh") | crontab -
}
###
### ---- End: Define functions for this installation script ----
###
###
### ---- Start: Configuration of the system ----
###
function_startup_message
## Installation guide
function_installation_guide () {
function_select_enviroment
function_select_login_manager
function_select_package
function_select_portable_device_optimization
function_select_theme
## Last confirmation before executing script to install everything
whiptail --title "Finish and execute" --yesno "The configuration is complete. Do you want to run and execute your configuration? (This can take up some time.)" 32 128 3>&1 1>&2 2>&3
if [[ $? -eq 0 ]]; then
whiptail --title "Final Information" --msgbox "When the process is done, the computer should reboot automatically. Please do not power off or disconnect your computer from the network during the process." 32 128 3>&1 1>&2 2>&3
###
### ---- Start: Executing of the installation ----
###
## Install yay package manager
SOURCE_DIR=$(pwd)
mkdir ~/build
cd ~/build
git clone https://aur.archlinux.org/yay.git
cd ~/build/yay
makepkg -si --noconfirm
cd $SOURCE_DIR
## Install System Packages
yay -S --needed --noconfirm - < pkgLists/systemLists/systemPkgs.txt
## Install Battery & Tocuh optimizations for portable devices
if [ $BATTERY_OPTIMIZATION == true ]; then
yay -S --needed --noconfirm - < pkgLists/driverLists/laptopPkgs.txt
sudo systemctl enable cpupower
sudo systemctl enable tlp
# Librewolf enable touch support
sudo echo 'MOZ_USE_XINPUT2 DEFAULT=1' > /etc/security/pam_env.conf
#c6-Suspendbugfix (For some AMD-Systems)
#arch-chroot / modprobe msr
#arch-chroot / sh -c "echo msr > /etc/modules-load.d/msr.conf"
#yay -S disable-c6-systemd
#arch-chroot /mnt systemctl enable disable-c6.service
fi
## Install Userspace
for i in ${CHOSEN_USERSPACE[@]}
do
case $i in
Plasma)
echo "Add Plasma to installation query..."
yay -S --needed --noconfirm - < pkgLists/desktopLists/plasmaPkgs.txt
# install vlc dolphin addon + metadata remover dolphin addon
#mkdir /home/$USERNAME/.local/share/kservices5/ServiceMenus/
#cd /home/$USERNAME/build
#git clone https://github.com/Merrit/kde-dolphin-remove-metadata.git
#cd kde-dolphin-remove-metadata
#cp -r removeMetadata.desktop /home/$USERNAME/.local/share/kservices5/ServiceMenus/
#cd /home/$USERNAME/build
#git clone https://github.com/rc2dev/KDE-ServiceMenus.git
#cd KDE-ServiceMenus
#cp -r *.desktop /home/$USERNAME/.local/share/kservices5/ServiceMenus/
sudo firewall-cmd --permanent --zone=home --add-service=kdeconnect
;;
Gnome)
echo "Add Gnome to installation query..."
yay -S --needed --noconfirm - < pkgLists/desktopLists/gnomePkgs.txt
sudo firewall-cmd --permanent --zone=home --add-service=kdeconnect
;;
XFCE)
echo "Add XFCE to installation query..."
yay -S --needed --noconfirm - < pkgLists/desktopLists/xfcePkgs.txt
;;
Sway)
echo "Add Sway to installation query..."
yay -S --needed --noconfirm - < pkgLists/desktopLists/swayPkgs.txt
if lshw -C display | grep "NVIDIA"; then
yay -S --needed --noconfirm sway-nvidia
fi
;;
AwesomeWM)
echo "Add Awesome WM to installation query..."
yay -S --needed --noconfirm - < pkgLists/desktopLists/awesomePkgs.txt
;;
esac
done
## Install / Set Login-Manager
if [ $CHOSEN_LOGINMANAGER == "SDDM" ]; then
echo "Set LightDM as Login-Manager..."
yay -S --needed --noconfirm sddm
sudo systemctl enable sddm
yay -S --needed --noconfirm
elif [ $CHOSEN_LOGINMANAGER == "GDM" ]; then
echo "Set LightDM as Login-Manager..."
yay -S --needed --noconfirm gdm
sudo systemctl enable gdm
elif [ $CHOSEN_LOGINMANAGER == "LightDM" ]; then
echo "Set LightDM as Login-Manager..."
yay -S --needed --noconfirm lightdm lightdm-gtk-greeter
sudo systemctl enable lightdm
fi
## Install / Set system theme
yay -S --needed --noconfirm - < pkgLists/themeLists/themePkgs.txt
if [[ $CHOSEN_THEME == "Default" ]]; then
echo "Set system theme to Default..."
elif [[ $CHOSEN_THEME == "Catppuccin Latte" ]]; then
echo "Set system theme to Catppuccin Latte..."
yay -S --needed --noconfirm - < pkgLists/themeLists/catppuccinLattePkgs.txt
sudo plymouth-set-default-theme -R catppuccin-latte
ln -sf "/usr/share/themes/Catppuccin-Latte-Standard-Mauve-Dark/gtk-4.0/assets" "/usr/share/gtk-4.0/assets"
ln -sf "/usr/share/themes/Catppuccin-Latte-Standard-Mauve-Dark/gtk-4.0/gtk.css" "/usr/share/gtk-4.0/gtk.css"
ln -sf "/usr/share/themes/Catppuccin-Latte-Standard-Mauve-Dark/gtk-4.0/gtk-dark.css" "/usr/share/gtk-4.0/gtk-dark.css"
elif [[ $CHOSEN_THEME == "Catppuccin Frappé" ]]; then
echo "Set system theme to Catppuccin Frappé..."
yay -S --needed --noconfirm - < pkgLists/themeLists/catppuccinFrappePkgs.txt
sudo plymouth-set-default-theme -R catppuccin-frappe
ln -sf "/usr/share/themes/Catppuccin-Frappe-Standard-Mauve-Dark/gtk-4.0/assets" "/usr/share/gtk-4.0/assets"
ln -sf "/usr/share/themes/Catppuccin-Frappe-Standard-Mauve-Dark/gtk-4.0/gtk.css" "/usr/share/gtk-4.0/gtk.css"
ln -sf "/usr/share/themes/Catppuccin-Frappe-Standard-Mauve-Dark/gtk-4.0/gtk-dark.css" "/usr/share/gtk-4.0/gtk-dark.css"
elif [[ $CHOSEN_THEME == "Catppuccin Macchiato" ]]; then
echo "Set system theme to Catppuccin Macchiato..."
yay -S --needed --noconfirm - < pkgLists/themeLists/catppuccinMacchiatoPkgs.txt
sudo plymouth-set-default-theme -R catppuccin-macchiato
ln -sf "/usr/share/themes/Catppuccin-Macchiato-Standard-Mauve-Dark/gtk-4.0/assets" "/usr/share/gtk-4.0/assets"
ln -sf "/usr/share/themes/Catppuccin-Macchiato-Standard-Mauve-Dark/gtk-4.0/gtk.css" "/usr/share/gtk-4.0/gtk.css"
ln -sf "/usr/share/themes/Catppuccin-Macchiato-Standard-Mauve-Dark/gtk-4.0/gtk-dark.css" "/usr/share/gtk-4.0/gtk-dark.css"
elif [[ $CHOSEN_THEME == "Catppuccin Mocha" ]]; then
echo "Set system theme to Catppuccin Mocha..."
yay -S --needed --noconfirm - < pkgLists/themeLists/catppuccinMochaPkgs.txt
sudo plymouth-set-default-theme -R catppuccin-mocha
ln -sf "/usr/share/themes/Catppuccin-Mocha-Standard-Mauve-Dark/gtk-4.0/assets" "/usr/share/gtk-4.0/assets"
ln -sf "/usr/share/themes/Catppuccin-Mocha-Standard-Mauve-Dark/gtk-4.0/gtk.css" "/usr/share/gtk-4.0/gtk.css"
ln -sf "/usr/share/themes/Catppuccin-Mocha-Standard-Mauve-Dark/gtk-4.0/gtk-dark.css" "/usr/share/gtk-4.0/gtk-dark.css"
fi
## Install Userspace PKGs
for i in ${CHOSEN_USERPACKAGES[@]}
do
case $i in
"Base")
echo "Add Base to installation query..."
yay -S --needed --noconfirm - < pkgLists/softwareLists/basePkgs.txt
;;
"Editing")
echo "Add Editing to installation query..."
yay -S --needed --noconfirm - < pkgLists/softwareLists/editingPkgs.txt
;;
"Flatpaks")
echo "Add Flatpaks to installation query..."
yay -S flatpak
## Configure theming for Flatpaks
sudo flatpak override --filesystem=$HOME/.themes
sudo flatpak override --env=GTK_THEME=##theme##
## Install Flatpaks
yay -S --needed --noconfirm - < pkgLists/softwareLists/flatpakPkgs.txt
## Install custom asar-file for Discord
rm /var/lib/flatpak/app/com.discordapp.Discord/current/active/files/discord/resources/app.asar
wget -c https://github.com/GooseMod/OpenAsar/releases/download/nightly/app.asar -P /var/lib/flatpak/app/com.discordapp.Discord/current/active/files/discord/resources/
;;
"Gaming")
echo "Add Gaming to installation query..."
yay -S --needed --noconfirm - < pkgLists/softwareLists/gamingPkgs.txt
;;
"Multimedia")
echo "Add Multimedia to installation query..."
yay -S --needed --noconfirm - < pkgLists/softwareLists/multimediaPkgs.txt
;;
"Office")
echo "Add Office to installation query..."
yay -S --needed --noconfirm - < pkgLists/softwareLists/officePkgs.txt
;;
"Printing")
echo "Add Printing to installation query..."
yay -S --needed --noconfirm - < pkgLists/softwareLists/printPkgs.txt
sudo systemctl enable cups
sudo firewall-cmd --permanent --zone=home --add-service=ipp-client
sudo firewall-cmd --permanent --zone=home --add-service=mdns
sudo firewall-cmd --permanent --zone=home --add-service=sane
# Enable Canon 4400F
sudo sed -i 's/#usb 0x04a9 0x2228/usb 0x04a9 0x2228/g' /etc/sane.d/genesys.conf
;;
"Privacy")
echo "Add Privacy to installation query..."
yay -S --needed --noconfirm - < pkgLists/softwareLists/privacyPkgs.txt
sudo firewalld-cmd --set-default=public
sudo systemctl enable portmaster
;;
"Programming")
echo "Add Programming to installation query..."
yay -S --needed --noconfirm - < pkgLists/softwareLists/programmingPkgs.txt
EXTENSION_FILE="vscExt.txt"
while IFS= read -r EXTENSION; do
code --install-extension "$EXTENSION"
done < "$EXTENSION_FILE"
;;
"Server")
echo "Add Server to installation query..."
yay -S --needed --noconfirm - < pkgLists/softwareLists/serverPkgs.txt
sudo systemctl enable httpd
sudo systemctl enable samba
sudo systemctl enable avahi-daemon
sudo firewall-cmd --permanent --zone=home --add-service=http
sudo firewall-cmd --permanent --zone=home --add-service=https
sudo firewall-cmd --permanent --zone=home --add-service={samba,samba-client,samba-dc}
sudo firewall-cmd --permanent --zone=libvirt --add-service=http
sudo firewall-cmd --permanent --zone=libvirt --add-service=https
sudo firewall-cmd --permanent --zone=libvirt --add-service={samba,samba-client,samba-dc}
;;
"Tools")
echo "Add Toosl to installation query..."
yay -S --needed --noconfirm - < pkgLists/softwareLists/toolsPkgs.txt
;;
"VM")
echo "Add VM to installation query..."
yay -S --needed --noconfirm - < pkgLists/softwareLists/vmPkgs.txt
sudo sed -i 's/#unix_sock_group = "libvirt"/unix_sock_group = "libvirt"/g' /etc/libvirt/libvirtd.conf
sudo sed -i 's/#unix_sock_rw_perms = "0770"/unix_sock_rw_perms = "0770"/g' /etc/libvirt/libvirtd.conf
sudo gpasswd -a $USERNAME libvirt
sudo systemctl enable libvirtd
;;
esac
done
## Enable system services
#systemctl enable snapd
## Reboot system
#whiptail --title "Installation is complete" --yesno "Restart computer?" 32 128 3>&1 1>&2 2>&3
#if [[ $? -eq 0 ]]; then
# sudo systemctl reboot --now
# elif [[ $? -eq 1 ]]; then
# whiptail --title "MESSAGE" --msgbox "Cancelling Process since user pressed <NO>. Returned to shell." 32 128 3>&1 1>&2 2>&3
# elif [[ $? -eq 255 ]]; then
# whiptail --title "MESSAGE" --msgbox "User pressed ESC. Returned to shell." 32 128 3>&1 1>&2 2>&3
#fi
###
### ---- End: Executing of the installation ----
###
elif [[ $? -eq 1 ]]; then
whiptail --title "MESSAGE" --msgbox "Cancelling Process since user pressed <NO>." 32 128 3>&1 1>&2 2>&3
elif [[ $? -eq 255 ]]; then
whiptail --title "MESSAGE" --msgbox "User pressed ESC. Exiting the script" 32 128 3>&1 1>&2 2>&3
fi
}
function_start_installation_guide