09-09-2014, 12:44 AM
So far it's working with an old 3.15.0 kernel.
So I've used this to uninstall it.
And it worked. When I start the script again I get this:
So I've used this to uninstall it.
Code:
#! /bin/bash
#--------------------------------------------------------------------------------------------------------
# Name: Old Kernel Remover GUI
# Description: Prints out old kernels and removes them.
# Authors: Misko_2083, Jerry Bezencon
# Date: September 9th, 2014
# Website: https://www.freecinema2022.gq
#--------------------------------------------------------------------------------------------------------
ic="/usr/share/icons/zenity-llcc.png"
CURKERNEL=$(uname -r|sed 's/-*[a-z]//g'|sed 's/-386//g')
LINUXPKG="linux-(image|headers|ubuntu-modules|restricted-modules)"
METALINUXPKG="linux-(image|headers|restricted-modules)-(generic|i386|server|common|rt|xen)"
OLDKERNELS=$(dpkg -l|awk '{print $2}'|grep -E $LINUXPKG |grep -vE $METALINUXPKG|grep -v $CURKERNEL)
# sed command adds all FALSE entries in the column 'Select'
# separator sets the separator in the output of the checklist, could be a new line \n or anything else
selection=$(echo "$OLDKERNELS" | sed -e 's/^/FALSE\n/' | zenity --window-icon="$ic" --list --checklist --separator="" --width=890 --height=400 --column='Select' --column='Kernel' \
--text=' ' --title="Lite Cleaner" --ok-label="Clean" --cancel-label="Quit" )
echo $selection | grep linux-headers-linuxlite-3.15.0
if [ $? = 0 ];then
gksudo -g --message '.' "sudo apt-get purge linux-headers-linuxlite-3.15.0 --force-yes -y" | zenity --progress --title="removing kernel" --text="Uninstalling headers 3.15.0..." --pulsate --width=400 --auto-close --auto-kill
fi
echo $selection | grep linux-image-linuxlite-3.15.0
if [ $? = 0 ];then
gksudo -g --message '.' "sudo apt-get purge linux-image-linuxlite-3.15.0 --force-yes -y" | zenity --progress --title="removing kernel" --text="Uninstalling image 3.15.0..." --pulsate --width=400 --auto-close --auto-kill
fi