fix: No second sudo password prompt while installing yay

makepkg -si installs with sudo -k, which forgets the cached password.
Build with makepkg, install with sudo pacman -U.
This commit is contained in:
theupriser committed 2026-09-25 08:35:54 +02:00
1 parent 1522e5632d
commit 6c2e203563
2 files changed
+9 -1

No files matched your search

+6 -1
View File
@@ -41,8 +41,13 @@ bootstrap_yay() {
return 1
fi
# Build only, then install it ourselves: makepkg -i runs `sudo -k pacman`,
# which forgets the cached sudo password and asks for it again.
info "Building and installing yay (this runs makepkg as your user, not root)..."
if (cd "$tmp_dir/yay-bin" && makepkg -si --noconfirm); then
local -a pkgs
if (cd "$tmp_dir/yay-bin" && makepkg --noconfirm) &&
mapfile -t pkgs < <(cd "$tmp_dir/yay-bin" && makepkg --packagelist | grep -v -- '-debug-') &&
sudo pacman -U --noconfirm "${pkgs[@]}"; then
ok "yay installed."
rm -rf "$tmp_dir"
return 0