From 3f091d45ed0025dd5daa41aa5f02c2729fcc8f0f Mon Sep 17 00:00:00 2001 From: Bruno Fontes Date: Fri, 22 Jun 2018 01:39:43 -0300 Subject: [PATCH] Aur now updates too --- Pacman/aur.sh | 11 ++++++++--- Pacman/updateRepositories.sh | 24 ++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/Pacman/aur.sh b/Pacman/aur.sh index 3e0dd8f..ad7014b 100644 --- a/Pacman/aur.sh +++ b/Pacman/aur.sh @@ -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 diff --git a/Pacman/updateRepositories.sh b/Pacman/updateRepositories.sh index 6822e37..66653c9 100644 --- a/Pacman/updateRepositories.sh +++ b/Pacman/updateRepositories.sh @@ -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 +