Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Another cruft script! - Updated
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
msalerno
Veteran
Veteran


Joined: 17 Dec 2002
Posts: 1336
Location: Sweating in South Florida

PostPosted: Sat Nov 25, 2006 6:12 am    Post subject: Another cruft script! - Updated Reply with quote

Not that these forums needed another cruft finding script, but I needed one to suit my needs. I have used both cruft and findcruft, but I needed something a little more tailored for me, no pun intended. So I did what 99% of the people here do, I waited for updates to the scripts. Well after waiting long enough and countless “grep –v”’s, I finally had a clearing in my time to write my own. I chose perl, since it's the only language I really know. The script will NOT delete any files. What it will do is scan your harddrive and compare it to the package contents lists. I also check other apps and paths like mysql, apache, portage, perl and python for directories that are not included in the CONTENT list. It's not very pretty, but it does a good job on my systems. It's still a work in progress, but I figured that I might as well make it available. Of course, you need to use this at your own risk.

Enjoy

Just execute the script. No switches or options needed. It will write 2 files. One file is a list of all installed packages, and the other is a list of all unknown files.

I am open to suggestions and recommendations.

It's very easy to add files or directories to the skip list, just open it in your favorite text editor.

http://vagabond.homeip.net/leftovers.pl

Currently working on filtering out some gcc dirs and figuring out how to filter out /usr/lib/local/* which I belive belongs to glibc, but I need to make sure.

Please post your false positives and let me know which package they belong to.

**This script will most likely find files that you still need. Before you delete anything, make sure its safe!
_________________
When harmonious relationships dissolve
Then respect and devotion arise;
When a nation falls to chaos
Then loyalty and patriotism are born.
-Lao Tse


Last edited by msalerno on Tue Nov 28, 2006 12:19 am; edited 5 times in total
Back to top
View user's profile Send private message
irondog
l33t
l33t


Joined: 07 Jul 2003
Posts: 715
Location: Voor mijn TV. Achter mijn pc.

PostPosted: Sun Nov 26, 2006 3:02 pm    Post subject: Reply with quote

Nice! :)
I'll try it next week
_________________
Alle dingen moeten onzin zijn.
Back to top
View user's profile Send private message
nesl247
Veteran
Veteran


Joined: 15 Jun 2004
Posts: 1614
Location: Florida

PostPosted: Sun Nov 26, 2006 5:33 pm    Post subject: Reply with quote

Small error:

Code:
Building Package contents
Creating list of installed packages
Package log written ./installedpkg.log
So my guess is that you don't have apache installed?
Alas, no mysql
readline() on closed filehandle MYSQLCF at ./leftovers.pl line 230.
Use of uninitialized value in hash element at ./leftovers.pl line 232.
Back to top
View user's profile Send private message
msalerno
Veteran
Veteran


Joined: 17 Dec 2002
Posts: 1336
Location: Sweating in South Florida

PostPosted: Sun Nov 26, 2006 5:57 pm    Post subject: Reply with quote

Fixed above error. I needed to return from the sub rather than let you know that you don't have mysql installed. One of these days, I'll have it print a message, but it's not necessary.

Thanks

I also updated the apache filter to include the config files (apache2 -S)
_________________
When harmonious relationships dissolve
Then respect and devotion arise;
When a nation falls to chaos
Then loyalty and patriotism are born.
-Lao Tse
Back to top
View user's profile Send private message
nesl247
Veteran
Veteran


Joined: 15 Jun 2004
Posts: 1614
Location: Florida

PostPosted: Sun Nov 26, 2006 10:03 pm    Post subject: Reply with quote

Now I get this:

Building Package contents
Creating list of installed packages
Package log written ./installedpkg.log
So my guess is that you don't have apache installed?
Searching File System
There seems to be a problem. Please check that you have sys-apps/findutils installed

And yes, I have findutils installed. [ebuild R ] sys-apps/findutils-4.3.1-r1
Back to top
View user's profile Send private message
pteppic
l33t
l33t


Joined: 28 Nov 2005
Posts: 781

PostPosted: Sun Nov 26, 2006 11:47 pm    Post subject: Reply with quote

nesl247 wrote:
Building Package contents
Creating list of installed packages
Package log written ./installedpkg.log
So my guess is that you don't have apache installed?
Searching File System
There seems to be a problem. Please check that you have sys-apps/findutils installed

I got that, then I ran it as root and it was fine (apart from the number of packages it reminded me to write ebuilds for :oops: )
Back to top
View user's profile Send private message
msalerno
Veteran
Veteran


Joined: 17 Dec 2002
Posts: 1336
Location: Sweating in South Florida

PostPosted: Mon Nov 27, 2006 10:09 pm    Post subject: Reply with quote

I updated the script to exclude some dirs used by gcc (gcc -v).
_________________
When harmonious relationships dissolve
Then respect and devotion arise;
When a nation falls to chaos
Then loyalty and patriotism are born.
-Lao Tse
Back to top
View user's profile Send private message
msalerno
Veteran
Veteran


Joined: 17 Dec 2002
Posts: 1336
Location: Sweating in South Florida

PostPosted: Mon Nov 27, 2006 11:14 pm    Post subject: Reply with quote

I also added glibc locale exclusion thanks to http://gentoo-wiki.com/TIP_Clean_Up_Cruft#False_Positives_rules_needed
_________________
When harmonious relationships dissolve
Then respect and devotion arise;
When a nation falls to chaos
Then loyalty and patriotism are born.
-Lao Tse
Back to top
View user's profile Send private message
tranquilcool
Veteran
Veteran


Joined: 25 Mar 2005
Posts: 1044

PostPosted: Tue Nov 28, 2006 8:06 am    Post subject: Reply with quote

got this error;

File "leftovers.pl", line 3
use strict;
^
SyntaxError: invalid syntax


ok error fixed
_________________
this is a strange strange world.
Back to top
View user's profile Send private message
sylvanus
n00b
n00b


Joined: 08 Jun 2005
Posts: 25

PostPosted: Thu Nov 30, 2006 2:02 am    Post subject: Reply with quote

Hi msalerno,

Great script you have.

Just a false positive I found which include directories with .keep in it. However, I'm not sure if .keep is being placed by the old cruft script. In any case, perhaps, you would like to look into it.

Thx
Back to top
View user's profile Send private message
msalerno
Veteran
Veteran


Joined: 17 Dec 2002
Posts: 1336
Location: Sweating in South Florida

PostPosted: Thu Nov 30, 2006 3:51 am    Post subject: Reply with quote

Luckily I don't have to look into it, it's already in the FAQ's.

GF13: What are .keep files?

Let me know if you come across anything else, but look first!
_________________
When harmonious relationships dissolve
Then respect and devotion arise;
When a nation falls to chaos
Then loyalty and patriotism are born.
-Lao Tse
Back to top
View user's profile Send private message
dncohen
n00b
n00b


Joined: 29 Nov 2004
Posts: 43

PostPosted: Sat Dec 01, 2007 3:14 am    Post subject: Reply with quote

This is an old thread. Anyone still using this script?

I get:
Code:
Either you have no java installed, or there is some other problem


Although it continues to run (taking a while).
Back to top
View user's profile Send private message
msalerno
Veteran
Veteran


Joined: 17 Dec 2002
Posts: 1336
Location: Sweating in South Florida

PostPosted: Sun Dec 02, 2007 7:46 pm    Post subject: Reply with quote

Well, do you have java installed?
_________________
When harmonious relationships dissolve
Then respect and devotion arise;
When a nation falls to chaos
Then loyalty and patriotism are born.
-Lao Tse
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum