diff --git a/src/commands/common-script.sh b/src/commands/common-script.sh index 9844d1cd..aa338ba6 100644 --- a/src/commands/common-script.sh +++ b/src/commands/common-script.sh @@ -14,25 +14,29 @@ command_exists() { checkAURHelper() { ## Check & Install AUR helper if [ "$PACKAGER" = "pacman" ]; then - AUR_HELPERS="yay paru" - for helper in ${AUR_HELPERS}; do - if command_exists "${helper}"; then - AUR_HELPER=${helper} - echo "Using ${helper} as AUR helper" - return 0 + if [ -z "$AUR_HELPER_CHECKED" ]; then + AUR_HELPERS="yay paru" + for helper in ${AUR_HELPERS}; do + if command_exists "${helper}"; then + AUR_HELPER=${helper} + echo "Using ${helper} as AUR helper" + AUR_HELPER_CHECKED=true + return 0 + fi + done + + echo "Installing yay as AUR helper..." + $ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm base-devel + cd /opt && $ESCALATION_TOOL git clone https://aur.archlinux.org/yay-git.git && $ESCALATION_TOOL chown -R "$USER":"$USER" ./yay-git + cd yay-git && makepkg --noconfirm -si + + if command_exists yay; then + AUR_HELPER="yay" + AUR_HELPER_CHECKED=true + else + echo -e "${RED}Failed to install AUR helper.${RC}" + exit 1 fi - done - - echo "Installing yay as AUR helper..." - $ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm base-devel - cd /opt && $ESCALATION_TOOL git clone https://aur.archlinux.org/yay-git.git && $ESCALATION_TOOL chown -R "$USER":"$USER" ./yay-git - cd yay-git && makepkg --noconfirm -si - - if command_exists yay; then - AUR_HELPER="yay" - else - echo -e "${RED}Failed to install AUR helper.${RC}" - exit 1 fi fi } @@ -126,4 +130,5 @@ checkEnv() { checkSuperUser checkDistro checkEscalationTool + checkAURHelper } diff --git a/src/commands/system-setup/1-compile-setup.sh b/src/commands/system-setup/1-compile-setup.sh index b6890584..1a45d153 100755 --- a/src/commands/system-setup/1-compile-setup.sh +++ b/src/commands/system-setup/1-compile-setup.sh @@ -15,7 +15,6 @@ installDepend() { else echo "Multilib is already enabled." fi - checkAURHelper $AUR_HELPER -S --needed --noconfirm "$DEPENDENCIES" ;; apt-get|nala) @@ -65,6 +64,7 @@ install_additional_dependencies() { } checkEnv +checkAURHelper checkEscalationTool installDepend -install_additional_dependencies +install_additional_dependencies \ No newline at end of file diff --git a/src/commands/system-setup/2-gaming-setup.sh b/src/commands/system-setup/2-gaming-setup.sh index 20fc356d..ce52aea2 100755 --- a/src/commands/system-setup/2-gaming-setup.sh +++ b/src/commands/system-setup/2-gaming-setup.sh @@ -13,7 +13,6 @@ installDepend() { else echo "Multilib is already enabled." fi - checkAURHelper $AUR_HELPER -S --needed --noconfirm wine giflib lib32-giflib libpng lib32-libpng libldap lib32-libldap gnutls lib32-gnutls \ mpg123 lib32-mpg123 openal lib32-openal v4l-utils lib32-v4l-utils libpulse lib32-libpulse libgpg-error \ lib32-libgpg-error alsa-plugins lib32-alsa-plugins alsa-lib lib32-alsa-lib libjpeg-turbo lib32-libjpeg-turbo \ @@ -94,6 +93,7 @@ install_additional_dependencies() { } checkEnv +checkAURHelper checkEscalationTool installDepend -install_additional_dependencies +install_additional_dependencies \ No newline at end of file diff --git a/src/commands/system-setup/system-update.sh b/src/commands/system-setup/system-update.sh index b53db1c2..24c5eed2 100755 --- a/src/commands/system-setup/system-update.sh +++ b/src/commands/system-setup/system-update.sh @@ -6,7 +6,6 @@ fastUpdate() { case ${PACKAGER} in pacman) - checkAURHelper $AUR_HELPER -S --needed --noconfirm rate-mirrors-bin if [ -s /etc/pacman.d/mirrorlist ]; then @@ -97,6 +96,7 @@ updateFlatpaks() { } checkEnv +checkAURHelper checkEscalationTool fastUpdate updateSystem