From fe087ed9bb223366676eef790def68102497f77c Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Fri, 18 Jun 2004 05:39:25 +0000 Subject: add and use install_any::method_allows_medium_change --- perl-install/install_any.pm | 6 +++++- perl-install/install_steps_gtk.pm | 2 +- perl-install/install_steps_interactive.pm | 4 ++-- perl-install/pkgs.pm | 4 ++-- 4 files changed, 10 insertions(+), 6 deletions(-) (limited to 'perl-install') diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index e37a26df9..300913446 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -42,7 +42,7 @@ my %iso_images; sub useMedium($) { #- before ejecting the first CD, there are some files to copy! #- does nothing if the function has already been called. - $_[0] > 1 and $::o->{method} =~ /(^cdrom|-iso)$/ and setup_postinstall_rpms($::prefix, $::o->{packages}); + $_[0] > 1 and method_allows_medium_change($::o->{method}) and setup_postinstall_rpms($::prefix, $::o->{packages}); $asked_medium eq $_[0] or log::l("selecting new medium '$_[0]'"); $asked_medium = $_[0]; @@ -69,6 +69,10 @@ sub askChangeMedium($$) { log::l($allow ? "accepting medium $medium" : "refusing medium $medium"); $allow; } +sub method_allows_medium_change($) { + my ($method) = @_; + $method eq "cdrom" || $method eq "disk-iso"; +} sub look_for_ISOs() { $iso_images{media} = []; diff --git a/perl-install/install_steps_gtk.pm b/perl-install/install_steps_gtk.pm index 7ee2212c0..de0ae5b4e 100644 --- a/perl-install/install_steps_gtk.pm +++ b/perl-install/install_steps_gtk.pm @@ -591,7 +591,7 @@ sub installPackages { my ($method, $medium) = @_; #- if not using a cdrom medium or an iso image, always abort. - return unless $method =~ /(^cdrom|-iso)$/ && !$::oem; + return unless method_allows_medium_change($method) && !$::oem; my $name = pkgs::mediumDescr($o->{packages}, $medium); local $| = 1; print "\a"; diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index 7d948ca1d..a09321277 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -384,7 +384,7 @@ sub choosePackages { #- this is done at the very beginning to take into account #- selection of CD by user if using a cdrom. - $o->chooseCD($packages) if $o->{method} =~ /(^cdrom|-iso)$/ && !$::oem; + $o->chooseCD($packages) if install_any::method_allows_medium_change($o->{method}) && !$::oem; my $w = $o->wait_message('', N("Looking for available packages...")); my $availableC = &install_steps::choosePackages; @@ -684,7 +684,7 @@ sub installPackages { my ($method, $medium) = @_; #- if not using a cdrom medium or an iso image, always abort. - return unless $method =~ /(^cdrom|-iso)$/ && !$::oem; + return unless method_allows_medium_change($method) && !$::oem; my $name = pkgs::mediumDescr($o->{packages}, $medium); local $| = 1; print "\a"; diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm index ed1f7eaa2..618ef63b9 100644 --- a/perl-install/pkgs.pm +++ b/perl-install/pkgs.pm @@ -448,7 +448,7 @@ sub psUsingHdlist { #- avoid using more than one medium if Cd is not ejectable. #- but keep all medium here so that urpmi has the whole set. - $m->{ignored} ||= $method =~ /(^cdrom|-iso)$/ && $medium > 1 && !common::usingRamdisk(); + $m->{ignored} ||= install_any::method_allows_medium_change($method) && $medium > 1 && !common::usingRamdisk(); #- parse synthesis (if available) of directly hdlist (with packing). if ($m->{ignored}) { @@ -922,7 +922,7 @@ sub installTransactionClosure { #- it is sure at least one package will be installed according to medium chosen. install_any::useMedium($medium->{medium}); - if ($medium->{method} =~ /(^cdrom|-iso)$/) { + if (install_any::method_allows_medium_change($medium->{method})) { my $pkg = $packages->{depslist}[$l[0]]; #- force changeCD callback to be called from main process. -- cgit v1.2.1