#!/bin/bash # global var DISTRO="" function getDistributionType() { echo "Detecting 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 checkWhiptail() { echo "Checking whiptail..." if ! command -v whiptail &>/dev/null; then if [[ $DISTRO =~ (debian|ubuntu) ]]; then sudo apt install whiptail -y elif [[ $DISTRO == "fedora" ]]; then sudo dnf in newt -y elif [[ $DISTRO == "arch" ]]; then sudo pacman -S --needed --noconfirm libnewt fi fi echo "Whiptail installed." } function updateSystem() { 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 installBasicPackages() { echo "Installing basic packages..." if [[ $DISTRO =~ (debian|ubuntu) ]]; then sudo apt install sudo nano bat git curl wget htop btop flatpak -y elif [[ $DISTRO == "fedora" ]]; then sudo dnf in sudo nano bat git curl wget htop btop flatpak -y elif [[ $DISTRO == "arch" ]]; then sudo pacman -S --needed --noconfirm sudo nano bat git curl wget htop btop noto-fonts-emoji noto-fonts-extra noto-fonts-cjk flatpak if [ -d "/sys/class/power_supply/BAT0" ]; then sudo pacman -S --needed --noconfirm tlp sudo systemctl enable --now tlp fi fi } function setupRepositories() { echo "Setting up repositories..." echo "Enabling flatpak..." sudo flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo sudo flatpak remote-add --if-not-exists launcher.moe https://gol.launcher.moe/gol.launcher.moe.flatpakrepo echo "Enabling third-party repositories..." if [[ $DISTRO =~ (debian|ubuntu) ]]; then sudo apt install ca-certificates software-properties-gtk gpg apt-transport-https firmware-misc-nonfree -y # Waydroid sudo curl https://repo.waydro.id | sudo bash # Signal wget -O- https://updates.signal.org/desktop/apt/keys.asc | gpg --dearmor > signal-desktop-keyring.gpg cat signal-desktop-keyring.gpg | sudo tee /usr/share/keyrings/signal-desktop-keyring.gpg > /dev/null echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/signal-desktop-keyring.gpg] https://updates.signal.org/desktop/apt xenial main' | sudo tee /etc/apt/sources.list.d/signal-xenial.list # VSC sudo apt-get install wget gpg wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg sudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" |sudo tee /etc/apt/sources.list.d/vscode.list > /dev/null rm -f packages.microsoft.gpg sudo apt update elif [[ $DISTRO == "fedora" ]]; then sudo dnf4 copr enable atim/heroic-games-launcher -y if grep -q "Rawhide" /etc/fedora-release; then sudo dnf4 config-manager --add-repo https://download.opensuse.org/repositories/hardware:/razer/Fedora_Rawhide/hardware:razer.repo -y sudo dnf in -y 'https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-rawhide.noarch.rpm' 'https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-rawhide.noarch.rpm' else sudo dnf config-manager --add-repo "https://download.opensuse.org/repositories/hardware:/razer/Fedora_$(rpm -E %fedora)/hardware:razer.repo" -y sudo dnf in -y "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" 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 installDistroSpecificPackages() { echo "Installing distribution specific packages..." if [[ $DISTRO =~ (debian|ubuntu) ]]; then echo "None for now" elif [[ $DISTRO == "fedora" ]]; then echo "None for now" elif [[ $DISTRO == "arch" ]]; then # Base and utility packages sudo pacman -S --needed --noconfirm net-tools xdg-user-dirs p7zip unrar unzip unace xz rsync nfs-utils cifs-utils gvfs plymouth # Firmware/Drivers packages sudo pacman -S --needed --noconfirm mkinitcpio-firmware linux-firmware # 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 bluez bluez-utils # Sound sudo pacman -S --needed --noconfirm alsa-utils pipewire pipewire-pulse pipewire-jack lib32-pipewire-jack wireplumber sudo systemctl enable fstrim.timer cups.service saned.socket NetworkManager bluetooth systemd-oomd sudo plymouth-set-default-theme -R spinner fi } function installGraphicsDrivers() { if (whiptail --title "Graphics Drivers" --yesno "Should we install graphics drivers?" 8 78); then echo "Installing graphics drivers..." if [[ $DISTRO =~ (debian|ubuntu) ]]; then sudo apt install ffmpeg vlc mpv -y if lspci | grep -i nvidia &>/dev/null; then sudo apt install nvidia-driver nvidia-vdpau-driver nvidia-vaapi-driver libnvcuvid1 libnvidia-encode1 -y fi if lspci | grep -Ei "vga|3d|display" | grep -i amd &>/dev/null; then sudo apt install mesa-va-drivers vdpau-driver-all -y fi if lspci | grep -Ei "vga|3d|display" | grep -i intel &>/dev/null; then sudo apt install intel-media-va-driver-non-free vdpau-driver-all -y fi elif [[ $DISTRO == "fedora" ]]; then sudo dnf swap ffmpeg-free ffmpeg --allowerasing -y sudo dnf in vlc mpv -y sudo dnf4 groupupdate multimedia --setopt="install_weak_deps=False" --exclude=PackageKit-gstreamer-plugin -y sudo dnf4 groupupdate sound-and-video -y if lspci | grep -i nvidia &>/dev/null; then sudo dnf install kmodtool akmods mokutil openssl -y sudo kmodgenca -a sudo mokutil --import /etc/pki/akmods/certs/public_key.der sudo dnf in akmod-nvidia xorg-x11-drv-nvidia-cuda nvidia-vaapi-driver -y fi if lspci | grep -Ei "vga|3d|display" | grep -i amd &>/dev/null; then sudo dnf swap mesa-va-drivers mesa-va-drivers-freeworld -y sudo dnf swap mesa-vdpau-drivers mesa-vdpau-drivers-freeworld -y fi if lspci | grep -Ei "vga|3d|display" | grep -i intel &>/dev/null; then sudo dnf in -y intel-media-driver fi elif [[ $DISTRO == "arch" ]]; then sudo pacman -S --needed ffmpeg vlc mpv --noconfirm if lspci | grep -i nvidia &>/dev/null; then if uname -r | grep -q "cachyos"; then sudo pacman -S --needed --noconfirm linux-cachyos-nvidia opencl-nvidia libva-vdpau-driver libva-nvidia-driver else if pacman -Qs nvidia > /dev/null; then sudo pacman -R --noconfirm nvidia elif pacman -Qs nvidia-dkms > /dev/null; then sudo pacman -R --noconfirm nvidia-dkms elif pacman -Qs xf86-video-nouveau > /dev/null; then sudo pacman -R --noconfirm xf86-video-nouveau fi sudo pacman -S --needed --noconfirm nvidia-open opencl-nvidia libva-vdpau-driver libva-nvidia-driver fi fi if lspci | grep -Ei "vga|3d|display" | grep -i amd &>/dev/null; then sudo pacman -S --needed --noconfirm libva-mesa-driver vulkan-radeon mesa-vdpau fi if lspci | grep -Ei "vga|3d|display" | grep -i intel &>/dev/null; then sudo pacman -S --needed --noconfirm intel-media-driver vulkan-intel fi fi else return fi } function setupFastfetch() { if [[ $DISTRO =~ (debian|ubuntu) ]]; then sudo apt install fastfetch -y elif [[ $DISTRO == "fedora" ]]; then sudo dnf in fastfetch -y elif [[ $DISTRO == "arch" ]]; then sudo pacman -S --needed fastfetch --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 if [ -e ~/.config/fish/config.fish ]; then if ! grep -q "fastfetch" ~/.config/fish/config.fish; then echo "fastfetch" >> ~/.config/fish/config.fish fi fi } function installWebBrowsers() { 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 torbrowser-launcher -y elif [[ $DISTRO == "arch" ]]; then sudo pacman -S --needed firefox chromium torbrowser-launcher --noconfirm fi fi } function installGamingPackages() { 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 goverlay -y elif [[ $DISTRO == "fedora" ]]; then sudo flatpak install flathub net.davidotek.pupgui2 -y --noninteractive --system sudo dnf in steam gamescope gamemode mangohud lutris heroic-games-launcher-bin goverlay -y if grep -q "Rawhide" /etc/fedora-release; then installAAGL-on-fedora else sudo flatpak install launcher.moe moe.launcher.an-anime-game-launcher -y --noninteractive --system sudo flatpak install launcher.moe moe.launcher.honkers-launcher -y --noninteractive --system sudo flatpak install launcher.moe moe.launcher.the-honkers-railway-launcher -y --noninteractive --system fi elif [[ $DISTRO == "arch" ]]; then sudo pacman -S --needed steam gamescope gamemode lib32-gamemode mangohud vkd3d lib32-vkd3d python-protobuf wine xorg-xgamma lutris goverlay protonup-qt heroic-games-launcher-bin --noconfirm yay -S --needed honkers-launcher-bin an-anime-game-launcher-bin the-honkers-railway-launcher-bin --noconfirm fi fi } function installAAGL-on-fedora() { sudo mkdir /tmp/aagl/ sudo dnf in -y xdelta sudo wget https://github.com/an-anime-team/honkers-launcher/releases/latest/download/honkers-launcher -O /tmp/aagl/honkers-launcher sudo wget https://github.com/an-anime-team/an-anime-game-launcher/releases/latest/download/anime-game-launcher -O /tmp/aagl/anime-game-launcher sudo wget https://github.com/an-anime-team/the-honkers-railway-launcher/releases/latest/download/honkers-railway-launcher -O /tmp/aagl/honkers-railway-launcher sudo chown root:root /tmp/aagl/* sudo chmod +x /tmp/aagl/* sudo cp /tmp/aagl/honkers-launcher /bin/honkers-launcher sudo cp /tmp/aagl/anime-game-launcher /bin/an-anime-game-launcher sudo cp /tmp/aagl/honkers-railway-launcher /bin/the-honkers-railway-launcher sudo touch /usr/share/applications/honkers-launcher.desktop sudo touch /usr/share/applications/anime-game-launcher.desktop sudo touch /usr/share/applications/the-honkers-railway-launcher.desktop echo -e "[Desktop Entry]\nName=Honkers Launcher\nComment=A Launcher for honkers with auto-patching, discord rpc and time tracking\nExec=honkers-launcher\nTerminal=false\nType=Application\nIcon=honkers-launcher\nCategories=Game" | sudo tee /usr/share/applications/honkers-launcher.desktop echo -e "[Desktop Entry]\nName=An Anime Game Launcher\nComment=A Launcher for a specific anime game with auto-patching, discord rpc and time tracking\nExec=an-anime-game-launcher\nTerminal=false\nType=Application\nIcon=an-anime-game-launcher\nCategories=Game" | sudo tee /usr/share/applications/anime-game-launcher.desktop echo -e "[Desktop Entry]\nName=The Honkers Railway Launcher\nComment=A Launcher for honkers railway with auto-patching, discord rpc and time tracking\nExec=the-honkers-railway-launcher\nTerminal=false\nType=Application\nIcon=the-honkers-railway-launcher\nCategories=Game" | sudo tee /usr/share/applications/the-honkers-railway-launcher.desktop sudo wget https://git.justw.tf/Lightemerald/linux-scripts/raw/branch/main/assets/moe.launcher.honkers-launcher -O /usr/share/icons/moe.launcher.honkers-launcher sudo wget https://git.justw.tf/Lightemerald/linux-scripts/raw/branch/main/assets/moe.launcher.an-anime-game-launcher -O /usr/share/icons/moe.launcher.an-anime-game-launcher sudo wget https://git.justw.tf/Lightemerald/linux-scripts/raw/branch/main/assets/moe.launcher.the-honkers-railway-launcher -O /usr/share/icons/moe.launcher.the-honkers-railway-launcher } function installSocialAndCommunicationPackages() { if (whiptail --title "Social and Communication" --yesno "Should we install social and communication packages?" 8 78); then echo "Installing social and communication packages..." if [[ $DISTRO =~ (debian|ubuntu) ]]; then wget https://vencord.dev/download/vesktop/amd64/deb -O /tmp/vesktop.deb sudo apt install telegram-desktop signal-desktop discord -y sudo dpkg -i /tmp/vesktop.deb elif [[ $DISTRO == "fedora" ]]; then wget https://vencord.dev/download/vesktop/amd64/rpm -O /tmp/vesktop.rpm sudo dnf in telegram-desktop discord /tmp/vesktop.rpm -y sudo flatpak install flathub org.signal.Signal -y --noninteractive --system elif [[ $DISTRO == "arch" ]]; then sudo pacman -S --needed signal-desktop telegram-desktop discord vesktop-git --noconfirm fi fi } function installVirtualizationAncContainerPackages() { 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 qemu-full swtpm open-iscsi radvd openbsd-netcat 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 setupU2F() { 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 libyubikey pam-u2f pamu2fcfg yubico-piv-tool yubikey-manager yubikey-manager-qt 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 mkdir ~/.config/Yubico pamu2fcfg -o pam://$HOST -i pam://$HOST > ~/.config/Yubico/u2f_keys sudo touch /etc/pam.d/u2f-required sudo touch /etc/pam.d/u2f-sufficient echo -e "#%PAM-1.0\nauth required pam_u2f.so cue origin=pam://$HOST appid=pam://$HOST" | sudo tee /etc/pam.d/u2f-required echo -e "#%PAM-1.0\nauth sufficient pam_u2f.so cue origin=pam://$HOST appid=pam://$HOST" | sudo tee /etc/pam.d/u2f-sufficient fi } function installRGB() { if (whiptail --title "OpenRazer" --yesno "Should we install OpenRazer?" 8 78); then if [[ $DISTRO =~ (debian|ubuntu) ]]; then sudo apt install openrazer -y elif [[ $DISTRO == "fedora" ]]; then sudo dnf install sudo dnf in kernel-devel openrazer-meta -y elif [[ $DISTRO == "arch" ]]; then sudo pacman -S --needed openrazer-daemon --noconfirm fi sudo gpasswd -a "$USER" plugdev fi if (whiptail --title "OpenRGB" --yesno "Should we install OpenRGB?" 8 78); then if [[ $DISTRO =~ (debian|ubuntu) ]]; then sudo apt install openrgb -y elif [[ $DISTRO == "fedora" ]]; then sudo dnf in openrgb i2c-tools libi2c libi2c-devel libi2cd python3-i2c-tools -y elif [[ $DISTRO == "arch" ]]; then sudo pacman -S --needed openrgb --noconfirm fi sudo gpasswd -a "$USER" plugdev fi } function installTerminal() { 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 grml-zsh-config --noconfirm fi chsh --shell /bin/zsh fi } function installDevPackages() { if (whiptail --title "Development" --yesno "Should we install development packages?" 8 78); then if [[ $DISTRO =~ (debian|ubuntu) ]]; then sudo apt install mariadb-server code android-tools -y elif [[ $DISTRO == "fedora" ]]; then sudo dnf in mariadb-server code android-tools -y elif [[ $DISTRO == "arch" ]]; then sudo pacman -S --needed mariadb visual-studio-code-bin android-tools android-udev --noconfirm fi fi } function installSoftware() { if (whiptail --title "Software" --yesno "Should we install recommended software?" 8 78); then if [[ $DISTRO =~ (debian|ubuntu) ]]; then sudo apt install gimp inkscape krita blender audacity obs-studio kdenlive shotcut qbittorrent scrcpy -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 sudo flatpak install flathub org.onlyoffice.desktopeditors -y --noninteractive --system elif [[ $DISTRO == "fedora" ]]; then sudo dnf in gimp inkscape krita blender audacity obs-studio kdenlive shotcut qbittorrent scrcpy -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 sudo flatpak install flathub org.onlyoffice.desktopeditors -y --noninteractive --system elif [[ $DISTRO == "arch" ]]; then sudo pacman -S --needed gimp inkscape krita blender audacity obs-studio kdenlive shotcut qbittorrent scrcpy moonlight-qt stremio onlyoffice-bin --noconfirm yay -S --needed --noconfirm miru-bin fi fi } function setupDomainMember() { echo "Warning: Experimental Script." if (whiptail --title "Samba" --yesno "Should we install Samba?" 8 78); then if [[ $DISTRO =~ (debian|ubuntu) ]]; then sudo apt install realmd sssd samba-common krb5-user adcli libsss-sudo sssd-tools libsasl2-modules-ldap packagekit libpam-mount -y elif [[ $DISTRO == "fedora" ]]; then sudo dnf group install domain-client -y elif [[ $DISTRO == "arch" ]]; then sudo pacman -S --needed samba smbclient ntp bind krb5 cups --noconfirm fi fi } echo -e "\e[1;31mWARNING: This script assumes a standard Debian/Fedora/Arch install.\e[0m" read -r -p "Are you sure you want to continue? [N/y] " response if [[ "$response" =~ ^[Yy]$ ]]; then echo "Continuing..." getDistributionType checkWhiptail updateSystem installBasicPackages setupRepositories installDistroSpecificPackages installGraphicsDrivers setupFastfetch installWebBrowsers installGamingPackages installSocialAndCommunicationPackages installVirtualizationAncContainerPackages setupU2F installRGB installTerminal installDevPackages installSoftware else echo "Script execution aborted." exit 1 fi