843 lines
34 KiB
Bash
Executable File
843 lines
34 KiB
Bash
Executable File
#!/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
|
|
echo "== Adding CachyOS repository =="
|
|
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
|
|
echo "CachyOS repository added successfully."
|
|
else
|
|
echo "CachyOS repository is already installed."
|
|
fi
|
|
;;
|
|
"\"Chromatic\"")
|
|
if ! grep -q "\[chromatic\]" /etc/pacman.conf; then
|
|
echo "== Adding Chromatic repository =="
|
|
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
|
|
echo "Chromatic repository added successfully."
|
|
else
|
|
echo "Chromatic repository is already installed."
|
|
fi
|
|
;;
|
|
"\"BlackArch\"")
|
|
if ! grep -q "\[blackarch\]" /etc/pacman.conf; then
|
|
echo "== Adding BlackArch repository =="
|
|
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
|
|
echo "BlackArch repository added successfully."
|
|
else
|
|
echo "BlackArch repository is already installed."
|
|
fi
|
|
;;
|
|
"\"Chaotic.cx\"")
|
|
if ! grep -q "\[chaotic-aur\]" /etc/pacman.conf; then
|
|
echo "== Adding Chaotic.cx repository =="
|
|
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
|
|
sudo pacman -Sy --noconfirm chaotic-keyring chaotic-mirrorlist
|
|
echo "Chaotic.cx repository added successfully."
|
|
else
|
|
echo "Chaotic.cx repository is already installed."
|
|
fi
|
|
;;
|
|
esac
|
|
done
|
|
update_system
|
|
}
|
|
|
|
# Function name: Setup Pacman configuration
|
|
# Description: Setup Pacman configuration
|
|
setup_pacman() {
|
|
echo "== Setting up Pacman configuration =="
|
|
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
|
|
echo "Pacman configuration set up successfully."
|
|
}
|
|
|
|
# Function name: Setup shell
|
|
# Description: Install selected shell and recommended packages
|
|
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\"")
|
|
echo "== Installing Zsh and recommended packages =="
|
|
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
|
|
echo "Zsh and recommended packages installed successfully."
|
|
;;
|
|
"\"Fish\"")
|
|
echo "== Installing Fish shell and recommended packages =="
|
|
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
|
|
echo "Fish shell and recommended packages installed successfully."
|
|
;;
|
|
"\"Bash\"")
|
|
echo "== Installing Bash and recommended packages =="
|
|
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
|
|
echo "Bash and recommended packages installed successfully."
|
|
;;
|
|
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
|
|
echo "== Installing Pipewire and its dependencies =="
|
|
install_dependencies pipewire pipewire-pulse pipewire-alsa pipewire-jack wireplumber
|
|
echo "Pipewire and its dependencies installed successfully."
|
|
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*)
|
|
echo "== Detected NVIDIA GPU =="
|
|
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)
|
|
|
|
echo "== Removing existing incorrect NVIDIA drivers if any =="
|
|
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
|
|
echo "=== Installing nvidia open for linux ==="
|
|
install_package nvidia-open
|
|
install_dependencies libvdpau
|
|
fi
|
|
if pacman -Qs linux-lts > /dev/null; then
|
|
echo "=== Installing nvidia open for linux-lts ==="
|
|
install_package nvidia-open-lts
|
|
install_dependencies libvdpau
|
|
fi
|
|
if pacman -Qs linux-cachyos > /dev/null; then
|
|
echo "=== Installing nvidia open for linux-cachyos ==="
|
|
install_package linux-cachyos-nvidia-open
|
|
install_dependencies libvdpau
|
|
fi
|
|
if pacman -Qs linux-zen > /dev/null || pacman -Qs linux-hardened > /dev/null; then
|
|
echo "=== Installing nvidia open dkms for other kernels ==="
|
|
install_package nvidia-open-dkms
|
|
install_dependencies libvdpau
|
|
fi
|
|
|
|
if ! lspci | grep -Ei "amd|intel" > /dev/null; then
|
|
echo "=== Installing libva-nvidia-driver for NVIDIA only systems ==="
|
|
install_dependencies libva-nvidia-driver
|
|
fi
|
|
|
|
if (whiptail --title "Install Cuda" --yesno "Would you like to install Cuda?" 10 60); then
|
|
echo "=== Installing Cuda ==="
|
|
install_dependencies cuda
|
|
fi
|
|
;;
|
|
"\"nouveau\"")
|
|
echo "=== Installing nouveau drivers ==="
|
|
install_dependencies mesa vulkan-nouveau
|
|
;;
|
|
esac
|
|
;;
|
|
*AMD*)
|
|
echo "== Detected AMD GPU =="
|
|
echo "=== Installing AMD drivers ==="
|
|
install_dependencies mesa vulkan-radeon
|
|
;;
|
|
*Intel*)
|
|
echo "== Detected Intel GPU =="
|
|
echo "=== Installing Intel drivers ==="
|
|
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 "== Setting up Plymouth =="
|
|
if ! grep -q "splash" /etc/kernel/cmdline; then
|
|
echo -n " quiet splash" | sudo tee -a /etc/kernel/cmdline
|
|
fi
|
|
if ! grep -q "plymouth" /etc/mkinitcpio.conf; then
|
|
sudo sed -i 's/^HOOKS=(base systemd autodetect microcode modconf/HOOKS=(base systemd autodetect microcode plymouth modconf/' /etc/mkinitcpio.conf
|
|
fi
|
|
install_package plymouth
|
|
echo "Plymouth setup completed."
|
|
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
|
|
echo "== Installing NetworkManager and its dependencies =="
|
|
install_dependencies networkmanager wpa_supplicant
|
|
install_package networkmanager-openvpn networkmanager-strongswan
|
|
sudo systemctl enable --now NetworkManager
|
|
echo "NetworkManager and its dependencies installed successfully."
|
|
fi
|
|
|
|
wireless_ifaces=$(ip -o link show 2>/dev/null | awk -F': ' '{print $2}' | grep -E '^(wlan|wlp|wl|wifi)' || true)
|
|
if [ -z "$wireless_ifaces" ]; then
|
|
if lspci 2>/dev/null | grep -Ei 'network controller|wireless|wi-fi' >/dev/null 2>&1 || \
|
|
lsusb 2>/dev/null | grep -Ei 'wireless|802.11' >/dev/null 2>&1; then
|
|
wireless_detected=1
|
|
else
|
|
wireless_detected=0
|
|
fi
|
|
else
|
|
wireless_detected=1
|
|
fi
|
|
|
|
if [ "$wireless_detected" -eq 1 ]; then
|
|
if ! pacman -Qi wireless-regdb >/dev/null 2>&1; then
|
|
if whiptail --title "Wireless regulatory database" --yesno \
|
|
"Wireless hardware detected. Would you like to install wireless-regdb (regulatory database)?" 10 60; then
|
|
install_package wireless-regdb
|
|
country_code=$(whiptail --title "Wireless Regulatory Domain" --inputbox \
|
|
"Enter your 2-letter ISO country code (e.g., US, GB, IN):" 10 60 3>&1 1>&2 2>&3)
|
|
if [ -n "$country_code" ]; then
|
|
echo "Updating regulatory domain to $country_code"
|
|
echo "WIRELESS_REGDOM=\"$country_code\"" | sudo tee -a /etc/conf.d/wireless-regdom
|
|
echo "Regulatory domain updated to $country_code"
|
|
else
|
|
echo "No country code entered. Skipping regulatory domain update."
|
|
fi
|
|
fi
|
|
fi
|
|
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
|
|
echo "== Installing Bluetooth and its dependencies =="
|
|
install_dependencies bluedevil bluez
|
|
sudo systemctl enable --now bluetooth
|
|
fi
|
|
}
|
|
|
|
# function name : setup u2f
|
|
# Description: setup pam-u2f for login using Yubikey
|
|
setup_u2f() {
|
|
if whiptail --title "Setup U2F" --yesno "Would you like to setup U2F (Yubikey) authentication?" 10 60; then
|
|
install_package pam-u2f
|
|
mkdir -p ~/.config/Yubico
|
|
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 '/^auth\s*include\s*system-login/i auth include u2f-sufficient' /etc/pam.d/system-local-login
|
|
sudo sed -i '/^auth\s*include\s*system-auth/i auth include u2f-sufficient' /etc/pam.d/sudo
|
|
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
|
|
|
|
if whiptail --title "Enroll U2F Device" --yesno "Would you like to enroll your U2F device now?" 10 60; then
|
|
echo "Enrolling U2F device..."
|
|
pamu2fcfg -o "pam://$HOST" -i "pam://$HOST" > ~/.config/Yubico/u2f_keys
|
|
whiptail --title "U2F Enrollment" --msgbox "U2F device enrolled successfully. You can add more devices by running 'pamu2fcfg -o \"pam://$HOST\" -i \"pam://$HOST\" >> ~/.config/Yubico/u2f_keys'." 10 60
|
|
fi
|
|
fi
|
|
}
|
|
|
|
# function name : setup fprint
|
|
# Description: setup fprint for login using fingerprint reader
|
|
setup_fprint() {
|
|
if whiptail --title "Setup Fprint" --yesno "Would you like to setup fingerprint authentication (fprintd)?" 10 60; then
|
|
# using lsusb to check if fingerprint reader needs python-validity or fprintd
|
|
if lsusb | grep -q "Validity Sensors, Inc."; then
|
|
echo "Fingerprint reader from Validity Sensors detected. We will install python-validity instead of standard fprintd for better support"
|
|
echo "== Installing python-validity and its dependencies =="
|
|
install_package python-validity
|
|
echo "python-validity installation completed."
|
|
else
|
|
echo "== Installing fprintd and its dependencies =="
|
|
install_package fprintd
|
|
install_dependencies imagemagick
|
|
sudo systemctl enable --now fprintd
|
|
echo "fprintd installation completed."
|
|
fi
|
|
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
|
|
sudo sed -i '/^auth\s*include\s*system-auth/i auth [success=1 default=ignore] pam_succeed_if.so service in sudo:su:su-l tty in :unknown' /etc/pam.d/sudo
|
|
sudo sed -i '/^auth\s*include\s*system-auth/i auth sufficient pam_fprintd.so' /etc/pam.d/sudo
|
|
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 [success=1 default=ignore] pam_succeed_if.so service in sudo:su:su-l tty in :unknown' /etc/pam.d/polkit-1
|
|
sudo sed -i '/^auth\s*include\s*system-auth/i auth sufficient pam_fprintd.so' /etc/pam.d/polkit-1
|
|
|
|
if whiptail --title "Enroll Fingerprint" --yesno "Would you like to enroll your fingerprint now?" 10 60; then
|
|
echo "Enrolling fingerprint..."
|
|
fprintd-enroll
|
|
fi
|
|
echo "Fingerprint setup completed."
|
|
fi
|
|
}
|
|
|
|
# function name : setup SmartCard [WIP]
|
|
# Description: setup opensc for login using smartcard reader
|
|
setup_smartcard() {
|
|
if whiptail --title "Setup SmartCard" --yesno "Would you like to setup SmartCard (opensc) authentication?" 10 60; then
|
|
echo "== Installing opensc =="
|
|
install_package opensc
|
|
sudo systemctl enable --now pcscd
|
|
sudo systemctl enable --now pcscd.socket
|
|
echo "SmartCard (opensc) setup completed."
|
|
fi
|
|
}
|
|
|
|
# function name : setup firewall
|
|
# Description: Install and setup user selected firewall
|
|
setup_firewall() {
|
|
options=(
|
|
"ufw" "Install UFW" ON
|
|
"firewalld" "Install Firewalld" OFF
|
|
)
|
|
selected_groups=$(whiptail --title "Setup Firewall" --checklist "Choose the firewall you want to install:" 20 78 2 "${options[@]}" 3>&1 1>&2 2>&3)
|
|
|
|
for group in $selected_groups; do
|
|
case $group in
|
|
"\"ufw\"")
|
|
echo "== Installing UFW =="
|
|
install_package ufw
|
|
sudo systemctl enable --now ufw
|
|
sudo ufw enable
|
|
echo "UFW installed and started."
|
|
;;
|
|
"\"firewalld\"")
|
|
echo "== Installing Firewalld =="
|
|
install_package firewalld
|
|
sudo systemctl enable --now firewalld
|
|
echo "Firewalld installed and started."
|
|
;;
|
|
esac
|
|
done
|
|
}
|
|
|
|
# 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\"")
|
|
echo "== Installing ntpd-rs =="
|
|
install_package ntpd-rs
|
|
sudo systemctl enable --now ntpd-rs
|
|
;;
|
|
"\"chrony\"")
|
|
echo "== Installing chrony =="
|
|
install_package chrony
|
|
sudo systemctl enable --now chronyd
|
|
;;
|
|
"\"openntpd\"")
|
|
echo "== Installing openntpd =="
|
|
install_package openntpd
|
|
sudo systemctl enable --now openntpd
|
|
;;
|
|
"\"ntp\"")
|
|
echo "== Installing 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 sbctl
|
|
# Description: Install and setup sbctl for managing Secure Boot keys
|
|
setup_sbctl() {
|
|
if whiptail --title "Setup sbctl" --yesno "Would you like to setup sbctl?" 10 60; then
|
|
echo "== Installing sbctl =="
|
|
install_package sbctl
|
|
echo "== Setting up sbctl =="
|
|
sudo sbctl create-keys
|
|
sbctl verify | sed 's/✗ /sbctl sign -s /e'
|
|
if sbctl status | grep -q "Setup Mode:.*Disabled"; then
|
|
echo "Setup mode is disabled so we cannot enroll the keys. Please enable setup mode in your firmware settings and run 'sudo sbctl enroll-keys' manually."
|
|
else
|
|
echo "Enrolling keys with sbctl"
|
|
sudo sbctl enroll-keys -m
|
|
echo "Keys enrolled successfully."
|
|
fi
|
|
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
|
|
echo "== Installing fwupd =="
|
|
install_package fwupd
|
|
# if sbctl install then
|
|
if pacman -Qs sbctl > /dev/null; then
|
|
sudo sbctl sign -s -o /usr/lib/fwupd/efi/fwupdx64.efi.signed /usr/lib/fwupd/efi/fwupdx64.efi
|
|
sudo sbctl sign -s -o /usr/lib/systemd/boot/efi/systemd-bootx64.efi.signed /usr/lib/systemd/boot/efi/systemd-bootx64.efi
|
|
if pacman -Qs shim > /dev/null; then
|
|
sudo mkdir -p /boot/EFI/systemd
|
|
sudo sbctl sign -s -o /boot/EFI/systemd/shimx64.efi /usr/share/shim/shimx64.efi
|
|
fi
|
|
fi
|
|
fi
|
|
}
|
|
|
|
# function name : setup OpenRGB
|
|
# Description: Install OpenRGB for RGB devices control
|
|
setup_openrgb() {
|
|
if whiptail --title "Setup OpenRGB" --yesno "Would you like to setup OpenRGB?" 10 60; then
|
|
echo "== Installing OpenRGB =="
|
|
install_package openrgb
|
|
sudo gpasswd -a "$USER" plugdev
|
|
sudo systemctl enable --now openrgb
|
|
fi
|
|
}
|
|
|
|
# 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
|
|
echo "=== Installing virtualization packages ==="
|
|
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
|
|
echo "Virtualization setup completed."
|
|
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 ark dolphin
|
|
install_dependencies qt6-quick3d flatpak-kcm plymouth-kcm sddm-kcm
|
|
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
|
|
"mangojuice" "Install MangoJuice for MangoHUD and vkbasalt setup" ON
|
|
"Goverlay" "Install Goverlay for MangoHUD and vkbasalt setup (alternative)" OFF
|
|
"MangoHud" "Install MangoHud for performance monitoring and overlays" ON
|
|
"vkbasalt" "Install vkbasalt for Vulkan games" OFF
|
|
"GameMode" "Install GameMode for performance optimization" ON
|
|
"GameScope" "Install GameScope for gaming performance improvements (Not recommended on cachyos)" 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
|
|
;;
|
|
"\"mangojuice\"")
|
|
install_package mangojuice
|
|
;;
|
|
"\"Goverlay\"")
|
|
install_package goverlay
|
|
;;
|
|
"\"MangoHud\"")
|
|
install_package mangohud
|
|
;;
|
|
"\"vkbasalt\"")
|
|
install_package vkbasalt
|
|
;;
|
|
"\"GameMode\"")
|
|
install_package gamemode
|
|
;;
|
|
"\"GameScope\"")
|
|
install_package gamescope
|
|
;;
|
|
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_sbctl
|
|
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
|
|
)
|
|
cups_packages=(
|
|
cups
|
|
cups-pdf
|
|
cups-filters
|
|
system-config-printer
|
|
) |