5 # Email : hayao@fascode.net
7 # (c) 2019-2021 Fascode Network.
11 aur_username="aurbuild"
14 if ! type -p yay > /dev/null; then
15 echo "yay was not found. Please install it."
20 # Delete file only if file exists
21 # remove <file1> <file2> ...
26 for _file in "${_list[@]}"; do
27 if [[ -f ${_file} ]]; then
29 elif [[ -d ${_file} ]]; then
32 echo "${_file} was deleted."
37 function user_check () {
38 if [[ $(getent passwd $1 > /dev/null ; printf $?) = 0 ]]; then
48 # Creating a aur user.
49 if [[ $(user_check ${aur_username}) = false ]]; then
50 useradd -m -d "/aurbuild_temp" "${aur_username}"
52 mkdir -p "/aurbuild_temp"
53 chmod 700 -R "/aurbuild_temp"
54 chown ${aur_username}:${aur_username} -R "/aurbuild_temp"
55 echo "${aur_username} ALL=(ALL) NOPASSWD:ALL" > "/etc/sudoers.d/aurbuild"
59 #eval $(cat "/etc/systemd/system/pacman-init.service" | grep 'ExecStart' | sed "s|ExecStart=||g" )
60 ls "/usr/share/pacman/keyrings/"*".gpg" | sed "s|.gpg||g" | xargs | pacman-key --populate
64 chmod +s /usr/bin/sudo
65 for _pkg in "${@}"; do
66 yes | sudo -u aurbuild \
79 --config "/etc/alteriso-pacman.conf" \
80 --cachedir "/var/cache/pacman/pkg/" \
83 if ! pacman -Qq "${_pkg}" > /dev/null 2>&1; then
84 echo -e "\n[aur.sh] Failed to install ${_pkg}\n"
89 yay -Sccc --noconfirm --config "/etc/alteriso-pacman.conf"
91 # remove user and file
94 remove /etc/sudoers.d/aurbuild
95 remove "/etc/alteriso-pacman.conf"
96 remove "/var/cache/pacman/pkg/"