diff options
-rw-r--r-- | perl-install/install_any.pm | 22 | ||||
-rw-r--r-- | perl-install/install_steps_interactive.pm | 16 |
2 files changed, 25 insertions, 13 deletions
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index 10af86be3..7a5779384 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -76,12 +76,17 @@ sub askChangeMedium($$) { log::l($allow ? "accepting medium $medium" : "refusing medium $medium"); $allow; } + +sub method_is_from_ISO_images($) { + my ($method) = @_; + $method eq "disk-iso" || $method eq "nfs-iso"; +} sub method_allows_medium_change($) { my ($method) = @_; - $method eq "cdrom" || $method eq "disk-iso" || $method eq "nfs-iso"; + $method eq "cdrom" || method_is_from_ISO_images($method); } -sub look_for_ISOs() { +sub look_for_ISO_images() { $iso_images{media} = []; ($iso_images{loopdev}, $iso_images{mountpoint}) = cat_("/proc/mounts") =~ m|(/dev/loop\d+)\s+(/tmp/image) iso9660| or return; @@ -112,12 +117,15 @@ sub look_for_ISOs() { 1; } -sub changeIso($) { - my ($iso_label) = @_; - - %iso_images or look_for_ISOs() or return; +sub find_ISO_image_labelled($) { + %iso_images or look_for_ISO_images() or return; + my ($iso_label) = @_; + return find { $_->{app_id} eq $iso_label && $_->{cd_set} eq $iso_images{cd_set} } @{$iso_images{media}}; +} - my $iso_info = find { $_->{app_id} eq $iso_label && $_->{cd_set} eq $iso_images{cd_set} } @{$iso_images{media}} or return; +sub changeIso($) { + my ($iso_label) = @_; + my $iso_info = find_ISO_image_labelled($iso_label) or return; eval { fs::umount($iso_images{mountpoint}) }; $@ and warnAboutFilesStillOpen(); diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index c3894f22f..cbc5cf915 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -636,12 +636,15 @@ sub chooseCD { $mediumsDescr{$descr} ||= $packages->{mediums}{$_}{selected}; } - #- if no other medium available or a poor beginner, we are choosing for him! - #- note first CD is always selected and should not be unselected! - return if @mediumsDescr == () || !$::expert; - -# $o->set_help('chooseCD'); - $o->ask_many_from_list('', + if (install_any::method_is_from_ISO_images($o->{method})) { + $mediumsDescr{$_} = defined(install_any::find_ISO_image_labelled($_)) || 0 foreach (@mediumsDescr); + } elsif ($method eq "cdrom") { + #- if no other medium available or a poor beginner, we are choosing for him! + #- note first CD is always selected and should not be unselected! + return if @mediumsDescr == () || !$::expert; + + # $o->set_help('chooseCD'); + $o->ask_many_from_list('', N("If you have all the CDs in the list below, click Ok. If you have none of those CDs, click Cancel. If only some CDs are missing, unselect them, then click Ok."), @@ -652,6 +655,7 @@ If only some CDs are missing, unselect them, then click Ok."), }) or do { $mediumsDescr{$_} = 0 foreach @mediumsDescr; #- force unselection of other CDs. }; + } #- restore true selection of medium (which may have been grouped together) foreach (@mediums) { |