Merge pull request #217 from nnyyxxxx/testing-3

Move AUR helper functionality to common-script
This commit is contained in:
Chris Titus 2024-09-10 16:29:35 -05:00 committed by GitHub
commit b09a57733e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 38 additions and 53 deletions

View File

@ -11,6 +11,36 @@ command_exists() {
which "$1" >/dev/null 2>&1 which "$1" >/dev/null 2>&1
} }
checkAURHelper() {
## Check & Install AUR helper
if [ "$PACKAGER" = "pacman" ]; then
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
fi
fi
}
checkEscalationTool() { checkEscalationTool() {
## Check for escalation tools. ## Check for escalation tools.
if [ -z "$ESCALATION_TOOL_CHECKED" ]; then if [ -z "$ESCALATION_TOOL_CHECKED" ]; then
@ -100,4 +130,5 @@ checkEnv() {
checkSuperUser checkSuperUser
checkDistro checkDistro
checkEscalationTool checkEscalationTool
checkAURHelper
} }

View File

@ -15,22 +15,6 @@ installDepend() {
else else
echo "Multilib is already enabled." echo "Multilib is already enabled."
fi fi
if ! command_exists yay && ! command_exists paru; then
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
else
echo "Aur helper already installed"
fi
if command_exists yay; then
AUR_HELPER="yay"
elif command_exists paru; then
AUR_HELPER="paru"
else
echo "No AUR helper found. Please install yay or paru."
exit 1
fi
$AUR_HELPER -S --needed --noconfirm "$DEPENDENCIES" $AUR_HELPER -S --needed --noconfirm "$DEPENDENCIES"
;; ;;
apt-get|nala) apt-get|nala)
@ -80,6 +64,7 @@ install_additional_dependencies() {
} }
checkEnv checkEnv
checkAURHelper
checkEscalationTool checkEscalationTool
installDepend installDepend
install_additional_dependencies install_additional_dependencies

View File

@ -13,22 +13,6 @@ installDepend() {
else else
echo "Multilib is already enabled." echo "Multilib is already enabled."
fi fi
if ! command_exists yay && ! command_exists paru; then
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
else
echo "Aur helper already installed"
fi
if command_exists yay; then
AUR_HELPER="yay"
elif command_exists paru; then
AUR_HELPER="paru"
else
echo "No AUR helper found. Please install yay or paru."
exit 1
fi
$AUR_HELPER -S --needed --noconfirm wine giflib lib32-giflib libpng lib32-libpng libldap lib32-libldap gnutls lib32-gnutls \ $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 \ 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 \ lib32-libgpg-error alsa-plugins lib32-alsa-plugins alsa-lib lib32-alsa-lib libjpeg-turbo lib32-libjpeg-turbo \
@ -109,6 +93,7 @@ install_additional_dependencies() {
} }
checkEnv checkEnv
checkAURHelper
checkEscalationTool checkEscalationTool
installDepend installDepend
install_additional_dependencies install_additional_dependencies

View File

@ -5,25 +5,8 @@
fastUpdate() { fastUpdate() {
case ${PACKAGER} in case ${PACKAGER} in
pacman) pacman)
if ! command_exists yay && ! command_exists paru; then
echo "Installing yay as AUR helper..."
$ESCALATION_TOOL ${PACKAGER} -S --needed --noconfirm base-devel || { echo -e "${RED}Failed to install base-devel${RC}"; exit 1; }
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 || { echo -e "${RED}Failed to install yay${RC}"; exit 1; }
else
echo "AUR helper already installed"
fi
if command_exists yay; then $AUR_HELPER -S --needed --noconfirm rate-mirrors-bin
AUR_HELPER="yay"
elif command_exists paru; then
AUR_HELPER="paru"
else
echo "No AUR helper found. Please install yay or paru."
exit 1
fi
${AUR_HELPER} -S --needed --noconfirm rate-mirrors-bin
if [ -s /etc/pacman.d/mirrorlist ]; then if [ -s /etc/pacman.d/mirrorlist ]; then
$ESCALATION_TOOL cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak $ESCALATION_TOOL cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
@ -113,7 +96,8 @@ updateFlatpaks() {
} }
checkEnv checkEnv
checkAURHelper
checkEscalationTool checkEscalationTool
fastUpdate fastUpdate
updateSystem updateSystem
updateFlatpaks updateFlatpaks