summaryrefslogtreecommitdiffstats
path: root/perl-install/install
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/install')
-rw-r--r--perl-install/install/steps_interactive.pm94
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 {