earnest ma 2024-05-23 12:09:29 -04:00
parent 9c083eb0d4
commit 697144f451
Signed by: earnest ma
GPG Key ID: A343F43342EB6E2A
1 changed files with 15 additions and 0 deletions

15
fedora_rm_old_kernels.sh Normal file
View File

@ -0,0 +1,15 @@
#!/usr/bin/env bash
old_kernels=($(dnf repoquery --installonly --latest-limit=-1 -q))
if [ "${#old_kernels[@]}" -eq 0 ]; then
echo "No old kernels found"
exit 0
fi
if ! dnf remove "${old_kernels[@]}"; then
echo "Failed to remove old kernels"
exit 1
fi
echo "Removed old kernels"
exit 0