summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2008-10-14 14:33:20 +0000
committerThierry Vignaud <tv@mandriva.org>2008-10-14 14:33:20 +0000
commitbb77c5f490d53da7f75fb1e846826842658040d1 (patch)
tree98e7ecb0a62008f503bccd7f9631c44e9f537a0d
parent2f0ec0a3e8fbd32af5e1159308e7c6fef55a7dd6 (diff)
downloadmgaonline-bb77c5f490d53da7f75fb1e846826842658040d1.tar
mgaonline-bb77c5f490d53da7f75fb1e846826842658040d1.tar.gz
mgaonline-bb77c5f490d53da7f75fb1e846826842658040d1.tar.bz2
mgaonline-bb77c5f490d53da7f75fb1e846826842658040d1.tar.xz
mgaonline-bb77c5f490d53da7f75fb1e846826842658040d1.zip
(upgrade) restore urpmi media if adding new distribution media failed
-rw-r--r--NEWS1
-rwxr-xr-xmdkapplet-upgrade-helper9
2 files changed, 8 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index da89b61e..e63f4957 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@
o log gurpmi STDERR too
o make all gurpmi passes using --replacefiles instead of just the
first one
+ o restore urpmi media if adding new distribution media failed
Version 2.58 - 14 October 2008
diff --git a/mdkapplet-upgrade-helper b/mdkapplet-upgrade-helper
index ee533c50..b0f4e5b3 100755
--- a/mdkapplet-upgrade-helper
+++ b/mdkapplet-upgrade-helper
@@ -134,8 +134,13 @@ sub upgrade() {
my $product_type = lc($product_id->{type}); $product_type =~ s/\s//g;
my $mirror_list = "http://api.mandriva.com/mirrors/$product_type.$new_distro_version.$product_id->{arch}.list?" .
join(',', 'reason=upgrade', 'upgrade_by=mdkapplet', "upgrade_from=$product_id->{version}");
- system('gurpmi.addmedia', '--silent-success', if_($root, "--urpmi-root=$root"), '--distrib', '--mirrorlist', $mirror_list)
- and return;
+ system('gurpmi.addmedia', '--silent-success', if_($root, "--urpmi-root=$root"), '--distrib', '--mirrorlist', $mirror_list) and do {
+ log::explanations("adding media for new distribution failed");
+ log::explanations("restoringing urpmi configuration from $file");
+ cp_af($file, "$root/etc/urpmi/urpmi.cfg");
+ run_program::run('urpmi.update', if_($root, '--urpmi-root', $root), '-a', '--nocheck');
+ return;
+ };
log::explanations("upgrading urpmi and rpmdrake");
log::explanations("upgrading the whole system");