remove-old-kernels: Simplify getting flavour list

Remove superfluous calls to 'grep' and 'tr'. Also, exclude "new" 'debuginfo'
packages along 'domU'.

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
This commit is contained in:
Виталий Чикунов 2022-06-26 01:37:52 +03:00
parent bfbe1212cf
commit 76991851aa

View File

@ -94,7 +94,7 @@ current_kernel_flavour="$uname_r"
current_kernel_flavour="${current_kernel_flavour#*-}"
current_kernel_flavour="${current_kernel_flavour%-*}"
if [ -n "$all" ] ; then
flavours="$(rpm -qa --queryformat '%{NAME}\n' | grep -F kernel-image- | grep -F -v domU | sort -u | cut -d "-" -f3- | tr '\n' ' ')"
flavours="$(rpm -qa --queryformat '%{NAME}\n' 'kernel-image-*' | grep -v -w -e domU -e debuginfo | sort -u | cut -d- -f3-)"
else
flavours="${kernel_flavour:-$current_kernel_flavour}"
fi