Skip to content

Instantly share code, notes, and snippets.

@BladeWDR
Created December 8, 2024 21:36
Show Gist options
  • Save BladeWDR/e9c4d794458ec7715133f25a4318ed4e to your computer and use it in GitHub Desktop.
Save BladeWDR/e9c4d794458ec7715133f25a4318ed4e to your computer and use it in GitHub Desktop.
Fedora setup script for SwayWM
#!/usr/bin/env bash
# Fedora installation helper script.
# I tend to build these from the server installer for a cleaner system
# So there's quite a few packages missing.
set -eou pipefail
# vars
# Various packages
declare -a pkgs=(
"alacritty"
"automake"
"bind9-next-utils"
"cifs-utils"
"direnv"
"discord"
"fastfetch"
"firefox"
"fzf"
"gcc"
"gcc-c++"
"gdm"
"google-chrome-stable"
"jq"
"kernel-devel"
"lazygit"
"libreoffice"
"librewolf"
"lzop"
"make"
"mbuffer"
"mhash"
"mullvad-vpn"
"neovim"
"nfs-utils"
"pavucontrol"
"perl-Capture-Tiny"
"perl-Config-IniFiles"
"perl-Data-Dumper"
"perl-Getopt-Long"
"pv"
"python3-pip"
"ranger"
"syncthing"
"tar"
"telegram"
"thunderbird"
"tmux"
"unzip"
"w3m"
"wdisplays"
"zsh"
"zsh-autosuggestions"
"zsh-syntax-highlighting"
)
declare -a grppkgs=(
"multimedia"
"sound-and-video"
"swaywm"
)
declare -a dnfopts=(
"--assumeyes"
"--setopt=localpkg_gpgcheck=0"
"--setopt=gpgcheck=1"
)
# Update the system
sudo dnf --assumeyes upgrade
if [[ -f /var/run/reboot-required ]]; then
echo "##### WARNING: a previous update requires a reboot."
echo "It may be advisable to reboot your system before proceeding."
read -p "Y/N?" input
if [[ $input != "y" ]] && [[ $input != "Y" ]]; then
exit
fi
fi
# Install RPM Fusion Repo (For non-free codecs, H264 hardware acceleration support, etc).
sudo dnf "${dnfopts[@]}" install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
# Enable COPR repo for lazygit
sudo dnf "${dnfopts[@]}" copr enable atim/lazygit -y
# Enable Google Chrome repository
sudo dnf "${dnfopts[@]}" install fedora-workstation-repositories
sudo dnf "${dnfopts[@]}" config-manager setopt google-chrome.enabled=1
# Add Librewolf repository
curl -fsSL https://repo.librewolf.net/librewolf.repo | sudo tee /etc/yum.repos.d/librewolf.repo
# Add Mullvad VPN repository for their desktop client.
if [[ ! -f /etc/yum.repos.d/mullvad.repo ]]; then
sudo dnf "${dnfopts[@]}" config-manager addrepo --from-repofile=https://repository.mullvad.net/rpm/stable/mullvad.repo
fi
# All group installs
sudo dnf "${dnfopts[@]}" group install "${grppkgs[@]}"
# Install all the listed packages
sudo dnf "${dnfopts[@]}" install "${pkgs[@]}"
# Set the graphical target as default
sudo systemctl set-default graphical.target
# Set GTK to prefer dark themes.
gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'
# set default shell to zsh
zshpath=$(which zsh)
sudo chsh -s "$zshpath" $USER
# Enable and start the syncthing service.
if ! systemctl is-active --quiet "syncthing@$USER.service"; then
sudo systemctl enable "syncthing@$USER.service" && sudo systemctl start "syncthing@$USER.service"
fi
# Start GDM (This should launch the graphical environment.)
if ! systemctl is-active --quiet gdm; then
sudo systemctl start gdm
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment