Δημοσιεύτηκε: 11 Φεβ 2010, 04:46
από ftso
Ένα χρωματιστό scriptάκι για την εύκολη διαγραφή παλαιών πυρήνων...
Κώδικας: Επιλογή όλων
#!/bin/bash
#Copyright (C) 2010 Dimitris Diamantis (aka ftso)
#This is free software. You may redistribute copies of it under the terms of
#the GNU General Public License <http://www.gnu.org/licenses/GPL.html>
#There is NO WARRANTY, to the extent permitted by law.

clear
echo -e '\E[35m'"\033[1m### KERNEL CLEANER ###\033[0m"
echo
echo -e "\033[1mRunning kernel:\033[0m"
t=`uname -r | cut -c 1-9`
echo -e '\E[32m'"\033[1m$t\033[0m"

echo -e "\033[1mOther (old) kernels:\033[0m"
u=`ls /boot | grep vmlinuz | cut -d'-' -f2,3 | sed /$t/d`
echo -e '\E[33m'"\033[1m$u\033[0m"
echo -e "\033[1mEnter which you want to remove:\033[0m"
read kernel
echo $u | grep $kernel &> /dev/null
if [ $? -ne 0 ]; then
echo -e '\E[31m'"\033[1mWrong kernel! exit...\033[0m"
exit 1;
fi
g=`echo $kernel | wc -c`
if [ $g -lt 10 ]; then
echo -e '\E[31m'"\033[1mWrong kernel! exit...\033[0m"
tput sgr0
exit 1;
fi


echo -e "\033[1mPackages to remove:\033[0m"
c=`dpkg -l | grep ^ii | grep $kernel | awk -F' ' '{ print $2 }'`
echo -e '\E[36m'"\033[1m$c\033[0m"
echo -ne '\E[31m'"\033[1mRemove them (y/n)?\033[0m"
read -p ":"
if [ "$REPLY" == "y" ]; then
sudo aptitude remove $c
sudo aptitude autoclean
fi
tput sgr0
exit 1;


Φαίνεται καλύτερα σε μαύρο φόντο.
Με CTRL+C σταματάει...
Το χρησιμοποιείται με δικιά σας ευθύνη...
:)