summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2010-01-18 12:15:34 +0000
committerThierry Vignaud <tv@mandriva.org>2010-01-18 12:15:34 +0000
commit650c8d714412026d561433a9e38880ba9e765683 (patch)
tree7d6f6fc15b2d003f9d264f5cee1ef0bc365ecb11 /perl-install
parent13cf9dfbb5a8f5d89e6e84a87c9b8b1781d3ced4 (diff)
downloaddrakx-650c8d714412026d561433a9e38880ba9e765683.tar
drakx-650c8d714412026d561433a9e38880ba9e765683.tar.gz
drakx-650c8d714412026d561433a9e38880ba9e765683.tar.bz2
drakx-650c8d714412026d561433a9e38880ba9e765683.tar.xz
drakx-650c8d714412026d561433a9e38880ba9e765683.zip
(_get_hd_vendor) factorize code (needed for next commit)
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/detect_devices.pm21
1 files changed, 14 insertions, 7 deletions
diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm
index 01851ecca..aa5e42b36 100644
--- a/perl-install/detect_devices.pm
+++ b/perl-install/detect_devices.pm
@@ -235,10 +235,10 @@ sub getSCSI() {
$raw_type =~ /Scanner|Processor/ && 'scanner';
my ($vendor, $model) = ($get->('vendor'), $get->('model'));
- foreach my $name (keys %hd_vendors) {
- next if !$name;
- ($vendor, $model) = ($hd_vendors{$name}, $2) if $model =~ /^$name(-|\s)*(.*)/;
- }
+ my ($v, $m) = _get_hd_vendor($model);
+ if ($v && $v) {
+ ($vendor, $model) = ($v, $m);
+ }
push @l, { info => $vendor . ' ' . $model, host => $host, channel => $channel, id => $id, lun => $lun,
description => join('|', $vendor, $model),
bus => 'SCSI', media_type => $media_type, device => $device,
@@ -290,6 +290,15 @@ sub getSCSI() {
"WDC" => "Western Digital Corp.",
);
+# return ($vendor, $model)
+sub _get_hd_vendor {
+ my ($info) = @_;
+ foreach my $name (keys %hd_vendors) {
+ next if !$name;
+ return ($hd_vendors{$name}, $2) if $info =~ /^$name(-|\s)*(.*)/;
+ }
+}
+
sub getIDE() {
my @idi;
@@ -305,9 +314,7 @@ sub getIDE() {
my $info = chomp_(cat_("$d/model")) || "(none)";
my $num = ord(($d =~ /(.)$/)[0]) - ord 'a';
- my ($vendor, $model) = map {
- if_($info =~ /^$_(-|\s)*(.*)/, $hd_vendors{$_}, $2);
- } keys %hd_vendors;
+ my ($vendor, $model) = _get_hd_vendor($info);
my $host = $num;
($host, my $id) = divide($host, 2);