#!/bin/bash # Function name: Install packages # Description: Install packages from an array # Arguments: # $1: Package list (array) install_packages() { local packages=("${!1}") for package in "${packages[@]}"; do sudo pacman -S --needed --noconfirm "$package" done } # Function name: Install package # Description: Install a package given its name # Arguments: # $1: Package name install_package() { sudo pacman -S --needed --noconfirm "$1" } # Function name: Install dependencies # Description: Install package as dependency given its name # Arguments: # $1: Package name install_dependencies() { sudo pacman -S --needed --noconfirm --asdeps "$1" } # Function name: Update system # Description: Update the system update_system() { sudo pacman -Syu --noconfirm } # Function name: Check whiptail # Description: Check if whiptail is installed else install it check_whiptail() { if ! command -v whiptail &>/dev/null; then sudo pacman -S --needed --noconfirm --asdeps libnewt fi } # Function name: Setup disk partitioning # Description: Setup disk partitioning # Function name: Setup repositories # Description: Ask the user if they want to add specific repositories setup_repositories() { options=( "CachyOS" "Add CachyOS repository - x86 -v3 and -v4 optimized, custom and some AUR packages" OFF "Chromatic" "Add Chromatic repository - prebuilt AUR packages not in Chaotic.cx" ON "BlackArch" "Add BlackArch repository - hacking related packages" OFF "Chaotic.cx" "Add Chaotic.cx repository - prebuilt AUR packages (Recommended)" ON ) selected_repos=$(whiptail --title "Add Repositories" --checklist \ "Choose the repositories you want to add:" 20 78 4 \ "${options[@]}" 3>&1 1>&2 2>&3) for repo in $selected_repos; do case $repo in "\"CachyOS\"") if ! grep -q "\[cachyos\]" /etc/pacman.conf; then curl https://mirror.cachyos.org/cachyos-repo.tar.xz -o /tmp/cachyos-repo.tar.xz tar xvf /tmp/cachyos-repo.tar.xz -C /tmp cd /tmp/cachyos-repo || exit sudo ./cachyos-repo.sh else echo "CachyOS repository is already installed." fi ;; "\"Chromatic\"") if ! grep -q "\[chromatic\]" /etc/pacman.conf; then sudo pacman-key --recv-key 6EFB412EBDDD1853DF71F4B625AE803AA8C39062 sudo pacman-key --lsign-key 6EFB412EBDDD1853DF71F4B625AE803AA8C39062 sudo pacman -U --noconfirm 'https://mirror.trap.moe/chromatic/x86_64/chromatic-keyring-1.0-1-any.pkg.tar.zst' sudo pacman -U --noconfirm 'https://mirror.trap.moe/chromatic/x86_64/chromatic-mirrorlist-20250315-1-any.pkg.tar.zst' --overwrite /etc/pacman.d/chromatic-mirrorlist echo '[chromatic]' | sudo tee -a /etc/pacman.conf echo 'Include = /etc/pacman.d/chromatic-mirrorlist' | sudo tee -a /etc/pacman.conf sudo pacman -Sy --noconfirm chromatic-keyring chromatic-mirrorlist else echo "Chromatic repository is already installed." fi ;; "\"BlackArch\"") if ! grep -q "\[blackarch\]" /etc/pacman.conf; then curl -O https://blackarch.org/strap.sh chmod +x strap.sh sudo sed -i 's/msg '\''installing blackarch-officials meta-package...'\''/#msg '\''installing blackarch-officials meta-package...'\''/' strap.sh sudo sed -i 's/pacman -S --noconfirm --needed blackarch-officials/#pacman -S --noconfirm --needed blackarch-officials/' strap.sh sudo ./strap.sh else echo "BlackArch repository is already installed." fi ;; "\"Chaotic.cx\"") if ! grep -q "\[chaotic-aur\]" /etc/pacman.conf; then sudo pacman-key --recv-key 3056513887B78AEB --keyserver keyserver.ubuntu.com sudo pacman-key --lsign-key 3056513887B78AEB sudo pacman -U --noconfirm 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-keyring.pkg.tar.zst' sudo pacman -U --noconfirm 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-mirrorlist.pkg.tar.zst' echo '[chaotic-aur]' | sudo tee -a /etc/pacman.conf echo 'Include = /etc/pacman.d/chaotic-mirrorlist' | sudo tee -a /etc/pacman.conf else echo "Chaotic.cx repository is already installed." fi ;; esac done update_system } # Function name: Setup Pacman configuration # Description: Setup Pacman configuration setup_pacman() { sudo sed -i 's/#Color/Color/' /etc/pacman.conf sudo sed -i 's/#ILoveCandy/ILoveCandy/' /etc/pacman.conf sudo sed -i 's/#VerbosePkgLists/VerbosePkgLists/' /etc/pacman.conf sudo sed -i 's/#CheckSpace/CheckSpace/' /etc/pacman.conf #sudo sed -i 's/#PrettyProgressBar/PrettyProgressBar/' /etc/pacman.conf sudo sed -i 's/#ParallelDownloads = 5/ParallelDownloads = 10/' /etc/pacman.conf sudo sed -i 's/#DisableDownloadTimeout/DisableDownloadTimeout/' /etc/pacman.conf } # Function name: Setup shell # Description: Install selected shell and recommendations setup_shell() { options=( "Zsh" "Install Zsh and recommended packages" ON "Fish" "Install Fish shell and recommended packages" OFF "Bash" "Install Bash and recommended packages" OFF ) selected_shell=$(whiptail --title "Setup Shell" --radiolist \ "Choose the shell you want to install:" 15 60 3 \ "${options[@]}" 3>&1 1>&2 2>&3) case $selected_shell in "\"Zsh\"") install_package zsh zsh-autosuggestions zsh-completions zsh-history-substring-search zsh-syntax-highlighting grml-zsh-config oh-my-zsh-git if (whiptail --title "Change default shell to Zsh" --yesno "Would you like to change the default shell to Zsh?" 10 60); then chsh -s /bin/zsh fi ;; "\"Fish\"") install_package fish if (whiptail --title "Change default shell to Fish" --yesno "Would you like to change the default shell to Fish?" 10 60); then chsh -s /usr/bin/fish fi ;; "\"Bash\"") install_package bash install_dependencies bash-completion if pacman -Qs bash-completion > /dev/null; then echo "source /usr/share/bash-completion/bash_completion" >> ~/.bashrc fi if (whiptail --title "Change default shell to Bash" --yesno "Would you like to change the default shell to Bash?" 10 60); then chsh -s /bin/bash fi ;; esac } # Function name: Setup audio server # Description: Install pipewire and its dependencies setup_audio_server() { if whiptail --title "Setup Audio Server" --yesno "Would you like to setup Pipewire?" 10 60; then install_dependencies pipewire pipewire-pulse pipewire-alsa pipewire-jack wireplumber fi } # Function name: Setup GPU # Description: Setup GPU depending on the available devices setup_gpu() { if whiptail --title "Setup GPU" --yesno "Would you like to setup GPU?" 10 60; then detected_gpu=$(lspci | grep -Ei "vga|3d|display") case "$detected_gpu" in *NVIDIA*) options=( "nvidia" "Official NVIDIA Drivers" ON "nouveau" "Open Source nouveau drivers" OFF ) selected_driver=$(whiptail --title "Select NVIDIA Drivers" --radiolist \ "Choose the NVIDIA driver you want to install:" 15 60 2 \ "${options[@]}" 3>&1 1>&2 2>&3) 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 case $selected_driver in "\"nvidia\"") if pacman -Qs linux > /dev/null; then install_package nvidia-open install_dependencies libvdpau fi if pacman -Qs linux-lts > /dev/null; then install_package nvidia-open-lts install_dependencies libvdpau fi if pacman -Qs linux-cachyos > /dev/null; then install_package linux-cachyos-nvidia-open install_dependencies libvdpau fi if pacman -Qs linux-zen > /dev/null || pacman -Qs linux-hardened > /dev/null; then install_package nvidia-open-dkms install_dependencies libvdpau fi if ! lspci | grep -Ei "amd|intel" > /dev/null; then install_dependencies libva-nvidia-driver fi if (whiptail --title "Install Cuda" --yesno "Would you like to install Cuda?" 10 60); then install_dependencies cuda fi ;; "\"nouveau\"") install_dependencies mesa install_package vulkan-nouveau ;; esac ;; *AMD*) install_dependencies mesa install_package vulkan-radeon ;; *Intel*) install_dependencies intel-media-driver vulkan-intel ;; esac fi } # Function name: Setup plymouth # Description: Install and setup Plymouth for boot splash setup_plymouth() { if whiptail --title "Setup Plymouth" --yesno "Would you like to setup Plymouth?" 10 60; then echo "quiet splash" | sudo tee -a /etc/kernel/cmdline sudo pacman -S --needed --noconfirm plymouth plymouth-kcm if pacman -Qs plymouth-theme-catppuccin-mocha-git > /dev/null; then sudo plymouth-set-default-theme -R catppuccin-mocha else sudo plymouth-set-default-theme -R spinner fi fi } # Function name: Setup network # Description: Install and setup NetworkManager and its dependencies setup_network() { if whiptail --title "Setup Network" --yesno "Would you like to setup NetworkManager?" 10 60; then install_dependencies networkmanager wpa_supplicant install_package networkmanager-openvpn networkmanager-strongswan sudo systemctl enable --now NetworkManager fi } # Function name: Setup bluetooth # Description: Install and setup Bluetooth and its dependencies setup_bluetooth() { if whiptail --title "Setup Bluetooth" --yesno "Would you like to setup Bluetooth?" 10 60; then install_dependencies bluedevil bluez bluez-utils sudo systemctl enable --now bluetooth fi } # function name : setup u2f # Description: setup pam-u2f for login using Yubikey setup_u2f() { install_package pam-u2f mkdir ~/.config/Yubico echo "Registering U2F device..." 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 "auth required pam_u2f.so cue origin=pam://$HOST appid=pam://$HOST" | sudo tee -a /etc/pam.d/u2f-required echo "auth sufficient pam_u2f.so cue origin=pam://$HOST appid=pam://$HOST" | sudo tee -a /etc/pam.d/u2f-sufficient sudo sed -i '/^password\s*include\s*system-auth/i auth include u2f-sufficient' /etc/pam.d/su sudo sed -i '/^auth\s*include\s*system-auth/i auth include u2f-sufficient' /etc/pam.d/sudo sudo sed -i '/^auth\s*include\s*system-auth/i auth include u2f-sufficient' /etc/pam.d/passwd sudo sed -i '/^auth\s*include\s*system-auth/i auth include u2f-sufficient' /etc/pam.d/system-login if [ ! -f /etc/pam.d/polkit-1 ]; then sudo cp /usr/lib/pam.d/polkit-1 /etc/pam.d/polkit-1 fi sudo sed -i '/^auth\s*include\s*system-auth/i auth include u2f-sufficient' /etc/pam.d/polkit-1 } # function name : setup fprint # Description: setup fprint for login using fingerprint reader setup_fprint() { install_package fprintd install_dependencies imagemagick sudo systemctl enable --now fprintd sudo sed -i '/^auth\s*include\s*system-login/i auth [success=1 default=ignore] pam_succeed_if.so service in sudo:su:su-l tty in :unknown' /etc/pam.d/system-local-login sudo sed -i '/^auth\s*include\s*system-login/i auth sufficient pam_fprintd.so' /etc/pam.d/system-local-login if [ ! -f /etc/pam.d/polkit-1 ]; then sudo cp /usr/lib/pam.d/polkit-1 /etc/pam.d/polkit-1 fi sudo sed -i '/^auth\s*include\s*system-auth/i auth include u2f-sufficient' /etc/pam.d/polkit-1 fprintd-enroll } # function name : setup SmartCard [WIP] # Description: setup pcscd for login using smartcard reader setup_smartcard() { install_package opensc sudo systemctl enable --now pcscd sudo systemctl enable --now pcscd.socket } # function name : setup firewall # Description: Install and setup user selected firewall setup_firewall() { options=( "ufw" "Install UFW" ON "firewalld" "Install Firewalld" OFF "iptables" "Install Iptables" ON "nftables" "Install Nftables" OFF ) selected_groups=$(whiptail --title "Setup Firewall" --checklist "Choose the firewall you want to install:" 20 78 4 "${options[@]}") case $selected_groups in "ufw") install_package ufw install_dependencies ufw-extras sudo systemctl enable --now ufw sudo ufw enable ;; "firewalld") install_package firewalld sudo systemctl enable --now firewalld ;; "iptables") install_package iptables ;; "nftables") install_package nftables install_package iptables-nft ;; esac } # function name : Setup NTP # Description: Install selected NTP client setup_ntp() { options=( "ntpd-rs" "Install ntpd-rs" ON "chrony" "Install chrony (Current standard)" OFF "openntpd" "Install OpenNTPD" OFF "ntp" "Install ntpd (Not recommended)" OFF ) selected_ntp=$(whiptail --title "Setup NTP" --radiolist "Choose the NTP client you want to install:" 20 78 4 "${options[@]}" 3>&1 1>&2 2>&3) case $selected_ntp in "\"ntpd-rs\"") install_package ntpd-rs sudo systemctl enable --now ntpd-rs ;; "\"chrony\"") install_package chrony sudo systemctl enable --now chronyd ;; "\"openntpd\"") install_package openntpd sudo systemctl enable --now openntpd ;; "\"ntp\"") install_package ntp sudo systemctl enable --now ntpd ;; esac } # function name : setup flatpak # Description: Install and setup Flatpak and Flathub setup_flatpak() { if whiptail --title "Setup Flatpak" --yesno "Would you like to setup Flatpak?" 10 60; then install_package flatpak flatpak remote-add --if-not-exists --system flathub https://flathub.org/repo/flathub.flatpakrepo fi } # function name : setup fwupd # Description: setup fwupd setup_fwupd() { if whiptail --title "Setup fwupd" --yesno "Would you like to setup fwupd?" 10 60; then install_package fwupd install_dependencies fwupd-efi sudo systemctl enable --now fwupd sudo systemctl enable --now fwupd-refresh fi } # function name : setup OpenRGB # Description: Install OpenRGB for RGB devices control setup_openrgb() { install_package openrgb sudo gpasswd -a "$USER" plugdev sudo systemctl enable --now openrgb } # function name : setup browser # Description: Ask the user which browsers they want to install setup_browser() { options=( "Firefox" "Install Firefox" ON "Chromium" "Install Chromium" OFF "Brave" "Install Brave" OFF "Vivaldi" "Install Vivaldi" OFF "Google Chrome" "Install Google Chrome" OFF "Zen Browser" "Install Zen Browser" OFF "Tor Browser" "Install Tor Browser" OFF "Mullvad Browser" "Install Mullvad Browser" OFF "Edge Stable" "Install Edge Stable" OFF "LibreWolf" "Install LibreWolf" OFF "Floorp" "Install Floorp" OFF "Chromium Widevine" "Install Chromium Widevine" OFF "Links" "Install Links" OFF ) selected_browsers=$(whiptail --title "Setup Browser" --checklist \ "Choose the browsers you want to install:" 20 78 13 \ "${options[@]}" 3>&1 1>&2 2>&3) for browser in $selected_browsers; do case $browser in "\"Firefox\"") sudo pacman -S --needed --noconfirm firefox ;; "\"Chromium\"") sudo pacman -S --needed --noconfirm chromium ;; "\"Brave\"") sudo pacman -S --needed --noconfirm brave-bin ;; "\"Vivaldi\"") sudo pacman -S --needed --noconfirm vivaldi ;; "\"Google Chrome\"") yay -S --needed --noconfirm google-chrome ;; "\"Zen Browser\"") yay -S --needed --noconfirm zen-browser-bin ;; "\"Tor Browser\"") sudo pacman -S --needed --noconfirm tor-browser-bin ;; "\"Mullvad Browser\"") yay -S --needed --noconfirm mullvad-browser-bin ;; "\"Edge Stable\"") yay -S --needed --noconfirm microsoft-edge-stable-bin ;; "\"LibreWolf\"") yay -S --needed --noconfirm librewolf ;; "\"Floorp\"") yay -S --needed --noconfirm floorp-bin ;; "\"Chromium Widevine\"") sudo pacman -S --needed --noconfirm chromium-widevine ;; "\"Links\"") sudo pacman -S --needed --noconfirm links ;; esac done } # function name : setup_office_suite # Description: setup office suite setup_office_suite() { options=( "LibreOffice" "Install LibreOffice" OFF "OnlyOffice" "Install OnlyOffice" OFF "WPS Office" "Install WPS Office" OFF "FreeOffice" "Install FreeOffice" OFF ) selected_option=$(whiptail --title "Setup Office Suite" --radiolist "Choose the office suite you want to install:" 20 78 4 "${options[@]}" 3>&1 1>&2 2>&3) case $selected_option in "\"LibreOffice\"") install_package libreoffice-fresh ;; "\"OnlyOffice\"") install_package onlyoffice-bin ;; "\"WPS Office\"") install_package wps-office ;; "\"FreeOffice\"") install_package freeoffice ;; esac } # Function name: Setup mail client # Description: Install choosen mail client setup_mail_client() { options=( "Thunderbird" "Install Thunderbird" ON "Evolution" "Install Evolution" OFF "Geary" "Install Geary" OFF "Mailspring" "Install Mailspring" OFF ) selected_mail_client=$(whiptail --title "Setup Mail Client" --radiolist \ "Choose the mail client you want to install:" 20 78 4 \ "${options[@]}" 3>&1 1>&2 2>&3) case $selected_mail_client in "\"Thunderbird\"") install_package thunderbird install_dependencies thunderbird-dark-reader thunderbird-ublock-origin ;; "\"Evolution\"") install_package evolution ;; "\"Geary\"") install_package geary ;; "\"Mailspring\"") install_package mailspring ;; esac } # Function name: Setup virtualization # Description: Install virtualization packages and enable libvirtd service setup_virtualization() { if whiptail --title "Setup Virtualization" --yesno "Would you like to setup virtualization?" 10 60; then install_package virt-manager qemu-full virt-viewer install_dependencies swtpm dnsmasq openbsd-netcat if pacman -Qs libvirt > /dev/null; then sudo systemctl enable --now libvirtd sudo usermod -aG libvirt "$USER" fi fi } # Function name: Setup containers # Description: Install choosen container packages (podman or docker, distrobox) setup_containers() { options=( "Podman" "Install Podman and its dependencies" ON "Docker" "Install Docker and its dependencies" OFF "Distrobox" "Install Distrobox for container management" ON ) selected_containers=$(whiptail --title "Setup Containers" --checklist \ "Choose the container packages you want to install:" 20 78 3 \ "${options[@]}" 3>&1 1>&2 2>&3) for container in $selected_containers; do case $container in "\"Podman\"") install_package podman install_dependencies podman-docker if pacman -Qs nvidia-open > /dev/null || pacman -Qs nvidia-open-lts > /dev/null || pacman -Qs linux-cachyos-nvidia-open > /dev/null || pacman -Qs nvidia-open-dkms > /dev/null; then install_dependencies nvidia-container-toolkit fi sudo systemctl enable --now podman.socket ;; "\"Docker\"") install_package docker install_dependencies docker-compose if pacman -Qs nvidia > /dev/null; then install_dependencies nvidia-container-toolkit fi sudo systemctl enable --now docker sudo usermod -aG docker "$USER" ;; "\"Distrobox\"") install_package distrobox ;; esac done } # Function name: Setup plasma KDE # Description: Install and setup Plasma KDE setup_plasma_kde() { if whiptail --title "Setup Plasma KDE" --yesno "Would you like to setup Plasma KDE?" 10 60; then install_package plasma-meta gwenview kate okular kcalc gparted kdeconnect install_dependencies qt6-quick3d if pacman -Qs sddm > /dev/null; then sudo systemctl enable sddm if [ -f /etc/sddm.conf.d/10-wayland.conf ]; then echo "SDDM wayland configuration already exists." else echo "[General]" | sudo tee /etc/sddm.conf.d/10-wayland.conf echo "DisplayServer=wayland" | sudo tee -a /etc/sddm.conf.d/10-wayland.conf echo "GreeterEnvironment=QT_WAYLAND_SHELL_INTEGRATION=layer-shell" | sudo tee -a /etc/sddm.conf.d/10-wayland.conf echo "" | sudo tee -a /etc/sddm.conf.d/10-wayland.conf echo "[Wayland]" | sudo tee -a /etc/sddm.conf.d/10-wayland.conf echo "CompositorCommand=kwin_wayland --drm --no-lockscreen --no-global-shortcuts --locale1" | sudo tee -a /etc/sddm.conf.d/10-wayland.conf fi fi if ! grep -q "ELECTRON_OZONE_PLATFORM_HINT" /etc/environment; then echo "ELECTRON_OZONE_PLATFORM_HINT=auto" | sudo tee -a /etc/environment fi if [ ! -f ~/.config/electron-flags.conf ]; then mkdir -p ~/.config echo "--enable-features=WaylandWindowDecorations" > ~/.config/electron-flags.conf echo "--ozone-platform-hint=auto" >> ~/.config/electron-flags.conf fi fi } # Function name: Setup gaming packages # Description: Install choosen launchers and gaming related packages setup_gaming() { options=( "Steam" "Install Steam (Steam Games)" ON "Heroic Games Launcher" "Install Heroic Games Launcher (Epic Games, GOG Games, Amazon Games)" ON "Anime Games Launcher" "Install Anime Games Launcher (Honkai 3, Genshin Impact, Honkai: Star Rail, Zenless Zone Zero)" OFF "UmU Launcher" "Install UmU Launcher (Start games using proton without steam)" OFF "Goverlay" "Install Goverlay for overlays and enhancements" ON "GameMode" "Install GameMode for performance optimization" ON "GameScope" "Install GameScope for gaming performance improvements" ON "MangoHud" "Install MangoHud for performance monitoring and overlays" ON ) selected_gaming=$(whiptail --title "Setup Gaming" --checklist \ "Choose the gaming packages you want to install:" 20 78 8 \ "${options[@]}" 3>&1 1>&2 2>&3) for game in $selected_gaming; do case $game in "\"Steam\"") install_package steam-native-runtime ;; "\"Heroic Games Launcher\"") install_package heroic-games-launcher-bin ;; "\"Anime Games Launcher\"") install_package anime-games-launcher-git ;; "\"UmU Launcher\"") install_package umu-launcher ;; "\"Goverlay\"") install_package goverlay ;; "\"GameMode\"") install_package gamemode ;; "\"GameScope\"") install_package gamescope ;; "\"MangoHud\"") install_package mangohud ;; esac done } # Main script check_whiptail #setup_disk_partitioning setup_repositories setup_pacman setup_shell setup_audio_server setup_gpu setup_plymouth setup_network setup_bluetooth setup_firewall setup_ntp setup_flatpak setup_fwupd setup_u2f setup_fprint setup_smartcard setup_openrgb setup_browser setup_office_suite setup_mail_client setup_virtualization setup_containers setup_plasma_kde setup_gaming # Packages group definitions # Package groups theme_packages=( btop-theme-catppuccin catppuccin-cursors-mocha catppuccin-gtk-theme-mocha papirus-folders-catppuccin-git plymouth-theme-catppuccin-mocha-git #refind-theme-catppuccin-git sddm-theme-catppuccin-git ) gnome_apps=( gnome-console gnome-disk-utility gnome-firmware ) games_packages=( steam-native-runtime heroic-games-launcher-bin an-anime-game-launcher-bin honkers-launcher-bin sleepy-launcher-bin the-honkers-railway-launcher-bin umu-launcher goverlay gamemode gamescope mangohud ) cups_packages=( cups cups-pdf cups-filters system-config-printer ) developer_packages=( git visual-studio-code-bin )