This repository was archived by the owner on Nov 11, 2023. It is now read-only.
forked from devangshekhawat/Fedora-44-Post-Install-Guide
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
179 lines (141 loc) · 5.61 KB
/
Copy pathsetup.sh
File metadata and controls
179 lines (141 loc) · 5.61 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
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
#!/bin/bash
function print_ascii_art {
clear
echo " .~~~~\~~\\"
echo " ; ~~ \\"
echo " | ;"
echo " ,--------,______|---."
echo "/ \-----\ \\"
echo "\`.__________\`-_______-'"
echo ""
echo "trilby"
echo " "
}
print_ascii_art
sleep 1
echo "First, a couple of questions..."
sleep 1
# Prompt user if they're on a laptop
read -p "Are you using Fedora on a laptop? (y/N)" laptop_input
# Prompt user if they want to configure OhMyZsh
read -p "Would you like to have OhMyZsh set up for you? This will also install the Starship theme and make it run in your terminal by default. (y/N)" zsh_input
# Prompt user if they want to restore minimize/maximize buttons
read -p "Would you like to restore minimize/maximize buttons? (y/N)" minmax_input
# Prompt user to change hostname
read -p "Would you like to change your hostname? (y/N) " hostname_input
if [[ $hostname_input =~ ^[Yy]$ ]]; then
# Prompt user for new hostname
read -p "Enter new hostname: " new_hostname
fi
print_ascii_art
echo "Alright, boring part's over. Starting setup..."
sleep 1
# Create folder for downloads
mkdir ~/.trilby
# Save CPU info to variable
cpu_info=$(lscpu)
# Update dnf configuration
echo "[main]
gpgcheck=1
installonly_limit=3
clean_requirements_on_remove=True
best=False
skip_if_unavailable=True
fastestmirror=1
max_parallel_downloads=10
deltarpm=true" | sudo tee /etc/dnf/dnf.conf
# Update system
sudo dnf -y update
sudo dnf -y upgrade --refresh
# Enable RPM Fusion repositories
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 groupupdate -y core
# Install multimedia codecs
sudo dnf groupupdate -y multimedia --setop="install_weak_deps=False" --exclude=PackageKit-gstreamer-plugin
sudo dnf groupupdate -y sound-and-video
sudo dnf install -y gstreamer1-plugins-{bad-\*,good-\*,base} gstreamer1-plugin-openh264 gstreamer1-libav --exclude=gstreamer1-plugins-bad-free-devel ffmpeg gstreamer-ffmpeg
sudo dnf install -y lame\* --exclude=lame-devel
sudo dnf group upgrade -y --with-optional Multimedia
# Update flatpaks
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak update
if [[ $laptop_input =~ ^[Yy]$ ]]; then
# Install and run TLP and powertop to improve battery life
sudo dnf install -y tlp tlp-rdw
sudo systemctl mask power-profiles-daemon
sudo dnf install -y powertop
sudo powertop --auto-tune
# Install auto-cpufreq for performance improvements
cd ~/.trilby && git clone https://github.com/AdnanHodzic/auto-cpufreq.git
chmod +x ./auto-cpufreq/auto-cpufreq-installer
sudo ./auto-cpufreq/auto-cpufreq-installer
sudo auto-cpufreq --install
cd ~
# Check CPU for Intel or AMD and install video acceleration packages accordingly
if echo "$cpu_info" | grep -q "Intel"; then
echo "Installing Intel video acceleration packages..."
sudo dnf install ffmpeg ffmpeg-libs libva libva-utils intel-media-driver
elif echo "$cpu_info" | grep -q "AMD"; then
echo "Installing AMD video acceleration packages..."
sudo dnf install ffmpeg ffmpeg-libs libva libva-utils mesa-va-drivers-freeworld
else
echo "CPU vendor is not recognized. Video acceleration packages will not be installed."
fi
fi
# Improve security
sudo dnf install -y ufw fail2ban
sudo systemctl enable --now ufw.service
sudo systemctl disable --now firewalld.service
cd ~/.trilby && git clone https://github.com/ChrisTitusTech/secure-linux
chmod +x ./secure-linux/secure.sh
sudo ./secure-linux/secure.sh
cd ~
# Optimize boot time
if echo "$cpu_info" | grep -q "Intel"; then
echo -e "\nGRUB_CMDLINE_LINUX_DEFAULT=\"intel_idle.max_cstate=1 cryptomgr.notests initcall_debug intel_iommu=igfx_off no_timer_check noreplace-smp page_alloc.shuffle=1 rcupdate.rcu_expedited=1 tsc=reliable quiet splash video=SVIDEO-1:d\"" | sudo tee -a /etc/default/grub
if [ -f "/sys/firmware/efi" ];
then
sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
else
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
fi
sudo systemctl disable NetworkManager-wait-online.service
elif echo "$cpu_info" | grep -q "AMD"; then
sudo systemctl disable NetworkManager-wait-online.service
else
echo "CPU vendor is not recognized. Boot time optimization skipped."
fi
# Install fonts
sudo dnf install -y jetbrains-mono-fonts-all terminus-fonts terminus-fonts-console google-noto-fonts-common mscore-fonts-all fira-code-fonts
mkdir ~/.fonts && git -C ~/.fonts clone https://github.com/thelioncape/San-Francisco-family
# Configure OhMyZsh
sudo dnf -y install zsh util-linux-user
sh -c "$(curl -fsSL $OH_MY_ZSH_URL)"
chsh -s "$(which zsh)"
curl -sS https://starship.rs/install.sh | sh
echo "eval "$(starship init zsh)"" >> ~/.zshrc
# Install Extension Manager
flatpak install -y flathub com.mattjakeman.ExtensionManager
# Install GNOME Tweaks
sudo dnf install -y gnome-tweaks
# Restore minimize/maximize buttons
if [[ $minmax_input =~ ^[Yy]$ ]]; then
sudo gsettings set org.gnome.desktop.wm.preferences button-layout ":minimize,maximize,close"
fi
# Set new hostname
if [[ $hostname_input =~ ^[Yy]$ ]]; then
hostnamectl set-hostname $new_hostname
fi
# Clean up
sudo rm -rf ~/.trilby
sudo dnf -y update
sudo dnf -y autoremove
print_ascii_art
echo "All done. You should reboot to finalize these changes."
read -p "Would you like to reboot now? (y/N)" reboot_input
echo "See ya!"
sleep 1
if [[ $reboot_input =~ ^[Yy]$ ]]; then
reboot
fi