#!/bin/bash

OLD=2.6.9-11.EL.root

echo "Old Kernel Version: $OLD"

rpms_to_remove=$( rpm -qa | grep $OLD )

echo "Remove the following rpms, please wait..."
echo "$rpms_to_remove"
rpm -e $rpms_to_remove
echo "...done."

echo "Run rm -rf /lib/modules/$OLD"
rm -rf /lib/modules/$OLD

echo
echo "Run rpm -qa | grep "^kernel"  | sort"
echo
rpm -qa | grep "^kernel"  | sort
echo
