aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/prune-kernel
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/prune-kernel')
-rwxr-xr-xscripts/prune-kernel20
1 files changed, 20 insertions, 0 deletions
diff --git a/scripts/prune-kernel b/scripts/prune-kernel
new file mode 100755
index 000000000000..ab5034e1d081
--- /dev/null
+++ b/scripts/prune-kernel
@@ -0,0 +1,20 @@
1#!/bin/bash
2
3# because I use CONFIG_LOCALVERSION_AUTO, not the same version again and
4# again, /boot and /lib/modules/ eventually fill up.
5# Dumb script to purge that stuff:
6
7for f in "$@"
8do
9 if rpm -qf "/lib/modules/$f" >/dev/null; then
10 echo "keeping $f (installed from rpm)"
11 elif [ $(uname -r) = "$f" ]; then
12 echo "keeping $f (running kernel) "
13 else
14 echo "removing $f"
15 rm -f "/boot/initramfs-$f.img" "/boot/System.map-$f"
16 rm -f "/boot/vmlinuz-$f" "/boot/config-$f"
17 rm -rf "/lib/modules/$f"
18 new-kernel-pkg --remove $f
19 fi
20done