packages(arch): route byobu through yay (AUR-only); split official vs AUR lists so pacman --needed can't abort on a missing target; as_user prefers TARGET_USER for AUR builds

This commit is contained in:
mk committed 2026-07-28 05:44:45 +03:00
1 parent ff9fc4db4e
commit ca8f01083c
2 files changed
+35 -12

No files matched your search

+5 -4
View File
@@ -9,12 +9,13 @@ ok() { printf '\033[1;32mok\033[0m %s\n' "$*"; }
# run a command as root when not already root
sudo_() { if (( EUID == 0 )); then "$@"; else sudo "$@"; fi; }
# run a command AS the invoking (non-root) user — used for AUR builds, etc.
# when root: drop to SUDO_USER (or USER) via runuser; when not root: run directly.
# run a command AS the target non-root user — used for AUR builds, nvm, etc.
# precedence (when running as root): TARGET_USER (set by create-user) > SUDO_USER > USER.
# when not root: run directly as ourselves.
as_user() {
local u="$USER"
local u="${SUDO_USER:-$USER}"
if (( EUID == 0 )); then
u="${SUDO_USER:-$USER}"
u="${TARGET_USER:-${SUDO_USER:-$USER}}"
command -v runuser >/dev/null 2>&1 && runuser -u "$u" -- "$@" || su "$u" -c "$*"
else
"$@"