blob: d8d55592d427f82f36c498813f197753f5485083 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
#!/bin/sh
#
# Check installed packages for updates.
old_IFS=$IFS
# Notify the user
printf '\033[1;33m-> \033[1;36mNOTE \033[m%s\n' \
"Sometimes repology can reply with empty strings for a package" \
"It is a good idea to double check the results." >&2
# List via arguments or all installed packages.
if [ "$1" ]; then
set -- printf '%s\n' "$@"
else
set -- kiss l
fi
"$@" | (while read -r pkg _; do {
read -r ver _ < "/var/db/kiss/installed/$pkg/version"
# Fix some package names.
case $pkg in
*-bin) fix=${pkg%%-bin} ;;
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
{
# Sometimes rep becomes whitespace so the
# other check passes.
[ "$rep" ] || continue
[ "$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)
|