From 19edea8b8f17cb77bec95d7d58b284cfd4c24317 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Mon, 13 Oct 2008 23:14:08 +0000 Subject: pass new distro version as parameter --- mdkapplet | 2 +- mdkapplet-upgrade-helper | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/mdkapplet b/mdkapplet index 474de0c6..0a916941 100755 --- a/mdkapplet +++ b/mdkapplet @@ -392,7 +392,7 @@ sub upgrade() { $already_in_upgrade = 1; my $_a = before_leaving { undef $already_in_upgrade }; return if !confirm_upgrade(); - fork_exec('mdkapplet-upgrade-helper'); + fork_exec('mdkapplet-upgrade-helper', "--new_distro_version=$new_distro->{version}"); } sub add_media() { diff --git a/mdkapplet-upgrade-helper b/mdkapplet-upgrade-helper index 323f4071..29287142 100755 --- a/mdkapplet-upgrade-helper +++ b/mdkapplet-upgrade-helper @@ -41,15 +41,17 @@ use Rpmdrake::open_db; ugtk2::add_icon_path("/usr/share/mdkonline/pixmaps/"); my ($log_file); +my $new_distro_version; foreach my $opt (@ARGV) { if ($opt =~ /--(rpm-root|urpmi-root)=(.*)/) { $::rpmdrake_options{$1}[0] = $2; + } elsif ($opt =~ /--new_distro_version=(.*)/) { + $new_distro_version = $1; } } my $root = Rpmdrake::open_db::fast_open_urpmi_db()->{root}; -my $new_distro; my $product_id = common::parse_LDAP_namespace_structure(cat_("$root/etc/product.id")); run_program::raw({ detach => 1 }, 'ionice', '-p', $$, '-n7'); @@ -84,7 +86,7 @@ sub upgrade_distro_congratulations() { gtkadd($w->{window}, gtknew('VBox', children_tight => [ get_banner(), - gtknew('Label_Left', text => N("Upgrade to Mandriva %s release was successfull.", $new_distro->{version}), + gtknew('Label_Left', text => N("Upgrade to Mandriva %s release was successfull.", $new_distro_version), # explicitely wrap (for 2008.1): line_wrap => 1, # workaround infamous 6 years old gnome bug #101968: @@ -123,7 +125,7 @@ sub upgrade() { log::explanations("adding urpmi media for new distribution"); 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?" . + 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; -- cgit v1.2.1