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