2020-03-03 15:49:04 -07:00
|
|
|
#!/bin/sh
|
2020-05-01 00:07:20 -06:00
|
|
|
# Check installed packages for updates
|
2020-03-03 15:49:04 -07:00
|
|
|
|
|
|
|
old_IFS=$IFS
|
|
|
|
|
2020-05-08 02:21:06 -06:00
|
|
|
kiss s "${@:-*}" | (while read -r pkg_loc _; do {
|
|
|
|
read -r ver _ < "$pkg_loc/version"
|
2020-03-03 15:49:04 -07:00
|
|
|
|
2020-05-08 02:21:06 -06:00
|
|
|
pkg=${pkg_loc##*/}
|
2020-03-03 15:49:04 -07:00
|
|
|
|
|
|
|
# Fix some package names.
|
|
|
|
case $pkg in
|
2020-05-08 02:21:06 -06:00
|
|
|
*-bin) fix=${pkg%%-bin} ;;
|
|
|
|
*[0-9]r) fix=${pkg%%r} ;;
|
2020-03-03 15:49:04 -07:00
|
|
|
esac
|
|
|
|
|
2020-05-08 02:21:06 -06:00
|
|
|
# Ignore duplicates.
|
|
|
|
# shellcheck disable=2106
|
|
|
|
case $seen in
|
|
|
|
*" ${fix:-$pkg} "*) continue ;;
|
|
|
|
*) seen=" $seen ${fix:-$pkg} " ;;
|
|
|
|
esac
|
|
|
|
|
2020-03-03 15:49:04 -07:00
|
|
|
# Grab the repology version from the SVG file.
|
|
|
|
rep=$(curl -s "https://repology.org/badge/latest-versions/${fix:-$pkg}.svg")
|
|
|
|
rep=${rep%</text>*}
|
|
|
|
rep=${rep##*>}
|
|
|
|
|
|
|
|
# Skip these.
|
|
|
|
# shellcheck disable=2106
|
|
|
|
{
|
|
|
|
[ "${rep:--}" = - ] && continue
|
|
|
|
[ "$ver" = git ] && continue
|
|
|
|
}
|
|
|
|
|
|
|
|
# Split the comma separated list.
|
|
|
|
# shellcheck disable=2086
|
|
|
|
{
|
|
|
|
IFS=', '
|
|
|
|
set -f
|
|
|
|
set +f -- $rep
|
|
|
|
IFS=$old_IFS
|
|
|
|
}
|
|
|
|
|
|
|
|
# Parse comma separated version lists.
|
|
|
|
{
|
|
|
|
for v; do case $v in "$ver") match=1; esac; done
|
|
|
|
|
|
|
|
[ "$match" ] || printf '%s\n' "$pkg $ver -> $rep"
|
|
|
|
}
|
|
|
|
} & done; wait)
|