2024-08-15 11:17:42 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -x
|
|
|
|
|
|
|
|
export LC_ALL=en_DK.UTF-8
|
|
|
|
|
|
|
|
# if yay is installed and we aren't root, run it instead
|
|
|
|
if [[ -f /usr/bin/yay && $(id -u) != 0 ]]; then
|
|
|
|
if [[ "$1" == "-S" ]]; then
|
2024-08-15 11:22:35 +02:00
|
|
|
/usr/bin/yay --needed $*
|
2024-08-15 11:17:42 +02:00
|
|
|
else
|
2024-08-15 11:22:35 +02:00
|
|
|
/usr/bin/yay $*
|
2024-08-15 11:17:42 +02:00
|
|
|
fi
|
|
|
|
# otherwise attempt to run pacman, but keep the --needed for installs
|
|
|
|
elif [[ -f /usr/bin/pacman ]]; then
|
|
|
|
if [[ "$1" == "-S" ]]; then
|
2024-08-15 11:22:35 +02:00
|
|
|
/usr/bin/pacman --needed $*
|
2024-08-15 11:17:42 +02:00
|
|
|
else
|
2024-08-15 11:22:35 +02:00
|
|
|
/usr/bin/pacman $*
|
2024-08-15 11:17:42 +02:00
|
|
|
fi
|
|
|
|
# otherwise fail gracefully
|
|
|
|
else
|
|
|
|
printf "Neither yay or pacman was found.\n"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
set +x
|