Back to home page

OSCL-LXR

 
 

    


0001 #!/bin/bash
0002 # SPDX-License-Identifier: GPL-2.0
0003 
0004 # because I use CONFIG_LOCALVERSION_AUTO, not the same version again and
0005 # again, /boot and /lib/modules/ eventually fill up.
0006 # Dumb script to purge that stuff:
0007 
0008 for f in "$@"
0009 do
0010         if rpm -qf "/lib/modules/$f" >/dev/null; then
0011                 echo "keeping $f (installed from rpm)"
0012         elif [ $(uname -r) = "$f" ]; then
0013                 echo "keeping $f (running kernel) "
0014         else
0015                 echo "removing $f"
0016                 rm -f "/boot/initramfs-$f.img" "/boot/System.map-$f"
0017                 rm -f "/boot/vmlinuz-$f"   "/boot/config-$f"
0018                 rm -rf "/lib/modules/$f"
0019                 if [ -x "$(command -v new-kernel-pkg)" ]; then
0020                         new-kernel-pkg --remove $f
0021                 elif [ -x "$(command -v kernel-install)" ]; then
0022                         kernel-install remove $f
0023                 fi
0024         fi
0025 done