File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ aur_username="aurbuild"
1212pacman_debug=false
1313pacman_args=()
1414failedpkg=()
15+ remove_list=()
16+ yay_depends=(" go" )
1517
1618trap ' exit 1' 1 2 3 15
1719
8284
8385# Install yay
8486if ! pacman -Qq yay 1> /dev/null 2>&1 ; then
85- (
86- _oldpwd=" $( pwd) "
87- pacman -Syy " ${pacman_args[@]} "
88- pacman -S --asdeps --needed " ${pacman_args[@]} " go
89- sudo -u " ${aur_username} " git clone " https://aur.archlinux.org/yay.git" " /tmp/yay"
90- cd " /tmp/yay"
91- sudo -u " ${aur_username} " makepkg --ignorearch --clean --cleanbuild --force --skippgpcheck --noconfirm
92- for _pkg in $( sudo -u " ${aur_username} " makepkg --packagelist) ; do
93- pacman " ${pacman_args[@]} " -U " ${_pkg} "
94- done
95- cd ..
96- remove " /tmp/yay"
97- cd " ${_oldpwd} "
98- )
87+ # Update database
88+ _oldpwd=" $( pwd) "
89+ pacman -Syy " ${pacman_args[@]} "
90+
91+ # Install depends
92+ for _pkg in " ${yay_depends[@]} " ; do
93+ if ! pacman -Qq " ${_pkg} " | grep -q " ${_pkg} " ; then
94+ pacman -S --asdeps --needed " ${pacman_args[@]} " " ${_pkg} "
95+ remove_list+=(" ${_pkg} " )
96+ fi
97+ done
98+
99+ # Build yay
100+ sudo -u " ${aur_username} " git clone " https://aur.archlinux.org/yay.git" " /tmp/yay"
101+ cd " /tmp/yay"
102+ sudo -u " ${aur_username} " makepkg --ignorearch --clean --cleanbuild --force --skippgpcheck --noconfirm
103+
104+ # Install yay
105+ for _pkg in $( sudo -u " ${aur_username} " makepkg --packagelist) ; do
106+ pacman " ${pacman_args[@]} " -U " ${_pkg} "
107+ done
108+
109+ # Remove debtis
110+ cd ..
111+ remove " /tmp/yay"
112+ cd " ${_oldpwd} "
99113fi
100114
101115if ! type -p yay > /dev/null; then
@@ -144,6 +158,11 @@ for _pkg in "${failedpkg[@]}"; do
144158 fi
145159done
146160
161+ # Remove packages
162+ readarray -t -O " ${# remove_list[@]} " remove_list < <( pacman -Qttdq)
163+ pacman -Rsnc " ${pacman_args[@]} " " ${remove_list[@]} "
164+
165+ # Clean up
147166yay -Sccc " ${pacman_args[@]} "
148167
149168# remove user and file
You can’t perform that action at this time.
0 commit comments