#!/bin/bash
pacman -S pkg-config fakeroot
useradd -d /tmp/yay tmpuser
cp /etc/sudoers /etc/sudoers.orig
echo 'tmpuser ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
sudo -u tmpuser -s mkdir /tmp/yay
cd /tmp/yay
sudo -u tmpuser -s wget https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=paru -O PKGBUILD
sudo -u tmpuser -s  makepkg -si --noconfirm
cd
ps aux |grep tmpuser |grep -v grep |awk {'print $2'} | xargs -n1 kill -9
userdel tmpuser
rm -R /tmp/yay
mv /etc/sudoers.orig /etc/sudoers
rm -- "$0"
