Ubuntu QA:
BlogBrainstormPackage status
Log in
Ubuntu QA
The Ubuntu community has contributed 12357 ideas, 58479 comments, 1187050 votes

Idea #10491: Let applications specify what files can be safely deleted to save space



up
25
down
Written by Warbo the 30 Jun 08 at 01:52. Category: System.
Related to: Nothing/Others. Status: New
Description
There are a lot of ideas being proposed for a 'system cleanup' tool, however making such a tool standalone would cause a few problems:

* Some rewriting would need to be done by each distro (files in different places and such)
* Only a limited number of cleanup operations could be done (eg. clean out APT downloads, empty Trash, etc.)
* A lot of potentialy removable things would need to be left since the cleanup app can't be certain they're not used

I propose that to get around this there should be a method to let applications specify which files they handle can be removed safely, which any system cleanup tool can take advantage of. This could work using a set of files, with a set for the system (probably in /var/cache) and a set per user (probably in ~/.cache). I did contemplate using DBus, but that would require every cleanable application to be running or to start whilst the cleanup takes place, which isn't good.

An example for APT might be stored in the file /var/cache/cleanable/apt and would look something like the following (could be XML):

owner /usr/share/applications/synaptic.desktop
section
priority low
description Finished-with software install files
command apt-get clean
endsection

section
priority medium
description Unused kernel software
command /usr/bin/removeoldkernels
endsection

(where /usr/bin/removeoldkernels could be some shell script that does what it says)

Rhythmbox would maintain a file like ~/.cache/cleanable/rhythmbox which would look something like the following:

owner /usr/share/applications/rhythmbox.desktop
section
priority low
description Podcast episodes listened to
description[en] Podcast episodes listened to
file /home/user/Music/Podcasts/LUGRadio-15.ogg
file /home/user/Music/Podcasts/UbuntuUK-3.ogg
endsection

The "owner" application is given as a desktop file to allow internationalisation.

The priority gives tools an order to delete things in (if only a little cleanup is needed), in the Rhythmbox case the podcasts can be downloaded again if really necessary thus they have a low priority and can be deleted with very little impact to the user, but the old kernels might be useful if a hardware issue arises so they can be medium. Users' own files (eg. backup files ending in ~) should have higher priority since they can't be simply downloaded again.

The description tells the user why these things have been marked for deletion, with translations.

Files to be deleted are listed after the word "file".

Commands to run are listed after the word "command". Malicious software could potentially add unwanted things to these files, but if they have the permission to add "rm -rf /" to a system configuration file then they have permission to run that command directly in non-MAC setups anyway (think of cron, for example). User config files would be run as that user.

Keeping system things (like APT) separate makes it possible for each user to clean their Home directory without needing superuser privileges, but also possible for admin users to clean the system as well. Perhaps PolicyKit could be used here too, but I'm not familiar with it.

(Of course, this is all open to discussion, so don't let some detail bring the whole thing down)

Attachments
No attachments.


Duplicates


Comments
notyetroot wrote on the 10 Aug 08 at 16:50
Maybe there could be a 'fingerprint' on each file, like a resource fork, with data such as the use of the file, cleanup information, what program created it, digital signing, etc.


Post your comment