1
0
mirror of https://github.com/fspc/dswim.git synced 2025-02-22 08:33:24 -05:00

Dswim updates when no db exist or status or a combination thereof.

This commit is contained in:
freesource 2001-10-14 19:53:14 +00:00
parent 3762885480
commit f2c8510e31
2 changed files with 15 additions and 5 deletions

View File

@ -180,7 +180,7 @@ sub db {
} }
} }
else { else {
print "swim: missing important database\n"; exit; print "swim: missing important database\n"; return "missing";
} }
foreach (@GONE) { foreach (@GONE) {
@ -199,10 +199,13 @@ sub db {
my $new=$#NEW + 1; my $cr=$#changed_packages + 1; my $new=$#NEW + 1; my $cr=$#changed_packages + 1;
my $ch=($#CHANGED + 1) - $cr; my $gon= $#GONE + 1; my $ch=($#CHANGED + 1) - $cr; my $gon= $#GONE + 1;
if ($commands->{"check"}) { if ($commands->{"check"}) {
print "\n TOTAL\n -----\n"; print "\n TOTAL\n -----\n";
print "NEW $new\n"; print "GONE $gon\n"; print "NEW $new\n"; print "GONE $gon\n";
print "CHANGED $ch\n"; print "CHANGED STATUS $cr\n"; exit; print "CHANGED $ch\n"; print "CHANGED STATUS $cr\n";
return 1;
} }
print "\n TOTAL\n -----\n"; print "\n TOTAL\n -----\n";
print "NEW $new\n"; print "GONE $gon\n"; print "NEW $new\n"; print "GONE $gon\n";

11
swim
View File

@ -797,9 +797,16 @@ sub command {
db(\%commands); db(\%commands);
require SWIM::DB_Init; require SWIM::DB_Init;
$commands{"rebuilddb"} = 1; $commands{"initdb"} = 1;
SWIM::DB_Init->import(qw(database)); SWIM::DB_Init->import(qw(database));
database(\%commands); my $success_check = database(\%commands);
if ($success_check eq "rebuilddb") {
undef $commands{"initdb"};
$commands{"rebuilddb"} = 1;
SWIM::DB_Init->import(qw(database));
my $success_check = database(\%commands);
}
system "cp -fa $dpkg_status $my_status"; system "cp -fa $dpkg_status $my_status";
} }