#!/bin/bash # global var DISTRO="" function get_distribution() { if [[ -e /etc/debian_version ]]; then source /etc/os-release if [[ $ID == "debian" || $ID == "raspbian" ]]; then DISTRO="debian" elif [[ $ID == "ubuntu" ]]; then DISTRO="ubuntu" fi elif [[ -e /etc/system-release ]]; then DISTRO="fedora" elif [[ -e /etc/arch-release ]]; then DISTRO="arch" else whiptail --title "Error" --msgbox "Incompatible Linux Distribution." 8 78 exit 1 fi echo "Detected distribution $DISTRO" } function update_system() { if (whiptail --title "System Update" --yesno "Should we update the system?" 8 78); then echo "Updating system..." if [[ $DISTRO =~ (debian|ubuntu) ]]; then sudo apt update && sudo apt upgrade -y elif [[ $DISTRO == "fedora" ]]; then sudo dnf up -y elif [[ $DISTRO == "arch" ]]; then sudo pacman -Syu --noconfirm fi whiptail --title "Success" --msgbox "Update done!" 8 78 fi } function install_general_tools_software() { if [[ $DISTRO =~ (debian|ubuntu) ]]; then sudo apt install linux-headers-amd64 sudo nano git curl wget htop btop scrcpy vlc geary -y elif [[ $DISTRO == "fedora" ]]; then sudo dnf in kernel-devel sudo nano git curl wget htop btop scrcpy vlc geary -y elif [[ $DISTRO == "arch" ]]; then sudo pacman -S --needed linux-headers dkms base-devel sudo nano git curl wget htop btop scrcpy vlc geary --noconfirm fi } function setup_repo() { if [[ $DISTRO =~ (debian|ubuntu) ]]; then sudo apt install ca-certificates software-properties-gtk -y sudo curl https://repo.waydro.id | sudo bash sudo add-apt-repository ppa:o2sh/onefetch sudo add-apt-repository ppa:oguzhaninan/stacer sudo add-apt-repository ppa:serge-rider/dbeaver-ce sudo echo 'deb http://download.opensuse.org/repositories/hardware:/razer/Debian_12/ /' | sudo tee /etc/apt/sources.list.d/hardware:razer.list sudo curl -fsSL https://download.opensuse.org/repositories/hardware:razer/Debian_12/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/hardware_razer.gpg > /dev/null sudo apt update elif [[ $DISTRO == "fedora" ]]; then sudo dnf copr enable varlad/onefetch -y sudo dnf copr enable atim/heroic-games-launcher -y sudo dnf copr enable atim/starship -y sudo dnf copr enable zeno/scrcpy -y sudo flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo VERSION=$(rpm -q --queryformat '%{VERSION}' fedora-release) if [[ $VERSION =~ ^[0-9]+$ ]]; then sudo dnf config-manager --add-repo "https://download.opensuse.org/repositories/hardware:razer/Fedora_$(rpm -E %fedora)/hardware:razer.repo" sudo flatpak remote-add --if-not-exists launcher.moe https://gol.launcher.moe/gol.launcher.moe.flatpakrepo else sudo dnf config-manager --add-repo 'https://download.opensuse.org/repositories/hardware:razer/Fedora_Rawhide/hardware:razer.repo' sudo dnf config-manager --add-repo 'https://download.opensuse.org/repositories/home:/Maroxy:/AAT-Apps/Fedora_Rawhide/home:Maroxy:AAT-Apps.repo' fi sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc if [ ! -e /etc/yum.repos.d/vscode.repo ]; then sudo sh -c '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" > /etc/yum.repos.d/vscode.repo' fi elif [[ $DISTRO == "arch" ]]; then if ! grep -q "chaotic-aur" /etc/pacman.conf; then yes | sudo pacman-key --recv-key 3056513887B78AEB --keyserver keyserver.ubuntu.com yes | sudo pacman-key --lsign-key 3056513887B78AEB sudo pacman -U 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-keyring.pkg.tar.zst' 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-mirrorlist.pkg.tar.zst' --noconfirm echo -e '[chaotic-aur]\nInclude = /etc/pacman.d/chaotic-mirrorlist' | sudo tee -a /etc/pacman.conf else echo Chaotic-AUR already setup fi if ! grep -q "blackarch" /etc/pacman.conf; then curl -sSL https://blackarch.org/strap.sh | sudo bash else echo BlackArch already setup fi sudo pacman -S --needed yay --noconfirm fi } function install_distro_specific_packages() { if [[ $DISTRO =~ (debian|ubuntu) ]]; then sudo apt install stacer qbittorrent -y elif [[ $DISTRO == "fedora" ]]; then sudo dnf in starship stacer qbittorrent -y sudo flatpak install flathub com.moonlight_stream.Moonlight -y --noninteractive --system sudo flatpak install flathub io.github.thaunknown.miru -y --noninteractive --system sudo flatpak install flathub com.stremio.Stremio -y --noninteractive --system elif [[ $DISTRO == "arch" ]]; then # Base and utility packages sudo pacman -S --needed --noconfirm jshon expac acpid avahi net-tools xdg-user-dirs p7zip unrar unzip unace xz rsync nfs-utils cifs-utils ntfs-3g exfat-utils gvfs udisks2 starship macchanger plymouth plymouth-kcm breeze-plymouth # Firmware/Drivers packages sudo pacman -S --needed --noconfirm mkinitcpio-firmware mesa lib32-mesa vulkan-icd-loader lib32-vulkan-icd-loader # Printer sudo pacman -S --needed --noconfirm system-config-printer foomatic-db foomatic-db-engine gutenprint gsfonts cups cups-pdf cups-filters sane skanlite hplip # Network sudo pacman -S --needed --noconfirm networkmanager networkmanager-openvpn networkmanager-pptp networkmanager-vpnc wireless_tools wpa_supplicant ifplugd dialog bluez bluez-utils # Sound sudo pacman -S --needed --noconfirm alsa-utils pipewire pipewire-pulse pipewire-jack wireplumber pavucontrol-qt # Apps sudo pacman -S --needed --noconfirm moonlight-qt stremio onlyoffice-bin qbittorrent stacer yay -S --needed --noconfirm miru-bin sudo systemctl enable acpid avahi-daemon systemd-timesyncd fstrim.timer cups.service saned.socket NetworkManager bluetooth sudo gpasswd -a "$USER" adbusers sudo plymouth-set-default-theme -R spinner fi } function install_fetch() { if [[ $DISTRO =~ (debian|ubuntu) ]]; then sudo apt install fastfetch onefetch -y elif [[ $DISTRO == "fedora" ]]; then sudo dnf in fastfetch onefetch -y elif [[ $DISTRO == "arch" ]]; then sudo pacman -S --needed fastfetch onefetch --noconfirm fi if [ -e ~/.bashrc ]; then if ! grep -q "fastfetch" ~/.bashrc; then echo "fastfetch" >> ~/.bashrc fi fi if [ -e ~/.zshrc ]; then if ! grep -q "fastfetch" ~/.zshrc; then echo "fastfetch" >> ~/.zshrc fi fi } function install_browser() { if (whiptail --title "Web Browser" --yesno "Should we install web browsers?" 8 78); then echo "Installing browsers..." if [[ $DISTRO =~ (debian|ubuntu) ]]; then sudo apt install firefox chromium torbrowser-launcher -y elif [[ $DISTRO == "fedora" ]]; then sudo dnf in firefox chromium tor torbrowser-launcher -y elif [[ $DISTRO == "arch" ]]; then sudo pacman -S --needed firefox chromium tor tor-browser --noconfirm fi fi } function install_gaming() { if (whiptail --title "Gaming" --yesno "Should we install game launchers and game optimization packages?" 8 78); then echo "Installing gaming packages..." if [[ $DISTRO =~ (debian|ubuntu) ]]; then sudo apt install steam gamescope gamemode mangohud lutris discord -y elif [[ $DISTRO == "fedora" ]]; then if [[ $VERSION =~ ^[0-9]+$ ]]; then sudo dnf in steam gamescope gamemode mangohud lutris discord protonup-qt heroic-games-launcher-bin -y sudo flatpak install launcher.moe moe.launcher.an-anime-game-launcher -y sudo flatpak install launcher.moe moe.launcher.honkers-launcher -y sudo flatpak install launcher.moe moe.launcher.the-honkers-railway-launcher -y else sudo dnf in steam gamescope gamemode mangohud lutris discord protonup-qt heroic-games-launcher-bin an-anime-game-launcher honkers-launcher the-honkers-railway-launcher -y fi elif [[ $DISTRO == "arch" ]]; then sudo pacman -S --needed steam gamescope gamemode mangohud lutris discord protonup-qt heroic-games-launcher-bin an-anime-game-launcher-bin --noconfirm yay -S --needed honkers-launcher-bin the-honkers-railway-launcher-bin --noconfirm fi fi } function install_virt() { if (whiptail --title "Virtualization" --yesno "Should we install KVM and containers packages?" 8 78); then if [[ $DISTRO =~ (debian|ubuntu) ]]; then sudo apt install qemu-system libvirt-daemon-system virt-manager distrobox podman waydroid -y elif [[ $DISTRO == "fedora" ]]; then sudo dnf in libvirt lxc libvirt-daemon-lxc virt-manager distrobox podman waydroid -y elif [[ $DISTRO == "arch" ]]; then sudo pacman -S --needed libvirt libvirt-storage-gluster libvirt-storage-iscsi-direct virt-firmware virt-viewer virt-manager lxc lxcfs distrobox podman waydroid --noconfirm fi sudo systemctl enable libvirtd waydroid-container fi } function install_u2f() { if (whiptail --title "U2F" --yesno "Should we install U2F packages?" 8 78); then echo "Installing U2F support..." if [[ $DISTRO =~ (debian|ubuntu) ]]; then sudo apt install yubikey-manager yubikey-personalization yubioath-desktop -y elif [[ $DISTRO == "fedora" ]]; then sudo dnf in fedora-packager-yubikey libyubikey pam_yubico yubico-piv-tool yubikey-manager yubikey-personalization-gui -y sudo flatpak install flathub com.yubico.yubioath -y --noninteractive --system elif [[ $DISTRO == "arch" ]]; then sudo pacman -S --needed yubico-pam yubikey-full-disk-encryption yubikey-manager-qt yubikey-personalization yubikey-personalization-gui yubikey-touch-detector yubioath-desktop --noconfirm fi fi } function install_openrazer() { if (whiptail --title "OpenRazer" --yesno "Should we install OpenRazer?" 8 78); then if [[ $DISTRO =~ (debian|ubuntu) ]]; then sudo apt install openrazer-meta -y elif [[ $DISTRO == "fedora" ]]; then sudo dnf in openrazer-meta -y sudo rpm -e gpg-pubkey-d6d11ce4-5418547d sudo dnf in --nogpgcheck polychromatic -y elif [[ $DISTRO == "arch" ]]; then sudo pacman -S --needed polychromatic openrazer-meta --noconfirm fi sudo gpasswd -a "$USER" plugdev fi } function install_terminal() { if (whiptail --title "Terminal/shell" --yesno "Should we install terminal and shell packages?" 8 78); then if [[ $DISTRO =~ (debian|ubuntu) ]]; then sudo apt install alacritty kitty zsh -y elif [[ $DISTRO == "fedora" ]]; then sudo dnf in alacritty kitty kitty-bash-integration zsh autojump-zsh zsh-autosuggestions zsh-syntax-highlighting -y elif [[ $DISTRO == "arch" ]]; then sudo pacman -S --needed alacritty kitty kitty-shell-integration kitty-terminfo zsh zsh-autosuggestions zsh-completions zsh-history-substring-search zsh-lovers zsh-syntax-highlighting --noconfirm sudo chsh -s /usr/bin/zsh "$USER" fi fi } function install_dev() { if (whiptail --title "Development" --yesno "Should we install development packages?" 8 78); then if [[ $DISTRO =~ (debian|ubuntu) ]]; then sudo apt install mariadb-server dbeaver-ce remmina -y elif [[ $DISTRO == "fedora" ]]; then sudo dnf in mariadb-server https://dbeaver.io/files/dbeaver-ce-latest-stable.x86_64.rpm code android-tools remmina remmina-gnome-session remmina-plugins-exec remmina-plugins-rdp remmina-plugins-spice remmina-plugins-vnc remmina-plugins-www remmina-plugins-x2go -y elif [[ $DISTRO == "arch" ]]; then sudo pacman -S --needed mariadb dbeaver dbeaver-plugin-office dbeaver-plugin-svg-format dbeaver-plugin-apache-poi visual-studio-code-bin android-tools android-udev remmina --noconfirm fi fi } function install_gpu_drivers() { if (whiptail --title "GPU" --yesno "Should we install GPU drivers?" 8 78); then # NVIDIA if lspci | grep -i nvidia &>/dev/null; then if [[ $DISTRO =~ (debian|ubuntu) ]]; then sudo apt install nvidia-driver firmware-misc-nonfree nvidia-vdpau-driver libnvcuvid1 libnvidia-encode1 nvidia-vaapi-driver -y elif [[ $DISTRO == "fedora" ]]; then sudo dnf in akmod-nvidia dkms-nvidia nvidia-driver xorg-x11-drv-nvidia-cuda nvidia-vaapi-driver mesa-vdpau-drivers ffmpeg libavcodec-freeworld -y if [ -d "/sys/class/power_supply/BAT0" ]; then sudo dnf in supergfxctl -y fi elif [[ $DISTRO == "arch" ]]; then sudo pacman -S --needed --noconfirm nvidia-open-dkms nvidia-settings nvidia-utils lib32-nvidia-utils libvdpau lib32-libvdpau yay -S --needed --noconfirm libva-nvidia-driver if [ -d "/sys/class/power_supply/BAT0" ]; then sudo pacman -S --needed --noconfirm supergfxctl fi fi fi # AMD if lspci | grep -Ei "vga|3d|display" | grep -i amd &>/dev/null; then if [[ $DISTRO =~ (debian|ubuntu) ]]; then sudo apt install firmware-amd-graphics libgl1-mesa-dri libglx-mesa0 mesa-vulkan-drivers xserver-xorg-video-all mesa-va-drivers vdpau-driver-all -y elif [[ $DISTRO == "fedora" ]]; then sudo dnf in xorg-x11-drv-amdgpu mesa-vdpau-drivers mesa-va-drivers libavcodec-freeworld -y elif [[ $DISTRO == "arch" ]]; then sudo pacman -S --needed --noconfirm xf86-video-amdgpu libva-mesa-driver lib32-libva-mesa-driver vulkan-radeon lib32-vulkan-radeon mesa-vdpau lib32-mesa-vdpau fi fi # INTEL if lspci | grep -Ei "vga|3d|display" | grep -i intel &>/dev/null; then if [[ $DISTRO =~ (debian|ubuntu) ]]; then sudo apt install xserver-xorg-core intel-media-va-driver -y elif [[ $DISTRO == "fedora" ]]; then sudo dnf in xorg-x11-drv-intel intel-media-driver ffmpeg libavcodec-freeworld -y elif [[ $DISTRO == "arch" ]]; then sudo pacman -S --needed --noconfirm intel-media-driver linux-firmware vulkan-intel fi fi fi } echo -e "\e[1;31mWARNING: This script assumes a standard Debian/Fedora/Arch install.\e[0m" read -p "Are you sure you want to continue? [N/y] " response if [[ "$response" =~ ^[Yy]$ ]]; then echo "Continuing..." get_distribution update_system install_general_tools_software setup_repo install_distro_specific_packages install_fetch install_browser install_gaming install_virt install_u2f install_openrazer install_terminal install_dev else echo "Script execution aborted." exit 1 fi