Skip to content

Commit

Permalink
fix: Switch order of function to avoid using a function not being dec…
Browse files Browse the repository at this point in the history
…lared yet
  • Loading branch information
Antiz96 committed Sep 23, 2024
1 parent 7d6753a commit 6a4bfe0
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions src/lib/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,6 @@
# https://github.com/Antiz96/arch-update
# SPDX-License-Identifier: GPL-3.0-or-later

# Definition of the AUR helper to use (depending on if/which one is installed on the system and if it's not already defined in arch-update.conf) for the optional AUR packages support
# shellcheck disable=SC2034
if [ -z "${aur_helper}" ]; then
if command -v paru > /dev/null; then
# shellcheck disable=SC2034
aur_helper="paru"
elif command -v yay > /dev/null; then
# shellcheck disable=SC2034
aur_helper="yay"
fi
else
if ! command -v "${aur_helper}" > /dev/null; then
warning_msg "$(eval_gettext "The \${aur_helper} AUR helper set for AUR packages support in the arch-update.conf configuration file is not found\n")"
fi
fi

# Check if flatpak is installed for the optional Flatpak support
# shellcheck disable=SC2034
flatpak=$(command -v flatpak)

# Check if notify-send is installed for the optional desktop notification support
# shellcheck disable=SC2034
notif=$(command -v notify-send)

# Definition of the colors for the colorized output
if [ -z "${no_color}" ]; then
bold="\e[1m"
Expand Down Expand Up @@ -94,6 +70,30 @@ quit_msg() {
read -n 1 -r -s -p $"$(info_msg "${msg}")" && echo
}

# Definition of the AUR helper to use (depending on if/which one is installed on the system and if it's not already defined in arch-update.conf) for the optional AUR packages support
# shellcheck disable=SC2034
if [ -z "${aur_helper}" ]; then
if command -v paru > /dev/null; then
# shellcheck disable=SC2034
aur_helper="paru"
elif command -v yay > /dev/null; then
# shellcheck disable=SC2034
aur_helper="yay"
fi
else
if ! command -v "${aur_helper}" > /dev/null; then
warning_msg "$(eval_gettext "The \${aur_helper} AUR helper set for AUR packages support in the arch-update.conf configuration file is not found\n")"
fi
fi

# Check if flatpak is installed for the optional Flatpak support
# shellcheck disable=SC2034
flatpak=$(command -v flatpak)

# Check if notify-send is installed for the optional desktop notification support
# shellcheck disable=SC2034
notif=$(command -v notify-send)

# Definition of the elevation command to use (depending on which one is installed on the system and if it's not already defined in arch-update.conf)
if [ -z "${su_cmd}" ]; then
if command -v sudo > /dev/null; then
Expand Down

0 comments on commit 6a4bfe0

Please sign in to comment.