summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2001-02-20 12:42:30 +0000
committerFrancois Pons <fpons@mandriva.com>2001-02-20 12:42:30 +0000
commit6f9977f301789392bece6f37251d54e3ffd6bad0 (patch)
tree94ace4db419d6551a99c1fa724d879827ff398e0
parent1d27dbf5e28c61be9eeb078c44f2481fb25e7195 (diff)
downloaddrakx-backup-do-not-use-6f9977f301789392bece6f37251d54e3ffd6bad0.tar
drakx-backup-do-not-use-6f9977f301789392bece6f37251d54e3ffd6bad0.tar.gz
drakx-backup-do-not-use-6f9977f301789392bece6f37251d54e3ffd6bad0.tar.bz2
drakx-backup-do-not-use-6f9977f301789392bece6f37251d54e3ffd6bad0.tar.xz
drakx-backup-do-not-use-6f9977f301789392bece6f37251d54e3ffd6bad0.zip
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.
-rw-r--r--perl-install/c/stuff.xs.pm5
-rwxr-xr-xperl-install/live_install1
-rwxr-xr-xperl-install/live_install22
-rw-r--r--perl-install/pkgs.pm20
4 files changed, 21 insertions, 7 deletions
diff --git a/perl-install/c/stuff.xs.pm b/perl-install/c/stuff.xs.pm
index 8a2890f9e..94f19ac63 100644
--- a/perl-install/c/stuff.xs.pm
+++ b/perl-install/c/stuff.xs.pm
@@ -7,6 +7,7 @@ print '
#define dev_t dev_t
#include <ctype.h>
+#include <stdlib.h>
#include <unistd.h>
#include <syslog.h>
#include <fcntl.h>
@@ -454,7 +455,9 @@ $ENV{C_RPM} and print '
int
rpmReadConfigFiles()
CODE:
- RETVAL = rpmReadConfigFiles(NULL, NULL) == 0;
+ char *rpmrc = getenv("RPMRC_FILE");
+ if (rpmrc != NULL && !*rpmrc) rpmrc = NULL;
+ RETVAL = rpmReadConfigFiles(rpmrc, NULL) == 0;
OUTPUT:
RETVAL
diff --git a/perl-install/live_install b/perl-install/live_install
index 6a68da87e..a0fd7dc67 100755
--- a/perl-install/live_install
+++ b/perl-install/live_install
@@ -37,6 +37,7 @@ if [ -x "/tmp/drakx/mdkinst/usr/bin/perl-install/live_install2" ]; then
fi
# start DrakX, do not keep shell script in background else the CD is locked by it!!!
+ cd /tmp/drakx/mdkinst/usr/bin/perl-install
exec ../../../lib/ld-linux.so.2 ../perl ./live_install2
fi
diff --git a/perl-install/live_install2 b/perl-install/live_install2
index 0d86df719..6c0cb9ef5 100755
--- a/perl-install/live_install2
+++ b/perl-install/live_install2
@@ -8,7 +8,9 @@ $ENV{PERL5LIB} = join ":", map { "$dir/$_" } @INC;
$ENV{LD_LIBRARY_PATH} = "$dir/lib:$dir/usr/lib:$dir/usr/lib/perl5/5.6.0/i386-linux/CORE";
$ENV{PATH} = join(":", map { "$dir/$_" } split ":", "/usr/bin:/bin:/sbin:/usr/sbin:/usr/X11R6/bin") . ":$ENV{PATH}";
$ENV{SHARE_PATH} = "$dir/usr/share";
+$ENV{RPMRC_FILE} = "$dir/usr/lib/rpm/rpmrc";
+system "../../../lib/ld-linux.so.2", "../perl", "-i", "-pe", "s,(macrofiles:\\s*)(.*),$1$dir/usr/lib/rpm/macros:$2,", $ENV{RPMRC_FILE};
system "../../../lib/ld-linux.so.2", "../perl", "./install2", "--live", @ARGV;
$ENV{DISPLAY} and system "xset", "-fp", "/tmp/drakx/mdkinst/usr/X11R6/lib/X11/fonts/";
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);
}