remove-old-kernels: check for latest kernel

ALTBUG: #34314
When flavor specified, find out which kernel is latest and protect it
from removing.
This commit is contained in:
Oleg Solovyov 2019-12-19 11:38:46 +03:00
parent 215df3e309
commit 5e37d67ac1

View File

@ -83,6 +83,15 @@ do
if [ "$current_kernel_flavour" = "$kernel_flavour" ] ; then
comparever="$(rpmevrcmp "$current_kernel_package" "$kernel")"
[ "$comparever" -lt 0 ] && continue
else
# check if kernel is latest with given flavour
latest=1
for kernel2 in $old_kernels
do
comparever="$(rpmevrcmp "$kernel" "$kernel2")"
[ "$comparever" -lt 0 ] && latest=0
done
[ "$latest" -eq 1 ] && continue
fi
echo " $kernel"
apt_args_list="$apt_args_list $(rpm -q --queryformat '%{NAME}=%{EPOCH}:%{VERSION}-%{RELEASE}\n' $kernel \