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