The script runs fine, and it seems to be working correctly. I'm looking for some criticism of the structure of the code, errors, bad practices, beginner's pitfalls, and bad code in general. I'm looking forward to improving my understanding of shell scripting.
#!/bin/bash
#Setting variables according to user preferences.
echo "What is it going to be your hostname?"
read -r yourname
echo "Is this a laptop, (1)YES, (0)NO?"
read -r laptopyn
echo "the CPU is INTEL(1) or AMD(0)"
read -r cpu
echo "If you would like to reenter the information type (1)YES; (2)NO"
read -r again
#Loop back to first echo if again -eq 1
#if [ $again -eq 1 ]
#Setting hostname.
echo ">>>>Setting you up Champ"
echo "$yourname are you sure?"
sleep 2
hostnamectl set-hostname "$yourname"
echo "Your hostname is set to:"
hostname
sleep 2
#Updating OS & disable NtwrkMngr-wait
echo ">>>>Starting updates"
sudo dnf -y upgrade
sudo dnf -y upgrade --refresh
sudo dnf -y update
sudo dnf -y groupupdate core
sudo fwupdmgr refresh --force
sudo fwupdmgr update --force
sudo systemctl disable NetworkManager-wait-online.service
echo ">>>>You are up to date 1/10 "
sleep 1
#Downloading, Installing & Cp already customized conf file to correct path
echo ">>>>Installing Kitty terminal"
sudo dnf install wget -y
sudo dnf -y install vim
sudo dnf -y install kitty
#conf file missing the correct font:.Iosevak
sudo cp -r ~/basicfedorasetup/kitty.conf ~/.config/kitty/
echo ">>>>Kitty INSTALLED and setup 2/10"
#Enabling rpm-fusion & flatpak Repositories
echo ">>>>Sarting with the repo's"
sudo dnf install -y https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
echo ">>>>rpmfusion INSTALLED 3/10"
sudo dnf install -y flatpak
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
echo ">>>>flatpack INSTALLED 4/10"
sleep 2
#Installing essential software "for my use case & preferences"
echo ">>>>Installing essentials"
sudo dnf install -y 'google-roboto*' 'mozilla-fira*' fira-code-fonts
flatpak install flathub -y com.mattjakeman.ExtensionManager
sudo dnf install -y unzip p7zip p7zip-plugins unrar
sudo dnf install -y gnome-tweaks
sudo dnf install -y gimp
sudo dnf install -y gimp-devel
sudo dnf install -y nautilus-python
echo ">>>>google-roboto mozilla-firra,flathpak,unzip,gnome-tweaks,gimp,nautilus-python; INSTALLED 5/10"
#Installing some of my most ,non native, used commands
echo ">>>>Installing Commands"
sudo dnf install -y tmux
sudo dnf install -y iostat
sudo dnf install -y htop
sudo dnf install -y copr-cli
rpm -q cronie
rpm -q cronie-anacron
sudo dnf install -y cronie
sudo dnf install -y cronie-anacron
echo ">>>>tmux,iostat,htop,copr-cli,cronie,cronie-anacron; INSTALLED 6/10"
#Installing most of the software with visual interface that i'm using
echo ">>>>Installing Basic Software"
flatpak install -y flathub com.google.Chrome
flatpak install -y flathub com.discordapp.Discord
flatpak install -y flathub com.spotify.Client
sudo dnf copr enable -y jerrycasiano/FontManager
sudo dnf install -y font-manager
echo ">>>Chrome,Discord,Spotify,Font-Manager; INSTALLED 7/10"
sleep 2
#If marked as 1(YES), then installing battery optmazation for laptops
if [ "$laptopyn" -eq 1 ]
then
echo ">>>>Starting Laptop Optimazation"
sudo dnf -y install tlp tlp-rdw
sudo systemctl mask power-profiles-daemon
sudo dnf install -y powertop
sudo powertop --auto-tune
echo ">>>>Laptop Optimazation DONE 8/10"
else
echo ">>>>This isn't a laptop"
echo ">>>>OK 8/10"
sleep 2
fi
#Multimedia drivers
echo ">>>>Sound&Video"
sudo dnf update -y @sound-and-video
sudo dnf install -y Multimedia
sudo dnf install -y ffmpeg ffmpeg-libs libva libva-utils --allowerasing
echo ">>>>Sound&Video drivers DONE 9/10"
#CPU brand specific drivers.
if [ "$cpu" -eq 1 ]
then
echo ">>>>Installing Intel drivers"
sudo dnf -y swap libva-intel-media-driver intel-media-driver --allowerasing
else
echo ">>>>Installing AMD drivers"
sudo dnf -y swap mesa-va-drivers mesa-va-drivers-freeworld
sudo dnf -y swap mesa-vdpau-drivers mesa-vdpau-drivers-freeworld
fi
echo "CPU drivers DONE 10/10"
#Done, maybe
echo ">>>>ALL SET AND READY"
sleep 2
echo ">>>>>Your machine will be restarted in 5sec for all changes to take place"
sleep 5
sudo reboot