prune-kernel 673 B

123456789101112131415161718192021
  1. #!/bin/bash
  2. # because I use CONFIG_LOCALVERSION_AUTO, not the same version again and
  3. # again, /boot and /lib/modules/ eventually fill up.
  4. # Dumb script to purge that stuff:
  5. for f in "$@"
  6. do
  7. if rpm -qf "/lib/modules/$f" >/dev/null; then
  8. echo "keeping $f (installed from rpm)"
  9. elif [ $(uname -r) = "$f" ]; then
  10. echo "keeping $f (running kernel) "
  11. else
  12. echo "removing $f"
  13. rm -f "/boot/initramfs-$f.img" "/boot/System.map-$f"
  14. rm -f "/boot/vmlinuz-$f" "/boot/config-$f"
  15. rm -rf "/lib/modules/$f"
  16. new-kernel-pkg --remove $f
  17. fi
  18. done