diff options
author | Thierry Vignaud <tv@mageia.org> | 2011-09-17 09:22:15 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mageia.org> | 2011-09-17 09:22:15 +0000 |
commit | 794534f38765fac0f3a63b1a274d2ad7ac9b0fc1 (patch) | |
tree | 83265422c55216ad9f34b90b97546ec21fde0f6f /perl-install | |
parent | 5c5efa9473ff6a4353dc4ca8cc7cf4e2ff2b34cb (diff) | |
download | drakx-794534f38765fac0f3a63b1a274d2ad7ac9b0fc1.tar drakx-794534f38765fac0f3a63b1a274d2ad7ac9b0fc1.tar.gz drakx-794534f38765fac0f3a63b1a274d2ad7ac9b0fc1.tar.bz2 drakx-794534f38765fac0f3a63b1a274d2ad7ac9b0fc1.tar.xz drakx-794534f38765fac0f3a63b1a274d2ad7ac9b0fc1.zip |
(_try_to_upgrade,_prepare_upgrade) split them out of
selectInstallClass() for readability
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/install/steps_interactive.pm | 94 |
1 files changed, 51 insertions, 43 deletions
diff --git a/perl-install/install/steps_interactive.pm b/perl-install/install/steps_interactive.pm index a1376cfaf..e4926cb09 100644 --- a/perl-install/install/steps_interactive.pm +++ b/perl-install/install/steps_interactive.pm @@ -132,56 +132,64 @@ sub selectInstallClass { my $arch = arch() =~ /i.86/ ? $MDK::Common::System::compat_arch{arch()} : arch(); @l = grep { $_->{arch} eq $arch } @l; if (@l) { + _try_to_upgrade($o, @l); + } +} - log::l("proposing to upgrade partitions " . join(" ", map { $_->{part} && $_->{part}{device} } @l)); - - my @releases = uniq(map { "$_->{release} $_->{version}" } @l); - if (@releases != @l) { - #- same release name so adding the device to differentiate them: - $_->{release} .= " ($_->{part}{device})" foreach @l; - } +sub _try_to_upgrade { + my ($o, @l) = @_; + log::l("proposing to upgrade partitions " . join(" ", map { $_->{part} && $_->{part}{device} } @l)); - askInstallClass: - my $p; - $o->ask_from_({ title => N("Install/Upgrade"), - interactive_help_id => 'selectInstallClass', - }, - [ - { label => N("Is this an install or an upgrade?"), title => 1 }, - { val => \$p, - list => [ @l, N_("_: This is a noun:\nInstall") ], - type => 'list', - format => sub { ref($_[0]) ? N("Upgrade %s", "$_[0]->{release} $_[0]->{version}") : translate($_[0]) } - } ]); - if (ref $p) { - _check_unsafe_upgrade_and_warn($o, $p->{part}) or $p = undef; - } + my @releases = uniq(map { "$_->{release} $_->{version}" } @l); + if (@releases != @l) { + #- same release name so adding the device to differentiate them: + $_->{release} .= " ($_->{part}{device})" foreach @l; + } - if (ref $p) { + askInstallClass: + my $p; + $o->ask_from_({ title => N("Install/Upgrade"), + interactive_help_id => 'selectInstallClass', + }, + [ + { label => N("Is this an install or an upgrade?"), title => 1 }, + { val => \$p, + list => [ @l, N_("_: This is a noun:\nInstall") ], + type => 'list', + format => sub { ref($_[0]) ? N("Upgrade %s", "$_[0]->{release} $_[0]->{version}") : translate($_[0]) } + } ]); + if (ref $p) { + _check_unsafe_upgrade_and_warn($o, $p->{part}) or $p = undef; + } - if ($p->{part}) { - log::l("choosing to upgrade partition $p->{part}{device}"); - $o->{migrate_device_names} = install::any::use_root_part($o->{all_hds}, $p->{part}, $o); - } + if (ref $p) { + _prepare_upgrade($o, $p); + } +} - #- handle encrypted partitions (esp. /home) - foreach (grep { $_->{mntpoint} } @{$o->{fstab}}) { - my ($options, $_unknown) = fs::mount_options::unpack($_); - $options->{encrypted} or next; - $o->ask_from_({ focus_first => 1 }, - [ { label => N("Encryption key for %s", $_->{mntpoint}), - hidden => 1, val => \$_->{encrypt_key} } ]); - } +sub _prepare_upgrade { + my ($o, $p) = @_; + if ($p->{part}) { + log::l("choosing to upgrade partition $p->{part}{device}"); + $o->{migrate_device_names} = install::any::use_root_part($o->{all_hds}, $p->{part}, $o); + } - $o->{previous_release} = $p; - $o->{isUpgrade} = (find { $p->{release_file} =~ /$_/ } 'mageia', 'mandriva', 'mandrake', 'conectiva', 'redhat') || 'unknown'; - $o->{upgrade_by_removing_pkgs_matching} ||= { - conectiva => 'cl', - redhat => '.', #- everything! - }->{$o->{isUpgrade}}; - log::l("upgrading $o->{isUpgrade} distribution" . ($o->{upgrade_by_removing_pkgs_matching} ? " (upgrade_by_removing_pkgs_matching $o->{upgrade_by_removing_pkgs_matching})" : '')); - } + #- handle encrypted partitions (esp. /home) + foreach (grep { $_->{mntpoint} } @{$o->{fstab}}) { + my ($options, $_unknown) = fs::mount_options::unpack($_); + $options->{encrypted} or next; + $o->ask_from_({ focus_first => 1 }, + [ { label => N("Encryption key for %s", $_->{mntpoint}), + hidden => 1, val => \$_->{encrypt_key} } ]); } + + $o->{previous_release} = $p; + $o->{isUpgrade} = (find { $p->{release_file} =~ /$_/ } 'mageia', 'mandriva', 'mandrake', 'conectiva', 'redhat') || 'unknown'; + $o->{upgrade_by_removing_pkgs_matching} ||= { + conectiva => 'cl', + redhat => '.', #- everything! + }->{$o->{isUpgrade}}; + log::l("upgrading $o->{isUpgrade} distribution" . ($o->{upgrade_by_removing_pkgs_matching} ? " (upgrade_by_removing_pkgs_matching $o->{upgrade_by_removing_pkgs_matching})" : '')); } sub _check_unsafe_upgrade_and_warn { |