-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfqs
executable file
·351 lines (326 loc) · 12.5 KB
/
fqs
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
#!/usr/bin/bash
# |----------------------------------|
# | Copyright (c) 2024 Vili. GPL-3.0 |
# |----------------------------------|
# Made in Finland, with love.
# Functions
# -----------
# Performs a system update and upgrade.
sys_update() {
sudo dnf update -y && sudo dnf upgrade -y
}
# Adds and enables the rpm repos.
add_rpm_repos() {
sudo dnf install -y https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-"$(rpm -E %fedora)".noarch.rpm
sudo dnf install -y https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-"$(rpm -E %fedora)".noarch.rpm
sudo dnf install dnf-plugins-core -y
sudo dnf group update core -y
}
# Adds and enables flathub repos.
add_flatpak_repos() {
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
}
# Speeds up dnf.
append_dnf_configs() {
sudo tee -a /etc/dnf/dnf.conf <<EOF
max_parallel_downloads=10
defaultyes=True
fastestmirror=True
deltarpm=True
EOF
sudo dnf upgrade --refresh -y
}
# Install the preferred code editor.
install_code_editor() {
echo "Choose your preferred code editor:"
echo "1. [Vscode] (https://code.visualstudio.com/) Microsoft Visual Studio Code."
echo "2. [Vscodium] (https://vscodium.com/) Libre version of Microsoft Visual Studio Code, but has less extensions to install."
echo "3. [Zed] (https://zed.dev) New and lighting fast text editor made in Rust."
echo "4. [NeoVim] (https://neovim.io/) Hyperextensible Vim-based text editor with NvChad (https://nvchad.com) config."
read -r -p "Enter the number of your preferred editor: " editor_choice
case $editor_choice in
1)
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" | sudo tee /etc/yum.repos.d/vscode.repo > /dev/null
sudo dnf update -y && sudo dnf install code -y
;;
2)
sudo rpmkeys --import https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/-/raw/master/pub.gpg
printf "[gitlab.com_paulcarroty_vscodium_repo]\nname=download.vscodium.com\nbaseurl=https://download.vscodium.com/rpms/\nenabled=1\ngpgcheck=1\nrepo_gpgcheck=1\ngpgkey=https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/-/raw/master/pub.gpg\nmetadata_expire=1h" | sudo tee -a /etc/yum.repos.d/vscodium.repo
sudo dnf update -y && sudo dnf install codium -y
;;
3)
curl -f https://zed.dev/install.sh | sh
;;
4)
sudo dnf update -y && sudo dnf install neovim -y
git clone https://github.com/NvChad/starter ~/.config/nvim && nvim
;;
*)
echo "Invalid choice. No editor installed."
;;
esac
}
# Install the preferred browser.
install_browser() {
echo "Choose your preferred browser:"
echo "1. Librewolf: A custom version of Firefox, focused on privacy, security and freedom."
echo " https://librewolf.net/"
echo "2. Chromium: UnGoogled version of the Chrome browser."
echo " https://chromium.org/"
echo "3. Brave: Privacy respecting and ad blocking browser based of Chromium."
echo " https://brave.com/"
read -r -p "Enter the number of your preferred browser: " browser_choice
case $browser_choice in
1)
curl -fsSL https://rpm.librewolf.net/librewolf-repo.repo | pkexec tee /etc/yum.repos.d/librewolf.repo
sudo dnf update -y && sudo dnf install librewolf -y
;;
2)
sudo dnf install chromium -y
;;
3)
sudo dnf config-manager --add-repo https://brave-browser-rpm-release.s3.brave.com/brave-browser.repo
sudo rpm --import https://brave-browser-rpm-release.s3.brave.com/brave-core.asc
sudo dnf install brave-browser -y
;;
*)
echo "Invalid choice. Going with the default browser (Firefox)."
;;
esac
}
# Install communicating apps
install_communication() {
echo "Choose your preferred communication app(s):"
echo "1. Discord: A popular communication platform for communities, including voice, video, and text chat."
echo " https://discord.com/"
echo "2. Vesktop: A modified Discord client with plugin support and hardened privacy."
echo " https://vencord.dev/"
echo "3. Element Desktop: A secure and private communication platform with end-to-end encryption."
echo " https://element.io/"
echo "4. Telegram Desktop: A cloud-based messaging platform with a focus on security and speed."
echo " https://telegram.org/"
echo "5. Signal Desktop: A private messaging app with end-to-end encryption and a focus on security."
echo " https://signal.org/"
read -r -p "Enter the number(s) of your preferred communication app(s), separated by spaces: " app_choice
for choice in $app_choice; do
case $choice in
1)
sudo dnf install discord -y
;;
2)
flatpak install dev.vencord.Vesktop -y
;;
3)
flatpak install im.riot.Riot -y
;;
4)
sudo dnf install telegram-desktop -y
;;
5)
flatpak install org.signal.Signal -y
;;
*)
echo "Invalid choice: $choice"
;;
esac
done
}
# Add useful developer tools
add_dev_tools() {
# TODO add more useful tools here...
# These are the only ones that I personally need
sudo dnf groupinstall "Development Tools" "Development Libraries" -y
sudo dnf install kernel-devel android-tools python3-pip python3-devel git nodejs nodejs-npm -y
}
# Installs the Nvidia drivers if an Nvidia GPU is detected
needs_nvidia() {
if lspci | grep -q NVIDIA; then
read -r -p "Nvidia GPU detected. Do you want to install Nvidia drivers (akmod-nvidia)? (y/N) " wants_nvidia
if [[ $wants_nvidia == "y" || $wants_nvidia == "Y" ]]; then
sudo dnf install akmod-nvidia -y
echo "Done!"
else
echo "Skipping..."
fi
else
echo "System is not using Nvidia."
fi
}
# Create hid_apple.conf and append options to fix bluetooth FN key problems
# /etc/modprobe.d/hid_apple.conf
# options hid_apple fnmode=0
hid_apple_patch() {
# Create the hid_apple.conf file if it doesn't exist
if [ ! -f /etc/modprobe.d/hid_apple.conf ]; then
sudo touch /etc/modprobe.d/hid_apple.conf
fi
echo "options hid_apple fnmode=0" | sudo tee -a /etc/modprobe.d/hid_apple.conf
sudo modprobe -r hid_apple
sudo modprobe hid_apple
}
# Create flags.conf to /etc/dracut.conf.d/ to allow using bluetooth keyboard when decrypting
# Added flags:
# hostonly="yes"
# add_dracutmodules+=" bluetooth "
add_dracut_flags() {
# Create the flags.conf file if it doesn't exist
if [ ! -f /etc/dracut.conf.d/flags.conf ]; then
sudo touch /etc/dracut.conf.d/flags.conf
fi
echo "hostonly=\"yes\"" | sudo tee -a /etc/dracut.conf.d/flags.conf
echo "add_dracutmodules+=\" bluetooth \"" | sudo tee -a /etc/dracut.conf.d/flags.conf
# Regenerate the initramfs to apply the changes
sudo dracut --regenerate-all --force --verbose
}
# Install tor, enable it and install tor launcher
install_tor() {
sudo dnf install tor torbrowser-launcher -y
sudo systemctl enable tor
}
# Install user specified software if any
install_selection() {
for package in "$@"; do
if sudo dnf install -y "$package"; then
# Package installed successfully from DNF
echo "Package '$package' installed successfully from DNF."
else
echo "Not found from DNF, trying flatpak..."
sleep 1
if flatpak install -y "$package"; then
# Package installed successfully from Flatpak
echo "Package '$package' installed successfully from Flatpak."
else
# Package not available in either DNF or Flatpak, print an error message
echo "Error: Package '$package' not found in DNF or Flatpak repositories."
fi
fi
done
}
# Install zsh and oh-my-zsh (https://ohmyz.sh/)
setup_shell() {
echo "Installing zsh..."
sudo dnf install zsh -y
echo "Running the oh-my-zsh setup script..."
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
}
# Main
# ------------
echo "FQS (Fedora Quick Start) Script"
echo
echo "Finish your post installation steps easily."
echo
echo "By Vili (https://vili.dev/)"
echo
echo "You will be asked for the sudo password!"
echo
read -r -p "Do you want to continue with this script? (y/N) " input
if [[ $input == "y" || $input == "Y" ]]; then
echo "Starting with an system update & upgrade..."
sleep 2
sys_update
echo "Done!"
echo
echo "Now enabling RPM Fusion repos..."
sleep 2
add_rpm_repos
echo "Done!"
echo
echo "Now enabling flathub repos..."
sleep 2
add_flatpak_repos
echo "Done!"
echo
echo "Now speeding up dnf..."
sleep 2
append_dnf_configs
echo "Done!"
echo
echo "Checking if you are using a Nvidia GPU..."
sleep 2
needs_nvidia
echo
echo "Now comes the user selections, read and answer carefully!"
sleep 2
echo
read -r -p "If you use a bluetooth keyboard and your fn key doesn't work correctly (hid_apple fnmode), do you want to patch that? (y/N) " wants_hidapple_patch
if [[ $wants_hidapple_patch == "y" || $wants_hidapple_patch == "Y" ]]; then
hid_apple_patch
echo "Done!"
else
echo "Skipping hid_apple patching..."
fi
echo
sleep 1
read -r -p "If you use a bluetooth keyboard, do you want to allow bluetooth keyboard usage during the device decryption? This will regenerate initramfs with the new flags. (y/N) " wants_dracut_patch
if [[ $wants_dracut_patch == "y" || $wants_dracut_patch == "Y" ]]; then
add_dracut_flags
echo "Done!"
else
echo "Skipping adding dracut flags..."
fi
sleep 1
read -r -p "Do you want to install a different browser, instead of using the default one (Firefox)? (y/N) " wants_browser
if [[ $wants_browser == "y" || $wants_browser == "Y" ]]; then
install_browser
echo "Done!"
else
echo "Going with the default browser..."
fi
echo
read -r -p "Do you want to install any communication apps? (y/N) " wants_communication
if [[ $wants_communication == "y" || $wants_communication == "Y" ]]; then
install_communication
echo "Done!"
else
echo "Skipping installing communication apps..."
fi
echo
read -r -p "Do you want to install a code editor? (y/N) " wants_code_editor
if [[ $wants_code_editor == "y" || $wants_code_editor == "Y" ]]; then
install_code_editor
echo "Done!"
else
echo "Skipping code editor installation..."
fi
echo
read -r -p "Do you want to install useful development tools, such as git, android-tools, nodejs, npm, python3-pip..? (y/N) " wants_dev_tools
if [[ $wants_dev_tools == "y" || $wants_dev_tools == "Y" ]]; then
add_dev_tools
echo "Done!"
else
echo "Skipping devtools installation..."
fi
echo
read -r -p "Do you want to install tor, torbrowser and enable the tor service? (y/N) " wants_tor
if [[ $wants_tor == "y" || $wants_tor == "Y" ]]; then
install_tor
echo "Done!"
else
echo "Skipping tor installation..."
fi
echo
read -r -p "Do you want to install anything else? (y/N) " extra_installs
if [[ $extra_installs == "y" || $extra_installs == "Y" ]]; then
read -r -p "Alright, what do you want to install? (separated by spaces, for example 'discord spotify gimp') " software
echo "Installing $software..."
install_selection "$software"
echo "Done!"
sleep 1
else
echo "Skipping optional software installation..."
fi
echo
read -r -p "Lastly, do you want to install and setup a better shell? (zsh with oh-my-zsh framework) (y/N) " wants_shell
if [[ $wants_shell == "y" || $wants_shell == "Y" ]]; then
echo "Installing zsh and oh-my-zsh..."
sleep 2
setup_shell
echo "Done!"
else
echo "Skipping better shell setup..."
echo "This was the last step, goodbye!"
fi
else
echo "Cancelled, Goodbye!"
fi