5 # Email : hayao@fascode.net
7 # (c) 2019-2020 Fascode Network.
11 # Delete file only if file exists
12 # remove <file1> <file2> ...
17 for _file in "${_list[@]}"; do
18 if [[ -f ${_file} ]]; then
20 elif [[ -d ${_file} ]]; then
23 echo "${_file} was deleted."
28 function user_check () {
29 if [[ $(getent passwd $1 > /dev/null ; printf $?) = 0 ]]; then
39 # Creating a aur user.
40 if [[ $(user_check aurbuild) = false ]]; then
41 useradd -m -d "/aurbuild_temp" aurbuild
43 mkdir -p "/aurbuild_temp"
44 chmod 700 -R "/aurbuild_temp"
45 chown aurbuild:aurbuild -R "/aurbuild_temp"
46 echo "aurbuild ALL=(ALL) NOPASSWD:ALL" > "/etc/sudoers.d/aurbuild"
50 #eval $(cat "/etc/systemd/system/pacman-init.service" | grep 'ExecStart' | sed "s|ExecStart=||g" )
51 ls "/usr/share/pacman/keyrings/"*".gpg" | sed "s|.gpg||g" | xargs | pacman-key --populate
55 chmod +s /usr/bin/sudo
56 yes | sudo -u aurbuild yay -Sy --noconfirm --nocleanmenu --nodiffmenu --noeditmenu --noupgrademenu --noprovides --removemake --config "/etc/alteriso-pacman.conf" ${*}
59 # remove user and file
62 remove /etc/sudoers.d/aurbuild
63 remove "/etc/pacman.d/gnupg/"
64 remove "/etc/alteriso-pacman.conf"