The Following 4 Users Say Thank You to gesperon For This Useful Post: | ||
|
2010-01-12
, 00:37
|
Posts: 97 |
Thanked: 24 times |
Joined on Jan 2010
@ Planet Earth
|
#2
|
The Following User Says Thank You to MatMat For This Useful Post: | ||
|
2010-01-12
, 00:44
|
Posts: 336 |
Thanked: 610 times |
Joined on Apr 2008
@ France
|
#3
|
The Following 2 Users Say Thank You to CrashandDie For This Useful Post: | ||
I wrote this for myself with no intention of maintain it, but I see so many people having full rootfs problem and don't know what to delete that I thought to share it.
Please feel free to modify it, improve it or anything you want, as I stated before I do not plan to maintain it nor support it
USE AT YOUR OWN RISK.
1. root
2. run:
dpkg -l | awk '{print $2}' | grep -vE '^(Status|Err|Name|^$)' > pkg.list
3. run checkpkg.pl in the same directory where pkg.list is located
checkpkg.pl:
#!/usr/bin/perl
my $file = 'pkg.list' ;
open (FH, $file) ;
while (<FH>) {
chomp ($_) ;
my $pkg = $_ ;
next if ($pkg =~ /l10n/) ;
my $optified = 0 ;
my @filelist = `dpkg -L $pkg` ;
foreach my $file (@filelist) {
chomp $file ;
$optified = 1 and last if ($file =~ /^\/opt/) ;
}
if ($optified == 0) {
my @duFileList ;
foreach my $file (@filelist) {
next if ($file =~ /^\/home/) ;
push @duFileList, $file if ($file =~ /.+\/.+\..+$/) ;
}
my @out = `du -ch @duFileList 2>stderr` ;
foreach my $duOut (@out) {
next if ($duOut !~ /total/) ;
chomp $duOut ;
print "$duOut \t $pkg\n" ;
}
}
}
close (FH) ;