On Wed, Feb 19, 2003 at 06:22:14PM +0100, Leif Mathis Gaup wrote:
tirsdag 18 februar 2003, 01:00, skrev Anders Johansson:
On Tue, 2003-02-18 at 00:43, Leif Mathis Gaup wrote:
<snip some perl>
I've been messing around with some bash scripting. The approach I take is making some rpm -q's and saving the names of packages that meet different criteria in different lists. And then crossreference these lists, to weed out packages that 'pass' one test but 'fail' another. At this stage the script is probably not very useful, but then it's mainly a 'proof of concepts' thing for me. Currently I'm applying tests to basically find top level rpms (that is one that may be removed without breaking dependencies). The reasoning being that one could run this script, then remove the 'known' rpm (i.e. the app you wanted to check out, and for which purpose some other rpms were installed by YaST or whoever) run the script again, and then diff the result with the result from before, to see if any other rpms have surfaced, that may be 'safely' removed. The tests that are applied at this stage are: rpm -q --whatrequires rpm -e --test All packages that rpm doesn't complain about are put in a sorted/uniq'ed/'crosschecked' 'results' file. *Including* such rpms that it would really not be a great idea to remove. I'm thinking that a kind of 'scoring' based on which rpmgroup the packages belong to might be useful(?), so I might try to come up with something in that direction. Anyway. Next, I've been thinking that it shouldn't be too hard to extend the script look at 'level two' rpms, and *their* dependencies: a.rpm *alone* depends on b.rpm, so can we remove b.rpm? If I can make *that* work, then iterating over that might potentially yield what is basically whole 'trees' of packages that may be taken off the system...
You list all packages where none of the files have been accessed in the last 180 days
This might be yet another test to incorporate.
Keep in mind though that a lot of people like to mount their file systems "noatime" for performance reasons.
Anyone doing that, is already likely to a: know what they're doing b: not being installing apps, just to 'check them out' c: not be interested in this script anyway
As I liked to do. And will again when SuSE 8.2 gets into my hands sometime in the future.
d: Seems I could be wrong about b+c ;)
But something that do find old nearly unused stuff would be nice. And if it then tried to find other unneeded stuff, then that too would be nice. Shouldn't bee too hard to implement an "rpm -q --whatrequires $rpm" in there. Could give us a small hint on something one can safely(?) remove.
"Hint" is the key word in this. What I'm doing with this script is *only* meant as 'hints' about what's on the system. Whatever comes out of the script is meant to be reviewed/considered carefully. Before any action is taken. Maybe in a couple of days I'll put it up somewhere, so you can try it out. Man, this thing just keeps growing... next thing you know it, I'll want to let it take cli -args, and whatnot... should probably 'translate' it to perl before it gets much bigger... ;P cheers, Jon Clausen