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,7 +160,17 @@ if ! is_installed "yay"; then
fi fi
{{ else -}} {{ else -}}
if ! command -v yay &> /dev/null; then 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 git clone https://aur.archlinux.org/yay-bin.git && cd yay-bin && makepkg -si
fi
fi fi
{{ end -}} {{ end -}}