J. Bruce Fields | b64e86c | 2013-07-10 16:54:34 -0400 | [diff] [blame] | 1 | #!/bin/bash |
Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 2 | # SPDX-License-Identifier: GPL-2.0 |
J. Bruce Fields | b64e86c | 2013-07-10 16:54:34 -0400 | [diff] [blame] | 3 | |
| 4 | # because I use CONFIG_LOCALVERSION_AUTO, not the same version again and |
| 5 | # again, /boot and /lib/modules/ eventually fill up. |
| 6 | # Dumb script to purge that stuff: |
| 7 | |
| 8 | for f in "$@" |
| 9 | do |
| 10 | if rpm -qf "/lib/modules/$f" >/dev/null; then |
| 11 | echo "keeping $f (installed from rpm)" |
| 12 | elif [ $(uname -r) = "$f" ]; then |
| 13 | echo "keeping $f (running kernel) " |
| 14 | else |
| 15 | echo "removing $f" |
| 16 | rm -f "/boot/initramfs-$f.img" "/boot/System.map-$f" |
| 17 | rm -f "/boot/vmlinuz-$f" "/boot/config-$f" |
| 18 | rm -rf "/lib/modules/$f" |
| 19 | new-kernel-pkg --remove $f |
| 20 | fi |
| 21 | done |