mirror of
https://codeberg.org/kiss-community/kiss
synced 2024-11-19 21:10:07 -07:00
52 lines
1.1 KiB
Bash
Executable File
52 lines
1.1 KiB
Bash
Executable File
#!/bin/sh
|
|
# Check repository packages for updates
|
|
|
|
old_IFS=$IFS
|
|
|
|
kiss s "${@:-*}" | (while read -r pkg_loc _; do {
|
|
read -r ver _ < "$pkg_loc/version"
|
|
|
|
pkg=${pkg_loc##*/}
|
|
|
|
# Fix some package names.
|
|
case $pkg in
|
|
*-bin) fix=${pkg%%-bin} ;;
|
|
*[0-9]r) fix=${pkg%%r} ;;
|
|
esac
|
|
|
|
# Ignore duplicates.
|
|
# shellcheck disable=2106
|
|
case $seen in
|
|
*" ${fix:-$pkg} "*) continue ;;
|
|
*) seen=" $seen ${fix:-$pkg} " ;;
|
|
esac
|
|
|
|
# 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)
|