Closed auipga closed 5 months ago
One can easily make a little script to filter out whatever is shown and use it as "check command" instead of default checkupdates script. From the extension, there is no filter option.
Ok, thanks. This is a first working example of checkupgrade-filter
Usage:
checkupgrade-filter
like checkupgrade
, unalteredcheckupgrade-filter --major
only major updates (X.x.x-x)checkupgrade-filter --minor
only major updates (x.X.x-x)checkupgrade-filter --patch
only major updates (x.x.X-x)checkupgrade-filter --release
only major updates (x.x.x-X)checkupgrade-filter --major --release
checkupgrade-filter --minor-up
short for --major --minor
checkupgrade-filter --patch-up
short for --major --minor --patch
In cases 6-8 the packages are grouped in this order: major, minor, patch, release.#!/usr/bin/env bash
if [ -z $1 ]; then
checkupdates
exit $!
fi
major=""
minor=""
patch=""
release=""
while read line; do
words=(${line// / }) # array ("cryptsetup", "2.5.0-3", "->", "2.5.0-4")
pkg_name=${words[0]} # "cryptsetup"
pkg_vold=${words[1]} # "2.5.0-3"
pkg_vnew=${words[3]} # "2.5.0-4"
vold_=( ${pkg_vold//./ } ) # array ("2", "5", "0-3")
vnew_=( ${pkg_vnew//./ } ) # array ("2", "5", "0-4")
if [[ ${vold_[0]} != ${vnew_[0]} ]]; then # "2"!="2"
major+="${line}\n"
elif [[ ${vold_[1]} != ${vnew_[1]} ]]; then # "5"!="5"
minor+="${line}\n"
elif [[ ${vold_[2]} != ${vnew_[2]} ]]; then # "0-3"!="0-4"
if [[ ${pkg_vold##*-} == ${pkg_vnew##*-} ]]; then # "3"=="4"
patch+="${line}\n"
else
release+="${line}\n" # example goes here
fi
fi
done < <(checkupdates)
if [ $1 == --patch-up ]; then
echo -en ${major}
echo -en ${minor}
echo -en ${patch}
elif [ $1 == --minor-up ]; then
echo -en ${major}
echo -en ${minor}
else
[[ "$*" =~ "--major" ]] && echo -en ${major}
[[ "$*" =~ "--minor" ]] && echo -en ${minor}
[[ "$*" =~ "--patch" ]] && echo -en ${patch}
[[ "$*" =~ "--release" ]] && echo -en ${release}
fi
You could add this to the wiki section, for others to find it ;)
Is there a way to only show major updates and hide the minor ones? I found nothing about this topic.