mirror of
https://codeberg.org/hyperreal/bin
synced 2024-11-01 08:33:06 +01:00
18 lines
395 B
Plaintext
18 lines
395 B
Plaintext
|
#!/usr/bin/env bash
|
||
|
|
||
|
# Source: https://docs.fedoraproject.org/en-US/quick-docs/upgrading-fedora-offline/
|
||
|
|
||
|
old_kernels=($(dnf repoquery --installonly --latest-limit=-1 -q))
|
||
|
if [ "${#old_kernels[@]}" -eq 0 ]; then
|
||
|
echo "No old kernels found"
|
||
|
exit 0
|
||
|
fi
|
||
|
|
||
|
if ! sudo dnf remove "${old_kernels[@]}"; then
|
||
|
echo "Failed to remove old kernels"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
echo "Removed old kernels"
|
||
|
exit 0
|