2020-03-03 15:49:04 -07:00
|
|
|
#!/bin/sh
|
2020-05-08 02:21:34 -06:00
|
|
|
# Check repository packages for updates
|
2020-05-09 12:28:09 -06:00
|
|
|
#
|
|
|
|
# Intended behavior.
|
|
|
|
# shellcheck disable=2106
|
2020-03-03 15:49:04 -07:00
|
|
|
|
2020-09-04 11:32:19 -06:00
|
|
|
kiss search "${@:-*}" | (while read -r pkg_loc _; do {
|
2020-05-09 12:28:09 -06:00
|
|
|
read -r ver _ 2>/dev/null < "$pkg_loc/version" || continue
|
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-09 12:28:09 -06:00
|
|
|
|
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.
|
|
|
|
{
|
2020-05-08 09:58:15 -06:00
|
|
|
case $rep in -|''|' ') continue; esac
|
|
|
|
case $ver in git) continue; esac
|
2020-03-03 15:49:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
# Split the comma separated list.
|
2020-05-09 12:28:09 -06:00
|
|
|
# Intentional (and safe) splitting.
|
2020-03-03 15:49:04 -07:00
|
|
|
# shellcheck disable=2086
|
|
|
|
{
|
2020-05-09 12:28:09 -06:00
|
|
|
IFS=', '
|
2020-03-03 15:49:04 -07:00
|
|
|
set -f
|
|
|
|
set +f -- $rep
|
2020-05-08 09:58:15 -06:00
|
|
|
unset IFS
|
2020-03-03 15:49:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
# 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)
|