From 6f9977f301789392bece6f37251d54e3ffd6bad0 Mon Sep 17 00:00:00 2001 From: Francois Pons Date: Tue, 20 Feb 2001 12:42:30 +0000 Subject: added RPMRC_FILE env variable to choose rpmrc file for rpmlib used by DrakX, neccessary for live update from a 7.2 or older. Check that if something goes wrong with rebuilddb, avoid removing old rpm-3 db files. Make sure live_install can start from top directory too. --- perl-install/pkgs.pm | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'perl-install/pkgs.pm') diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm index e2365d45a..6c6c6d1eb 100644 --- a/perl-install/pkgs.pm +++ b/perl-install/pkgs.pm @@ -753,15 +753,23 @@ sub rebuild_db_open_for_traversal { my $rebuilddb_dir = "$prefix/var/lib/rpmrebuilddb.$$"; -d $rebuilddb_dir and log::l("removing stale directory $rebuilddb_dir"), commands::rm("-rf", $rebuilddb_dir); + my $failed; c::rpmdbRebuild($prefix) or log::l("rebuilding of rpm database failed: ". c::rpmErrorString()), c::_exit(2); - #-rebuilding has been successfull, so remove old rpm database if any. - log::l("rebuilding rpm database completed successfully"); - foreach (qw(conflictsindex.rpm fileindex.rpm groupindex.rpm nameindex.rpm packages.rpm + foreach (qw(Basenames Conflictname Group Name Packages Providename Requirename Triggername)) { + -s "$prefix/var/lib/rpm/$_" or $failed = 'failed'; + } + #- rebuilding has been successfull, so remove old rpm database if any. + #- once we have checked the rpm4 db file are present and not null, in case + #- of doubt, avoid removing them... + unless ($failed) { + log::l("rebuilding rpm database completed successfully"); + foreach (qw(conflictsindex.rpm fileindex.rpm groupindex.rpm nameindex.rpm packages.rpm providesindex.rpm requiredby.rpm triggerindex.rpm)) { - -e "$prefix/var/lib/rpm/$_" or next; - log::l("removing old rpm file $_"); - commands::rm("-f", "$prefix/var/lib/rpm/$_"); + -e "$prefix/var/lib/rpm/$_" or next; + log::l("removing old rpm file $_"); + commands::rm("-f", "$prefix/var/lib/rpm/$_"); + } } c::_exit(0); } -- cgit v1.2.1