[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: HELP ME!!! No more apt-get and dpkg!!!



Hi Emanuele,
probably your filesystem crashed and so some files are lost. The perl
program below can show you which files from which packages are missing.
Then you can reinstall this packages using apt-get --reinstall install
package. As some postinst scripts move/remove files from packages, this
program will output some false positives. However, this is no real problem
as apt-get --reinstall won't destroy anything. You'll probably get the
error messages you posted while fixing the problem, but you can ignore
them for now.

#! /usr/bin/perl

open FH,"dpkg --get-selections|";
my @errorpackages;

while(<FH>)
{
        if(my($package)=/^(\w+)\s+install$/)
        {
                print "checking package $package...";
                open FILELIST,"dpkg -L $package|";
                my $ok=1;
                while(<FILELIST>)
                {
                        chomp;
                        next if /^$/;
                        next if /\s/;
                        next if -e $_;
                        print "\nERROR: File $_ in package $package missing";
                        $ok=0;
                        push @errorpackages,$package;
                }
                print "ok" if $ok;
                print "\n";
        }
}

print "This packages aren't completely installed:\n",join(" ",@errorpackages),"\n";





Reply to: