From a1b28dbb56c907a4acf227288eff590e39770fe2 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Fri, 8 May 2020 11:21:06 +0300 Subject: [PATCH] kiss-outdated: Show packages from repositories instead of installed. --- contrib/kiss-outdated | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/contrib/kiss-outdated b/contrib/kiss-outdated index d95f3c9..5cc7c81 100755 --- a/contrib/kiss-outdated +++ b/contrib/kiss-outdated @@ -3,21 +3,24 @@ old_IFS=$IFS -# List via arguments or all installed packages. -if [ "$1" ]; then - set -- printf '%s\n' "$@" -else - set -- kiss l -fi +kiss s "${@:-*}" | (while read -r pkg_loc _; do { + read -r ver _ < "$pkg_loc/version" -"$@" | (while read -r pkg _; do { - read -r ver _ < "/var/db/kiss/installed/$pkg/version" + pkg=${pkg_loc##*/} # Fix some package names. case $pkg in - *-bin) fix=${pkg%%-bin} ;; + *-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%*}