Aur now updates too

This commit is contained in:
Bruno Fontes 2018-06-22 01:39:43 -03:00
parent ffe9452cbe
commit 3f091d45ed
2 changed files with 30 additions and 5 deletions

View File

@ -1,7 +1,12 @@
sudo echo
if [ -z "$2" ]; then
echo -n Sudo Password:
read -s sudoPass
else
sudoPass=$2
fi
mkdir -p ~/AUR
cd ~/AUR
git clone https://aur.archlinux.org/"$1".git
cd "$1"
echo "cd ..; rm -rf ""$1""" > clean.sh
sudo yes | makepkg -si && ./clean.sh && notify-send """$1"" installed!"
echo "cd --; rm -rf ~/AUR/""$1""" > clean.sh
echo "$sudoPass" | sudo -S yes | makepkg -si && source clean.sh

View File

@ -1,6 +1,26 @@
echo -n Please type your sudo password:
read -s sudoPass
echo;
check_pkgversion() {
newver=$(curl -s "https://aur.archlinux.org/rpc.php?type=info&arg=$1" | awk -F : '{print $10}' | awk -F , '{print $1}' | sed 's/"//g')
currentver=$(pacman -Qi $1 | awk '{print $3}' | head -n 2 | tail -n 1)
if [[ $newver != $currentver ]]; then
echo 1
fi
}
echo
echo Updating with Pacman...
echo
pacman -Syu --color always
echo "$sudoPass" | sudo -S pacman -Syu --color always
echo
yes | pacman -Sc --color always
aurpkgs=$(pacman -Qm | awk '{print $1}')
for line in $aurpkgs
do
vcheck=$(check_pkgversion $line)
if [[ $vcheck == 1 ]]; then
source ~/aur.sh "$line" "$sudoPass"
fi
done
echo "$sudoPass" | sudo -S yes | pacman -Sc --color always