Skip to content

Commit

Permalink
Merge pull request #52 from nbhirud/fedora17
Browse files Browse the repository at this point in the history
fedora - script to clean up old kernels
  • Loading branch information
nbhirud authored May 30, 2024
2 parents 542053c + e53ab44 commit bfc2b8d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions linux/fedora/Clean_Up_Old_Kernels.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit bfc2b8d

Please sign in to comment.