From 3cc1801d828dd2d3e5fb1b12e20c1b0566e85e4c Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Mon, 4 Apr 2005 13:14:11 +0000 Subject: Introduce the new utility function getCDNumber() --- perl-install/install_any.pm | 10 ++++++++++ perl-install/install_steps_gtk.pm | 5 +---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index bf35ae788..cab260b0c 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -85,6 +85,16 @@ sub askChangeMedium($$) { $allow; } +#- guess the CD number from a media description +sub getCDNumber { + my ($description) = @_; + (my $cd) = $description =~ /\b(?:CD|DVD) ?(\d+)\b/i; + if (!$cd) { #- test for mini-ISO + $cd = 1 if $description =~ /\bmini.?cd\b/i; + } + $cd; +} + sub method_is_from_ISO_images($) { my ($method) = @_; $method eq "disk-iso" || $method eq "nfs-iso"; diff --git a/perl-install/install_steps_gtk.pm b/perl-install/install_steps_gtk.pm index 73fdf1280..8ef0d9bb7 100644 --- a/perl-install/install_steps_gtk.pm +++ b/perl-install/install_steps_gtk.pm @@ -642,10 +642,7 @@ sub deselectFoundMedia { my $i = 0; my $totalsize = 0; foreach (@$hdlists) { - (my $cd) = $_->[3] =~ /\b(?:CD|DVD) ?(\d+)\b/i; - if (!$cd) { #- test for mini-ISO - $cd = 1 if $_->[3] =~ /\bmini.?cd\b/i; - } + my $cd = install_any::getCDNumber($_->[3]); if (!$cd || !@{$cdlist{$cd} || []}) { push @hdlist2, $_; $corresp[$i] = [ $i ]; -- cgit v1.2.1