add script for querying latest versions of packages

Makes update checking much faster.
This commit is contained in:
Leonid Pliushch 2018-09-28 15:58:48 +03:00 committed by Yaksh Bariya
parent 6908b084f3
commit 793d997194
No known key found for this signature in database
GPG Key ID: F7486BA7D3D27581
1 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,23 @@
#!/bin/sh
##
## Script for querying latest version of package.
##
if [ -z "${1}" ]; then
echo "Usage: check-pkg-version.sh [package name]"
echo
echo "This script retrieves current package version"
echo "from https://www.archlinux.org."
fi
for repo in extra community core; do
for arch in x86_64 any; do
VERSION=$(curl -s https://www.archlinux.org/packages/${repo}/${arch}/${1}/ | grep 'itemprop="version"' | cut -d'"' -f4 | cut -d- -f1)
if [ -n "${VERSION}" ]; then
echo "${1}: ${VERSION}"
exit 0
fi
done
done
exit 1