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
#11
(09-05-2014, 02:03 PM)misko_2083 link Wrote: May I see the code? I have a few ideas.

Sure, keep in mind I haven't written any of the scripts yet, just this:

Code:
#! /bin/bash
#--------------------------------------------------------------------------------------------------------
# Name: Linux Lite Cleaner
# Description: A GUI tool to easily clean your Linux Lite system.
# Authors: Misko_2083, Jerry Bezencon
# Date: September 9th, 2014
# Website: https://www.freecinema2022.gq
#--------------------------------------------------------------------------------------------------------
ic="/usr/share/icons/zenity-llcc.png"

selection=$(zenity --window-icon="$ic" --list --checklist --width=890 --height=400 --column="Select" --column="Name" --column="Category" --column="Status" \
--column="Description" --text="Select the task you wish to perform, then click the Clean button. Sort Categories by clicking on the column.\n\nThere are 3 levels of Status:\n<b>Safe</b> - Safe to perform, no harm can be done.\n<b>Caution</b> - Proceed with caution, read the warning on the proceeding step.\n<b>Title</b> - Text go here.\n\nYou can select multiple tasks to perform." --title="Lite Cleaner" --ok-label="Clean" --cancel-label="Quit" \
"1" "Clean package cache" "Packages" "Safe" "Clean downloaded .deb files from your apt cache" \
"2" "Autoremove packages" "Packages" "Safe" "Remove packages automatically installed for programs and that are no longer present" \
"3" "Clear thumbnail cache" "Images" "Safe" "Delete thumbnail files created when viewing images" \
"4" "Empty all Trash Bins" "Home" "Safe" "Empty the Trash Bins for all users" \
"5" "Remove old kernels" "System" "Caution" "Remove kernels you no longer wish to boot from" )

# Exec scripts

echo $selection | grep "Clean package cache" > /dev/null
if [ $? = 0 ];then
/usr/scripts/clean/aptgetclean 2>/dev/null
fi

echo $selection | grep "Autoremove packages" > /dev/null
if [ $? = 0 ];then
/usr/scripts/clean/autoremovepkg 2>/dev/null
fi

echo $selection | grep "Clear thumbnail cache" > /dev/null
if [ $? = 0 ];then
/usr/scripts/clean/thumbnails 2>/dev/null
fi

echo $selection | grep "Empty all Trash Bins" > /dev/null
if [ $? = 0 ];then
/usr/scripts/clean/emptytrash 2>/dev/null
fi

echo $selection | grep "Remove old kernels" > /dev/null
if [ $? = 0 ];then
/usr/scripts/clean/remkernels 2>/dev/null
fi

Reply
#12
(09-05-2014, 09:28 PM)Valtam link Wrote: [quote author=misko_2083 link=topic=829.msg4678#msg4678 date=1409925836]
May I see the code? I have a few ideas.

Sure, keep in mind I haven't written any of the scripts yet, just this:

Code:
#! /bin/bash
#--------------------------------------------------------------------------------------------------------
# Name: Linux Lite Cleaner
# Description: A GUI tool to easily clean your Linux Lite system.
# Authors: Misko_2083, Jerry Bezencon
# Date: September 9th, 2014
# Website: https://www.freecinema2022.gq
#--------------------------------------------------------------------------------------------------------
ic="/usr/share/icons/zenity-llcc.png"

selection=$(zenity --window-icon="$ic" --list --checklist --width=890 --height=400 --column="Select" --column="Name" --column="Category" --column="Status" \
--column="Description" --text="Select the task you wish to perform, then click the Clean button. Sort Categories by clicking on the column.\n\nThere are 3 levels of Status:\n<b>Safe</b> - Safe to perform, no harm can be done.\n<b>Caution</b> - Proceed with caution, read the warning on the proceeding step.\n<b>Title</b> - Text go here.\n\nYou can select multiple tasks to perform." --title="Lite Cleaner" --ok-label="Clean" --cancel-label="Quit" \
"1" "Clean package cache" "Packages" "Safe" "Clean downloaded .deb files from your apt cache" \
"2" "Autoremove packages" "Packages" "Safe" "Remove packages automatically installed for programs and that are no longer present" \
"3" "Clear thumbnail cache" "Images" "Safe" "Delete thumbnail files created when viewing images" \
"4" "Empty all Trash Bins" "Home" "Safe" "Empty the Trash Bins for all users" \
"5" "Remove old kernels" "System" "Caution" "Remove kernels you no longer wish to boot from" )

# Exec scripts

echo $selection | grep "Clean package cache" > /dev/null
if [ $? = 0 ];then
/usr/scripts/clean/aptgetclean 2>/dev/null
fi

echo $selection | grep "Autoremove packages" > /dev/null
if [ $? = 0 ];then
/usr/scripts/clean/autoremovepkg 2>/dev/null
fi

echo $selection | grep "Clear thumbnail cache" > /dev/null
if [ $? = 0 ];then
/usr/scripts/clean/thumbnails 2>/dev/null
fi

echo $selection | grep "Empty all Trash Bins" > /dev/null
if [ $? = 0 ];then
/usr/scripts/clean/emptytrash 2>/dev/null
fi

echo $selection | grep "Remove old kernels" > /dev/null
if [ $? = 0 ];then
/usr/scripts/clean/remkernels 2>/dev/null
fi


[/quote]
Thank you. I made some modifications. Some options are preselected now and I figured out how to change the formating of the text.
More text options are here: https://developer.gnome.org/pygtk/stable...guage.html
It looks like it only works if you set text like this
--text='<span foreground="blue"> content </span>'
with '  '  not with " "
Code:
#! /bin/bash
#--------------------------------------------------------------------------------------------------------
# Name: Linux Lite Cleaner
# Description: A GUI tool to easily clean your Linux Lite system.
# Authors: Misko_2083, Jerry Bezencon
# Date: September 9th, 2014
# Website: https://www.freecinema2022.gq
#--------------------------------------------------------------------------------------------------------
ic="/usr/share/icons/zenity-llcc.png"

selection=$(zenity --window-icon="$ic" --list --checklist --width=890 --height=400 --column="Select" --column="Name" --column="Category" --column="Status" \
--column="Description" --text='Select the task you wish to perform, then click the Clean button. Sort Categories by clicking on the column.\n\nThere are 3 levels of Status:\n <span foreground="green">Safe</span>-Safe to perform, no harm can be done.\n<span foreground="#ec691d">Caution</span> - Proceed with caution, read the warning on the proceeding step.\n<b>Title</b> - Text go here.\n\nYou can select multiple tasks to perform.' --title="Lite Cleaner" --ok-label="Clean" --cancel-label="Quit" \
TRUE "Clean package cache" "Packages" "Safe" "Clean downloaded .deb files from your apt cache" \
TRUE "Autoremove packages" "Packages" "Safe" "Remove packages automatically installed for programs and that are no longer present" \
TRUE "Clear thumbnail cache" "Images" "Safe" "Delete thumbnail files created when viewing images" \
FALSE "Empty all Trash Bins" "Home" "Safe" "Empty the Trash Bins for all users" \
FALSE "Remove old kernels" "System" "Caution" "Remove kernels you no longer wish to boot from" )

# Exec scripts

echo $selection | grep "Clean package cache" > /dev/null
if [ $? = 0 ];then
/usr/scripts/clean/aptgetclean 2>/dev/null
fi

echo $selection | grep "Autoremove packages" > /dev/null
if [ $? = 0 ];then
/usr/scripts/clean/autoremovepkg 2>/dev/null
fi

echo $selection | grep "Clear thumbnail cache" > /dev/null
if [ $? = 0 ];then
/usr/scripts/clean/thumbnails 2>/dev/null
fi

echo $selection | grep "Empty all Trash Bins" > /dev/null
if [ $? = 0 ];then
/usr/scripts/clean/emptytrash 2>/dev/null
fi

echo $selection | grep "Remove old kernels" > /dev/null
if [ $? = 0 ];then
/usr/scripts/clean/remkernels 2>/dev/null
fi
More suggestions...
flash cookies
rm -rf $HOME/.macromedia/Flash_Player/#SharedObjects/*
rm -rf $HOME/.macromedia/Flash_Player/macromedia.com/support/flashplayer/sys/*
flash cache
rm -rf $HOME/.adobe/Flash_Player/AssetCache/*
firefox cache
rm -rf $HOME/.cache/mozilla/firefox/*.default/cache*/entries/*
firefox thumbnails
rm -rf $HOME/.cache/mozilla/firefox/*.default/thumbnails/*
firefox cookies
rm -f $HOME/.mozilla/firefox/*.default/cookies.sqlite
firefox Autocomplete history
rm -f $HOME/.mozilla/firefox/*.default/formhistory.sqlite
firefox passwords
rm -f $HOME/.mozilla/firefox/*.default/signons.sqlite
firefox site preferences
rm -f $HOME/.mozilla/firefox/*.default/content-prefs.sqlite
firefox DOM storage
rm -f $HOME.mozilla/firefox/*.default/webappsstore.sqlite
firefox session restore
rm -f $HOME/.mozilla/firefox/*.default/sessionstore.js
rm -f $HOME/.mozilla/firefox/*.default/sessionstore.bak
firefox URL history, bookmarks, downloads
rm -f $HOME/.mozilla/firefox/*.default/places.sqlite
Reply
#13
Nice misko, we can certainly use that, keep at it. Awesome stuff Smile
Reply
#14
This maybe a stupid question, but I was just wondering if it is at all possible, to help brand new users like me, to have a drop down on right click on any program/app and have an UnInstall choice which will 'take-out' the whole program and its dependencies.

Smile
Reply
#15
Have started on some of the scripts. Here's what the apt cache cleaner looks like, printing the directory size.

[Image: VvgXh0Z.png]

Source here: https://github.com/linuxlite/litecleaner
Reply
#16
(09-07-2014, 11:12 AM)Valtam link Wrote: Have started on some of the scripts. Here's what the apt cache cleaner looks like, printing the directory size.
Nice.
I've had some experiments on removing individual old kernels instead of all old kernels.
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)

# sed command adds all FALSE entries in the column 'Select'
# separator sets the output of the checklist, "\n" can also be used
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" )

# Next line just tests the output of a checklist
echo "$selection"
# Next line deletes all of the selected kernels
# gksudo "$(echo "$selection" | sed -e 's/^/sudo apt-get purge -y /')"
Reply
#17
Awesome stuff misko, I really like that and can't wait to test. What sort of results have you had so far?
Reply
#18
So far it's working with an old  3.15.0 kernel.
[Image: HKYMQh1.png]
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
And it worked. When I start the script again I get this:
[Image: zPjko1m.png]
Reply
#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
#20
Absolutely fantastic Smile

Sent from my GT-N7000 using Tapatalk

Reply


Forum Jump:


Users browsing this thread: 16 Guest(s)