Improve installation logic for pacman and yay

Refactor pacman and yay installation checks and commands.
This commit is contained in:
alvinlollo
2026-01-25 23:17:31 +11:00
committed by GitHub
parent 5f51b33eea
commit 20c10f7838
+6 -4
View File
@@ -138,10 +138,10 @@ for selection in $CHOICE; do
"4") "4")
echo "Installing Pacman Packages..." echo "Installing Pacman Packages..."
# Check if pacman binary is installed # Check if pacman binary is installed
if command -v pacman >/dev/null; then if ! command -v pacman >/dev/null; then
echo "Cannot proceed: pacman binary not found" echo "Cannot proceed: pacman binary not found"
exit 1 # exit with an error exit 1 # exit with an error
fi else
# Install pacman packages # Install pacman packages
# Runs local script unless it does not exit or fails # Runs local script unless it does not exit or fails
if [[ -f "./configs/PackagesPacman.txt" ]]; then if [[ -f "./configs/PackagesPacman.txt" ]]; then
@@ -154,14 +154,15 @@ for selection in $CHOICE; do
echo "--------------------------------------------------------------------" echo "--------------------------------------------------------------------"
echo "+ sleep 10" && sleep 10 echo "+ sleep 10" && sleep 10
fi fi
fi
;; ;;
"5") "5")
echo "Installing Yay and Yay Packages..." echo "Installing Yay and Yay Packages..."
# Check for pacman before installing yay # Check for pacman before installing yay
if command -v pacman >/dev/null; then if ! command -v pacman >/dev/null; then
echo "Cannot proceed: Not a arch based system" echo "Cannot proceed: Not a arch based system"
exit 1 # Exit with an error exit 1 # Exit with an error
fi else
# Install yay prerequisites # Install yay prerequisites
if ! sudo pacman -S --needed --noconfirm efibootmgr sbsigntools mokutil sbctl golang fakeroot debugedit make gcc; then if ! sudo pacman -S --needed --noconfirm efibootmgr sbsigntools mokutil sbctl golang fakeroot debugedit make gcc; then
echo "--------------------------------------------------------------------" echo "--------------------------------------------------------------------"
@@ -203,6 +204,7 @@ for selection in $CHOICE; do
echo "--------------------------------------------------------------------" echo "--------------------------------------------------------------------"
echo "+ sleep 10" && sleep 10 echo "+ sleep 10" && sleep 10
fi fi
fi
;; ;;
*) *)
echo "Invalid option selected: $selection" echo "Invalid option selected: $selection"