Files
lnx-arch/scripts/99_yay.sh
2024-08-26 16:51:33 -05:00

31 lines
578 B
Bash
Executable File

#!/usr/bin/env bash
# klevstul
# https://itsfoss.com/install-yay-arch-linux/
# https://askubuntu.com/questions/294736/run-a-shell-script-as-another-user-that-has-no-password
echo "<< 99_yay.sh >>"
user=poq
if [ "$EUID" -ne 0 ]
then echo "error: run as 'root'"
exit
fi
# update system
sudo pacman -Syu
# remove potential old yay download folder
rm -rf /tmp/yay
# clone repo
runuser -l ${user} -c 'git clone https://aur.archlinux.org/yay.git /tmp/yay'
# build yay
sudo -u ${user} bash -c 'cd /tmp/yay && makepkg -si'
# test yay
runuser -l ${user} -c 'yay --version'