LINUX LITE 7.2 FINAL RELEASED - SEE RELEASE ANNOUNCEMENTS SECTION FOR DETAILS


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Lite Tweaks - Suggestions welcomed
#19
OK so I made a lot of changes.
First the script checks if there are any old kernels/headers...
If there are no old kernels it will just display a message.
This version will purge any output it gets from $checklist.
If no item was selected it will display a message 'Nothing was selected.'.
Cancel button in the progress bar is hidden.
The only thing I can't fix is that message when I click on Quit: 'Nothing was selected.'.
I guess I can always change the message to 'Nothing was selected or you pressed Quit.' Smile
Code:
#! /bin/bash

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)

# check if there are old kernels
echo "$OLDKERNELS" | grep linux*
if [  $? = 1 ]; then
zenity --error \
--title="Error" --text="No old Kernels found."
exit 0
fi

# 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" )

#check if any item was selected
echo "$selection" | grep linux*
if [ $? = 1 ]; then
zenity --error \
--title="Error" --text="Nothing was selected."
exit 0
fi

zenity --question --title="Question"  --text="Do you want to proceed?"
if [ "$?" -eq "0" ]; then
gksudo -g --message 'To run this cleaner your password is required. Enter your password, or press Cancel.' "sudo apt-get purge -y $selection" | zenity --progress --title='removing kernel/header'  --text='Uninstalling...' --no-cancel --pulsate --width=400 --auto-close --auto-kill

    if [ "${PIPESTATUS[0]}" -ne "0" ]; then
    zenity --error \
    --title="Error" --text="Uninstall has failed."
    exit 0
    fi
else
    exit 0
fi
   PROCEED=$(zenity --info --title="Cleaner" --text="The cleaner has finished."; echo $?)
   if [ ${PROCEED} -eq 1 ]; then
   zenity --info --title='Cleaner' --text='Clean Complete.'
exit 0
   fi
exit 0
Reply


Messages In This Thread
Lite Tweaks - Suggestions welcomed - by Valtam - 09-04-2014, 08:51 PM
Re: Lite Cleaner - Suggestions welcomed - by Alex - 09-04-2014, 10:17 PM
Re: Lite Cleaner - Suggestions welcomed - by Alex - 09-06-2014, 11:17 PM
Re: Lite Cleaner - Suggestions welcomed - by misko_2083 - 09-09-2014, 03:14 AM
Re: Lite Cleaner - Suggestions welcomed - by Alex - 09-16-2014, 01:05 AM
Re: Lite Cleaner - Suggestions welcomed - by Alex - 09-16-2014, 07:40 AM
Re: Lite Cleaner - Suggestions welcomed - by Alex - 09-16-2014, 10:45 AM
Re: Lite Cleaner - Suggestions welcomed - by bobw - 09-16-2014, 04:55 PM
Re: Lite Cleaner - Suggestions welcomed - by mpig - 09-17-2014, 07:16 AM
Re: Lite Cleaner - Suggestions welcomed - by bobw - 09-17-2014, 07:45 AM
Re: Lite Cleaner - Suggestions welcomed - by Alex - 09-18-2014, 08:20 AM
Re: Lite Cleaner - Suggestions welcomed - by eightbit - 09-29-2014, 05:11 AM
Re: Lite Cleaner - Suggestions welcomed - by bobw - 11-04-2014, 09:32 AM
Re: Lite Cleaner - Suggestions welcomed - by bobw - 11-04-2014, 01:47 PM
Re: Lite Tweaks - Suggestions welcomed - by N4RPS - 02-20-2015, 12:40 PM
Re: Lite Tweaks - Suggestions welcomed - by N4RPS - 02-22-2015, 11:48 PM
Re: Lite Tweaks - Suggestions welcomed - by Shady - 02-26-2015, 04:04 PM
Re: Lite Tweaks - Suggestions welcomed - by Hans - 03-02-2015, 11:27 AM
Re: Lite Tweaks - Suggestions welcomed - by Shady - 03-02-2015, 04:07 PM
Re: Lite Tweaks - Suggestions welcomed - by nomko - 06-02-2016, 07:09 AM
Re: Lite Tweaks - Suggestions welcomed - by MS - 10-09-2019, 04:36 AM
Re: Lite Tweaks - Suggestions welcomed - by MS - 10-09-2019, 02:26 PM
Re: Lite Tweaks - Suggestions welcomed - by MS - 10-12-2019, 02:53 AM
Re: Lite Tweaks - Suggestions welcomed - by MS - 10-12-2019, 10:46 AM

Forum Jump:


Users browsing this thread: 54 Guest(s)