kiss-repooutdated (1296B)
1 #!/bin/sh 2 # 3 # Check repository packages for updates. 4 5 # Modified version of kiss-outdated from 6 # kiss-contrib 7 8 [ "$KISS_PATH" ] || 9 { printf '%s\n' 'KISS_PATH not set' >&2 ; exit 1 ;} 10 11 old_IFS=$IFS 12 13 printf '%s\n' "$KISS_PATH" | tr ':' '\n' | while read -r repo 14 do 15 find "$repo" ! -name .git -type d -mindepth 1 -maxdepth 1 16 done | (while read -r pkg ; do { 17 read -r ver _ < "$pkg/version" 18 pkg=${pkg##*/} 19 20 # Fix some package names. 21 case $pkg in 22 *-bin) fix=${pkg%%-bin} ;; 23 esac 24 25 # Grab the repology version from the SVG file. 26 rep=$(curl -s "https://repology.org/badge/latest-versions/${fix:-$pkg}.svg") 27 rep=${rep%</text>*} 28 rep=${rep##*>} 29 30 # Skip these. 31 # shellcheck disable=2106 32 { 33 [ "${rep:--}" = - ] && continue 34 [ "$ver" = git ] || [ "$ver" = 9999 ] && continue 35 case "$KISS_REPO_IGNORE" in *$pkg*) continue ;; esac 36 } 37 38 # Split the comma separated list. 39 # shellcheck disable=2086 40 { 41 IFS=', ' 42 set -f 43 set +f -- $rep 44 IFS=$old_IFS 45 } 46 47 # Parse comma separated version lists. 48 { 49 for v; do case $v in "$ver") match=1; esac; done 50 51 [ "$match" ] || { [ "$rep" ] && printf '%s\n' "$pkg $ver -> $rep" ;} 52 } 53 } & done; wait)