remove-old-kernels: Do not try to output removal list if it's empty

Fixes: 573337d ("remove-old-kernels: Change confirmation logic")
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
This commit is contained in:
Виталий Чикунов 2022-06-26 09:02:42 +03:00
parent a3fff046ef
commit 185d99fade

View File

@ -175,16 +175,16 @@ printf "%s" "$keep_kernels"
[ -n "$other_flavours" ] && echo "Specify -A to remove all kernels of other flavours than $kernel_flavour."
echo
howmuch=$(echo "$remove_kernels" | grep -c .)
[ "$howmuch" -eq 1 ] && phrase="this kernel" || phrase="these $BRIGHT$howmuch$NORM kernels"
echo "Removing $phrase:"
echo "$remove_kernels"
if [ -z "$apt_args_list" ] ; then
echo "Nothing to remove."
exit 0
fi
howmuch=$(echo "$remove_kernels" | grep -c .)
[ "$howmuch" -eq 1 ] && phrase="this kernel" || phrase="these $BRIGHT$howmuch$NORM kernels"
echo "Removing $phrase:"
echo "$remove_kernels"
if [ "$UID" != "0" ]; then
echo >&2 "${RED}Warning: This program requires root privileges.$NORM"
fi