1 #!/bin/bash 1 #!/bin/bash 2 # SPDX-License-Identifier: GPL-2.0 << 3 2 4 # because I use CONFIG_LOCALVERSION_AUTO, not 3 # because I use CONFIG_LOCALVERSION_AUTO, not the same version again and 5 # again, /boot and /lib/modules/ eventually fi 4 # again, /boot and /lib/modules/ eventually fill up. 6 # Dumb script to purge that stuff: 5 # Dumb script to purge that stuff: 7 6 8 for f in "$@" 7 for f in "$@" 9 do 8 do 10 if rpm -qf "/lib/modules/$f" >/dev/nul 9 if rpm -qf "/lib/modules/$f" >/dev/null; then 11 echo "keeping $f (installed fr 10 echo "keeping $f (installed from rpm)" 12 elif [ $(uname -r) = "$f" ]; then 11 elif [ $(uname -r) = "$f" ]; then 13 echo "keeping $f (running kern 12 echo "keeping $f (running kernel) " 14 else 13 else 15 echo "removing $f" 14 echo "removing $f" 16 rm -f "/boot/initramfs-$f.img" 15 rm -f "/boot/initramfs-$f.img" "/boot/System.map-$f" 17 rm -f "/boot/vmlinuz-$f" "/b 16 rm -f "/boot/vmlinuz-$f" "/boot/config-$f" 18 rm -rf "/lib/modules/$f" 17 rm -rf "/lib/modules/$f" 19 if [ -x "$(command -v new-kern !! 18 new-kernel-pkg --remove $f 20 new-kernel-pkg --remov << 21 elif [ -x "$(command -v kernel << 22 kernel-install remove << 23 fi << 24 fi 19 fi 25 done 20 done
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.