Created
December 19, 2016 18:15
-
-
Save egg82/df2550a0b7cde20153dc51221065d9c1 to your computer and use it in GitHub Desktop.
clean_kernel.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
currentkernelver=`uname -r | cut -d - -f 1` | |
echo "Removing old modules.." | |
for n in /boot/*; do | |
n2=`echo "$n" | cut -d - -f 2` | |
if [ $n2 != $currentkernelver ]; then | |
rm -f $n | |
fi | |
done | |
for n in /usr/lib/debug/lib/modules/*; do | |
n2=`echo "$n" | rev | cut -d / -f 1 | rev | cut -d - -f 1` | |
if [ $n2 != $currentkernelver ]; then | |
rm -rf $n | |
fi | |
done | |
echo "Done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment