fix linux install: arch linux install yay in root user

This commit is contained in:
Yuan Chiu 2025-05-03 01:31:26 +08:00
parent bb473621e8
commit 7793b4db04

View File

@ -160,8 +160,18 @@ if ! is_installed "yay"; then
fi
{{ else -}}
if ! command -v yay &> /dev/null; then
if [ "$EUID" -ne 0 ]; then
mkdir -p /tmp/yay-build
useradd -m -G wheel builder && passwd -d builder
chown -R builder:builder /tmp/yay-build
echo 'builder ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
su - builder -c "git clone https://aur.archlinux.org/yay-bin.git /tmp/yay-build/yay"
su - builder -c "cd /tmp/yay-build/yay && makepkg -si --noconfirm"
rm -rf /tmp/yay-build
else
git clone https://aur.archlinux.org/yay-bin.git && cd yay-bin && makepkg -si
fi
fi
{{ end -}}
to_install_aur=()