This is bash/dash script that can update AUR packages that you installed your system and install AUR package (download tarball, extract and run makepkd -isc)
#!/bin/dash
case $1 in
update)
for i in $(pacman -Qm | awk '{print $1}'); do
cv=$(pacman -Q $i | awk '{print $2}')
uv=$(lynx -dump https://aur.archlinux.org/packages/$i | awk '/Package Details: / {print $4}')
if [ "$cv" = "$uv" ]; then
echo "$i ----------> Up To Date"
else
mkdir -p ~/.mshdir/scripts/mshaurB
cd ~/.mshdir/scripts/mshaurB
[ -d $i ] && rm -rf ./$i >> /dev/null 2>&1
[ -e $i.tar.gz ] && rm -f ./$i.tar.gz >> /dev/null 2>&1
wget https://aur.archlinux.org/cgit/aur.git/snapshot/$i.tar.gz
tar -xzf $i.tar.gz
cd ./$i
makepkg -isc
cd
fi
done
;;
install)
mkdir -p ~/.mshdir/scripts/mshaurB
cd ~/.mshdir/scripts/mshaurB
[ -d $2 ] && rm -rf ./$2 >> /dev/null 2>&1
[ -e $2.tar.gz ] && rm -f ./$2.tar.gz >> /dev/null 2>&1
wget https://aur.archlinux.org/cgit/aur.git/snapshot/$2.tar.gz
tar -xzf $2.tar.gz
cd ./$2
makepkg -isc
cd
;;
*)
echo "---------------------------------------------------------"
echo " Do update or install <packagename> after this command."
echo " Eg. $ mshaur update"
echo " Eg. $ mshaur install pikaur"
echo "---------------------------------------------------------"
;;
esac
get the script @ download-mshaur
The updated version using Aurweb RPC interface. It is more faster and technically correct. See the discussion here https://bbs.archlinux.org/viewtopic.php?id=281779. The script:
#!/bin/dash
case $1 in
update)
for i in $(pacman -Qm | cut -d ' ' -f 1); do
cv=$(pacman -Q $i | cut -d ' ' -f 2)
# uv=$(lynx -dump https://aur.archlinux.org/packages/$i | awk '/Package Details: / {print $4}')
uv=$(curl -s "https://aur.archlinux.org/rpc/?v=5&type=info&arg[]=$i" | jq -r '.results[]|.Version')
if [ "$cv" = "$uv" ]; then
echo "$i ----------> Up To Date"
else
mkdir -p ~/.mshdir/scripts/mshaurB
cd ~/.mshdir/scripts/mshaurB
[ -d $i ] && rm -rf ./$i >> /dev/null 2>&1
[ -e $i.tar.gz ] && rm -f ./$i.tar.gz >> /dev/null 2>&1
wget https://aur.archlinux.org/cgit/aur.git/snapshot/$i.tar.gz
tar -xzf $i.tar.gz
cd ./$i
makepkg -isc
cd
fi
done
;;
install)
mkdir -p ~/.mshdir/scripts/mshaurB
cd ~/.mshdir/scripts/mshaurB
[ -d $2 ] && rm -rf ./$2 >> /dev/null 2>&1
[ -e $2.tar.gz ] && rm -f ./$2.tar.gz >> /dev/null 2>&1
wget https://aur.archlinux.org/cgit/aur.git/snapshot/$2.tar.gz
tar -xzf $2.tar.gz
cd ./$2
makepkg -isc
cd
;;
*)
echo "---------------------------------------------------------"
echo " Do update or install <packagename> after this command."
echo " Eg. $ mshaur update"
echo " Eg. $ mshaur install pikaur"
echo "---------------------------------------------------------"
;;
esac
The updated version of mshaur.
The extended version;
#!/bin/dash
case $1 in
update)
for i in $(pacman -Qm | cut -d ' ' -f 1); do
cv=$(pacman -Q $i | cut -d ' ' -f 2)
uv=$(curl -s "https://aur.archlinux.org/rpc/?v=5&type=info&arg[]=$i" | jq -r '.results[]|.Version')
if [ "$cv" = "$uv" ]; then
echo "$i ----------> Up To Date"
else
mkdir -p ~/.mshdir/scripts/mshaurB
cd ~/.mshdir/scripts/mshaurB
[ -d $i ] && rm -rf ./$i >> /dev/null 2>&1
[ -e $i.tar.gz ] && rm -f ./$i.tar.gz >> /dev/null 2>&1
wget https://aur.archlinux.org/cgit/aur.git/snapshot/$i.tar.gz
tar -xzf $i.tar.gz
cd ./$i
makepkg -isc
cd
fi
done
;;
checkupdate)
for i in $(pacman -Qm | cut -d ' ' -f 1); do
cv=$(pacman -Q $i | cut -d ' ' -f 2)
uv=$(curl -s "https://aur.archlinux.org/rpc/?v=5&type=info&arg[]=$i" | jq -r '.results[]|.Version')
if [ "$cv" = "$uv" ]; then
echo "$i ----------> Up To Date"
else
echo "$i needs update from $cv to $uv"
fi
done
;;
downloadupdate)
for i in $(pacman -Qm | cut -d ' ' -f 1); do
cv=$(pacman -Q $i | cut -d ' ' -f 2)
uv=$(curl -s "https://aur.archlinux.org/rpc/?v=5&type=info&arg[]=$i" | jq -r '.results[]|.Version')
if [ "$cv" = "$uv" ]; then
echo "$i ----------> Up To Date"
else
mkdir -p ~/.mshdir/scripts/mshaurB
cd ~/.mshdir/scripts/mshaurB
[ -d $i ] && rm -rf ./$i >> /dev/null 2>&1
[ -e $i.tar.gz ] && rm -f ./$i.tar.gz >> /dev/null 2>&1
wget https://aur.archlinux.org/cgit/aur.git/snapshot/$i.tar.gz
tar -xzf $i.tar.gz
cd
echo "$i.tar.gz has been downloaded and extracted it as $i."
fi
done
;;
install)
mkdir -p ~/.mshdir/scripts/mshaurB
cd ~/.mshdir/scripts/mshaurB
[ -d $2 ] && rm -rf ./$2 >> /dev/null 2>&1
[ -e $2.tar.gz ] && rm -f ./$2.tar.gz >> /dev/null 2>&1
wget https://aur.archlinux.org/cgit/aur.git/snapshot/$2.tar.gz
tar -xzf $2.tar.gz
cd ./$2
makepkg -isc
cd
;;
download)
mkdir -p ~/.mshdir/scripts/mshaurB
cd ~/.mshdir/scripts/mshaurB
[ -d $2 ] && rm -rf ./$2 >> /dev/null 2>&1
[ -e $2.tar.gz ] && rm -f ./$2.tar.gz >> /dev/null 2>&1
wget https://aur.archlinux.org/cgit/aur.git/snapshot/$2.tar.gz
tar -xzf $2.tar.gz
cd
echo "$2.tar.gz has been downloaded and extracted it as $2."
;;
*)
echo "---------------------------------------------------------"
echo " Do update or install <packagename> after this command."
echo " Eg. $ mshaur update"
echo " Eg. $ mshaur install pikaur"
echo "---------------------------------------------------------"
;;
esac
The extended version of mshaur is mshaur2.
-----