Added multiple functions to arch-setup.sh script

- Added functions to install packages, check whiptail, add repositories, update system, and setup Pacman configuration.
- Implemented GPU setup function to handle NVIDIA, AMD, and Intel GPUs.
- Included functions to setup firewall, flatpak, fwupd, KDE Connect, and office suite.
This commit is contained in:
2025-03-21 08:37:07 +01:00
parent 9b9ec12b8e
commit 09c20a60b7

View File

@@ -31,7 +31,7 @@ add_repositories() {
selected_repos=$(whiptail --title "Add Repositories" --checklist \ selected_repos=$(whiptail --title "Add Repositories" --checklist \
"Choose the repositories you want to add:" 20 78 4 \ "Choose the repositories you want to add:" 20 78 4 \
"${options[@]}" 3>&1 1>&2 2>&3) "${options[@]}" 3>&1 1>&2 2>&3)
for repo in $selected_repos; do for repo in $selected_repos; do
case $repo in case $repo in
@@ -53,7 +53,7 @@ add_repositories() {
sudo pacman -U --noconfirm 'https://mirror.trap.moe/chromatic/x86_64/chromatic-mirrorlist-20250315-1-any.pkg.tar.zst' sudo pacman -U --noconfirm 'https://mirror.trap.moe/chromatic/x86_64/chromatic-mirrorlist-20250315-1-any.pkg.tar.zst'
echo '[chromatic]' | sudo tee -a /etc/pacman.conf echo '[chromatic]' | sudo tee -a /etc/pacman.conf
echo 'Include = /etc/pacman.d/chromatic-mirrorlist' | 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 sudo pacman -Sy --noconfirm chromatic-keyring chromatic-mirrorlist
else else
echo "Chromatic repository is already installed." echo "Chromatic repository is already installed."
fi fi
@@ -98,17 +98,84 @@ setup_pacman() {
sudo sed -i 's/#ILoveCandy/ILoveCandy/' /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/#VerbosePkgLists/VerbosePkgLists/' /etc/pacman.conf
sudo sed -i 's/#CheckSpace/CheckSpace/' /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/#PrettyProgressBar/PrettyProgressBar/' /etc/pacman.conf
sudo sed -i 's/#ParallelDownloads = 5/ParallelDownloads = 10/' /etc/pacman.conf sudo sed -i 's/#ParallelDownloads = 5/ParallelDownloads = 10/' /etc/pacman.conf
sudo sed -i 's/#DisableDownloadTimeout/DisableDownloadTimeout/' /etc/pacman.conf sudo sed -i 's/#DisableDownloadTimeout/DisableDownloadTimeout/' /etc/pacman.conf
} }
# Function name: GPU setup
# Description: Setup GPU depending on the available devices
gpu_setup() {
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
sudo pacman -S --needed --noconfirm nvidia-open
fi
if pacman -Qs linux-zen > /dev/null; then
sudo pacman -S --needed --noconfirm nvidia-open
fi
if pacman -Qs linux-lts > /dev/null; then
sudo pacman -S --needed --noconfirm nvidia-open-lts
fi
if pacman -Qs linux-cachyos > /dev/null; then
sudo pacman -S --needed --noconfirm linux-cachyos-nvidia-open
fi
if ! lspci | grep -Ei "amd|intel" > /dev/null; then
sudo pacman -S --needed --noconfirm libva-nvidia-driver
fi
if (whiptail --title "Install Cuda" --yesno "Would you like to install Cuda?" 10 60) then
sudo pacman -S --needed --noconfirm cuda
fi
;;
"\"nouveau\"")
sudo pacman -S --needed --noconfirm mesa vulkan-nouveau
;;
esac
;;
*AMD*)
sudo pacman -S --needed --noconfirm mesa vulkan-radeon
;;
*Intel*)
sudo pacman -S --needed --noconfirm intel-media-driver vulkan-intel
;;
esac
}
# Function name: Setup plymouth # Function name: Setup plymouth
# Description: Setup plymouth # Description: Setup plymouth
setup_plymouth() { setup_plymouth() {
echo "quiet splash" | sudo tee -a /etc/kernel/cmdline if whiptail --title "Setup Plymouth" --yesno "Would you like to setup Plymouth?" 10 60; then
sudo pacman -S --needed --noconfirm plymouth plymouth-kcm echo "quiet splash" | sudo tee -a /etc/kernel/cmdline
sudo plymouth-set-default-theme -R catppuccin-mocha 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
} }
# Packages group definitions # Packages group definitions
@@ -132,6 +199,20 @@ theme_packages=(
#refind-theme-catppuccin-git #refind-theme-catppuccin-git
sddm-theme-catppuccin-git sddm-theme-catppuccin-git
) )
plasma_kde_apps=(
kate
okular
dolphin
gwenview
kcalc
spectacle
gparted
)
gnome_apps=(
gnome-console
gnome-disk-utility
gnome-firmware
)
games_packages=( games_packages=(
steam-native-runtime steam-native-runtime
heroic-games-launcher-bin heroic-games-launcher-bin
@@ -213,7 +294,7 @@ setup_browser() {
selected_browsers=$(whiptail --title "Setup Browser" --checklist \ selected_browsers=$(whiptail --title "Setup Browser" --checklist \
"Choose the browsers you want to install:" 20 78 13 \ "Choose the browsers you want to install:" 20 78 13 \
"${options[@]}" 3>&1 1>&2 2>&3) "${options[@]}" 3>&1 1>&2 2>&3)
for browser in $selected_browsers; do for browser in $selected_browsers; do
case $browser in case $browser in
@@ -265,6 +346,7 @@ setup_browser() {
setup_u2f() { setup_u2f() {
sudo pacman -S --needed --noconfirm pam-u2f sudo pacman -S --needed --noconfirm pam-u2f
mkdir ~/.config/Yubico mkdir ~/.config/Yubico
echo "Registering U2F device..."
pamu2fcfg -o "pam://$HOST" -i "pam://$HOST" > ~/.config/Yubico/u2f_keys pamu2fcfg -o "pam://$HOST" -i "pam://$HOST" > ~/.config/Yubico/u2f_keys
sudo touch /etc/pam.d/u2f-required sudo touch /etc/pam.d/u2f-required
sudo touch /etc/pam.d/u2f-sufficient sudo touch /etc/pam.d/u2f-sufficient
@@ -293,6 +375,8 @@ install_packages_group() {
options=( options=(
"Zsh" "Install Zsh packages" OFF "Zsh" "Install Zsh packages" OFF
"Theme" "Install Theme packages" OFF "Theme" "Install Theme packages" OFF
"Plasma Apps" "Install KDE Plasma Apps" OFF
"Gnome Apps" "Install Gnome Apps" OFF
"Games" "Install Games packages" OFF "Games" "Install Games packages" OFF
"Pipewire" "Install Pipewire packages" OFF "Pipewire" "Install Pipewire packages" OFF
"Cups" "Install Cups packages" OFF "Cups" "Install Cups packages" OFF
@@ -306,13 +390,16 @@ install_packages_group() {
) )
selected_groups=$(whiptail --title "Install Packages Group" --checklist \ selected_groups=$(whiptail --title "Install Packages Group" --checklist \
"Choose the packages group you want to install:" 20 78 12 \ "Choose the packages group you want to install:" 20 78 13 \
"${options[@]}" 3>&1 1>&2 2>&3) "${options[@]}" 3>&1 1>&2 2>&3)
for group in $selected_groups; do for group in $selected_groups; do
case $group in case $group in
"\"Zsh\"") "\"Zsh\"")
install_packages zsh_packages[@] install_packages zsh_packages[@]
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
;; ;;
"\"Theme\"") "\"Theme\"")
install_packages theme_packages[@] install_packages theme_packages[@]
@@ -331,9 +418,11 @@ install_packages_group() {
;; ;;
"\"Bluetooth\"") "\"Bluetooth\"")
install_packages bluetooth_packages[@] install_packages bluetooth_packages[@]
sudo systemctl enable --now bluetooth
;; ;;
"\"Virtualization\"") "\"Virtualization\"")
install_packages virtualization_packages[@] install_packages virtualization_packages[@]
sudo systemctl enable --now libvirtd
;; ;;
"\"Containers\"") "\"Containers\"")
install_packages containers_packages[@] install_packages containers_packages[@]
@@ -351,6 +440,101 @@ install_packages_group() {
done done
} }
# function name : setup_firewall
# Description: setup 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")
sudo pacman -S --needed --noconfirm ufw ufw-extras
sudo systemctl enable --now ufw
sudo ufw enable
;;
"firewalld")
sudo pacman -S --needed --noconfirm firewalld
sudo systemctl enable --now firewalld
;;
"iptables")
sudo pacman -S --needed --noconfirm iptables
;;
"nftables")
sudo pacman -S --needed --noconfirm nftables iptables-nft
;;
esac
}
# function name : setup_flatpak
# Description: setup flatpak
setup_flatpak() {
if whiptail --title "Setup Flatpak" --yesno "Would you like to setup Flatpak?" 10 60; then
sudo pacman -S --needed --noconfirm 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
sudo pacman -S --needed fwupd fwupd-efi
sudo systemctl enable --now fwupd
sudo systemctl enable --now fwupd-refresh
fi
}
# function name : setup_kdeconnect
# Description: setup kdeconnect
setup_kdeconnect() {
if whiptail --title "Setup KDE Connect" --yesno "Would you like to setup KDE Connect?" 10 60; then
options=(
"kdeconnect" "Install KDE Connect" OFF
"gsconnect" "Install GSConnect" OFF
)
selected_option=$(whiptail --title "Setup KDE Connect" --radiolist "Choose the package you want to install:" 20 78 2 "${options[@]}" 3>&1 1>&2 2>&3)
case $selected_option in
"\"kdeconnect\"")
sudo pacman -S --needed --noconfirm kdeconnect
;;
"\"gsconnect\"")
sudo yay -S --needed --noconfirm gsconnect gnome-shell-extension-gsconnect
;;
esac
fi
}
# 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\"")
sudo pacman -S --needed --noconfirm libreoffice-fresh
;;
"\"OnlyOffice\"")
sudo pacman -S --needed --noconfirm onlyoffice-bin
;;
"\"WPS Office\"")
sudo pacman -S --needed --noconfirm wps-office
;;
"\"FreeOffice\"")
sudo pacman -S --needed --noconfirm freeoffice
;;
esac
}
# Main script # Main script
check_whiptail check_whiptail
add_repositories add_repositories
@@ -359,3 +543,9 @@ setup_pacman
setup_browser setup_browser
install_packages_group install_packages_group
setup_plymouth setup_plymouth
gpu_setup
setup_firewall
setup_flatpak
setup_fwupd
setup_kdeconnect
setup_office_suite