5 # Email : hayao@fascode.net
7 # (c) 2019-2021 Fascode Network.
11 aur_username="aurbuild"
13 # Delete file only if file exists
14 # remove <file1> <file2> ...
19 for _file in "${_list[@]}"; do
20 if [[ -f ${_file} ]]; then
22 elif [[ -d ${_file} ]]; then
25 echo "${_file} was deleted."
30 function user_check () {
31 if [[ $(getent passwd $1 > /dev/null ; printf $?) = 0 ]]; then
41 # Creating a aur user.
42 if [[ $(user_check ${aur_username}) = false ]]; then
43 useradd -m -d "/aurbuild_temp" "${aur_username}"
45 mkdir -p "/aurbuild_temp"
46 chmod 700 -R "/aurbuild_temp"
47 chown ${aur_username}:${aur_username} -R "/aurbuild_temp"
48 echo "${aur_username} ALL=(ALL) NOPASSWD:ALL" > "/etc/sudoers.d/aurbuild"
52 #eval $(cat "/etc/systemd/system/pacman-init.service" | grep 'ExecStart' | sed "s|ExecStart=||g" )
53 ls "/usr/share/pacman/keyrings/"*".gpg" | sed "s|.gpg||g" | xargs | pacman-key --populate
55 # Un comment the mirror list.
56 sed -i "s/#Server/Server/g" "/etc/pacman.d/mirrorlist"
61 pacman -Syy --noconfirm
62 pacman --noconfirm -S --asdeps --needed go
63 sudo -u aurbuild git clone "https://aur.archlinux.org/yay.git" "/tmp/yay"
65 sudo -u aurbuild makepkg --ignorearch --clean --cleanbuild --force --skippgpcheck --install
71 if ! type -p yay > /dev/null; then
72 echo "Failed to install yay"
78 chmod +s /usr/bin/sudo
79 for _pkg in "${@}"; do
80 yes | sudo -u aurbuild \
93 --config "/etc/alteriso-pacman.conf" \
94 --cachedir "/var/cache/pacman/pkg/" \
97 if ! pacman -Qq "${_pkg}" > /dev/null 2>&1; then
98 echo -e "\n[aur.sh] Failed to install ${_pkg}\n"
103 yay -Sccc --noconfirm --config "/etc/alteriso-pacman.conf"
105 # remove user and file
107 remove /aurbuild_temp
108 remove /etc/sudoers.d/aurbuild
109 remove "/etc/alteriso-pacman.conf"
110 remove "/var/cache/pacman/pkg/"