#!/usr/bin/env bash

#-----------------------------------
# Name:     yay
# Version:  1.0.0
# Author:   Solomon Laing
# Description:
# Installs the AUR helper yay on the
# system.
#-----------------------------------

clear

if command -v yay &>/dev/null; then
    echo "yay is already installed on the system."
    exit 0
fi

echo "This script is going to attempt install yay and it's dependencies. As such it will ask for root privilages."

if ! command -v fakeroot &>/dev/null; then
    sudo pacman -S --noconfirm base-devel
fi

cd /opt || exit 1
sudo -S git clone https://aur.archlinux.org/yay.git
sudo -S chown -R $USER:users ./yay
cd yay || exit 1
makepkg -si

exit 0
