remove-old-kernels: Simplify current_kernel_pkgname more

'current_kernel_pkgname' is used only to briefly inform user, thus epoch is not needed.

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

View File

@ -90,12 +90,12 @@ uname_r=$(uname -r)
# get running kernel version
current_kernel_package=$(rpmquery -qf "/lib/modules/$uname_r/kernel" 2>/dev/null)
if [ -n "$current_kernel_package" ] ; then
current_kernel_pkgname=$(rpmquery --queryformat "%{NAME}-%{SERIAL}:%{VERSION}-%{RELEASE}\n" -q "$current_kernel_package")
current_kernel_pkgname=${current_kernel_pkgname/\(none\):/}
current_kernel_pkgname=$(rpmquery --queryformat "%{NAME}-%{VERSION}-%{RELEASE}\n" -q "$current_kernel_package")
echo "Running kernel package: $current_kernel_pkgname (keeping)"
unset current_kernel_pkgname
else
current_kernel_pkgname="UNKNOWN"
echo "Running kernel version: $uname_r (package not found)"
fi
echo "Running kernel version: $current_kernel_pkgname"
# set kernel flavour. if not defined with -t option, use current
current_kernel_flavour="$uname_r"