diff --git a/scripts/prune-kernel b/scripts/prune-kernel index e8aa940bc0a9..9091ee1125f5 100755 --- a/scripts/prune-kernel +++ b/scripts/prune-kernel @@ -5,6 +5,11 @@ # again, /boot and /lib/modules/ eventually fill up. # Dumb script to purge that stuff: +if [ "$1" = -i ]; then + interactive=y + shift +fi + for f in "$@" do if rpm -qf "/lib/modules/$f" >/dev/null; then @@ -12,10 +17,20 @@ do elif [ $(uname -r) = "$f" ]; then echo "keeping $f (running kernel) " else - echo "removing $f" - rm -f "/boot/initramfs-$f.img" "/boot/System.map-$f" - rm -f "/boot/vmlinuz-$f" "/boot/config-$f" - rm -rf "/lib/modules/$f" - new-kernel-pkg --remove $f + for g in $(ls -d /boot/initramfs-$f.img /boot/System.map-$f \ + /boot/vmlinuz-$f /boot/config-$f /lib/modules/$f \ + 2>/dev/null) + do + if [ "$interactive" = y ]; then + printf "remove '$g'? " + read ans + if [ $ans != Y -a $ans != y ]; then + continue + fi + else + echo "removing '$g'" + fi + rm -rf $g + done fi done