Fixed aur install asking for password after long builds

This commit is contained in:
2026-07-06 12:53:37 +02:00
parent 6bfe034e02
commit 285abc517f
+10
View File
@@ -5,10 +5,20 @@
LOG="$HOME/aur-failed.log"
: > "$LOG"
# Keep sudo's credential cache warm for the whole AUR run. yay installs each
# built package via `sudo pacman`; a long compile can outlast sudo's default
# 15-minute timeout and trigger a password prompt mid-run. Authenticate once,
# then refresh the timestamp in the background (self-terminating if run.sh dies).
sudo -v || die "sudo authentication failed"
{ while true; do sudo -n true; sleep 60; kill -0 "$$" 2>/dev/null || exit; done; } &
sudo_keepalive=$!
while read -r pkg; do
yay -S --needed --noconfirm "$pkg" || echo "$pkg" >> "$LOG"
done < <(grep -vE '^\s*#|^\s*$' "$REPO_ROOT/03-user/packages/aur.txt")
kill "$sudo_keepalive" 2>/dev/null || true # stop the sudo refresher
if [ -s "$LOG" ]; then
echo ""
echo "!! $(wc -l < "$LOG") AUR package(s) FAILED — retry later with:"