From 0a1e47b9ce1698ea3c728ec7f3ea9909365674d4 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Wed, 10 Jul 2002 13:48:27 +0000 Subject: enhance cohenrency: step 1 - ide and scsi devices use channel rather than bus to store their physical connection, which is more logic (at least for eide) - all devices have their connection bus in bus field, not in bus for {pci,usb,...} and interface_type for {scsi,eide,other_block_devices} - detect_devices:getIDE() : add eide_hds hash in order to be able to split info field between model and vendor - harddrake::ui : code reduction allowed by the above changes --- perl-install/detect_devices.pm | 56 ++++++++++++++++++++++++++++------ perl-install/diskdrake/interactive.pm | 2 +- perl-install/drakxtools.spec | 1 + perl-install/harddrake/ui.pm | Bin 10642 -> 9700 bytes perl-install/install_steps.pm | 2 +- 5 files changed, 50 insertions(+), 11 deletions(-) (limited to 'perl-install') diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm index 1f545520e..25b98b244 100644 --- a/perl-install/detect_devices.pm +++ b/perl-install/detect_devices.pm @@ -48,7 +48,7 @@ sub zips { map { $_->{device} .= 4; $_ } raw_zips() } sub cdroms__faking_ide_scsi { my @l = cdroms(); return @l if $::isStandalone; - if (my @l_ide = grep { $_->{interface_type} eq 'ide' && isBurner($_) } @l) { + if (my @l_ide = grep { $_->{bus} eq 'ide' && isBurner($_) } @l) { require modules; modules::add_alias('scsi_hostadapter', 'ide-scsi'); my $nb = 1 + max(-1, map { $_->{device} =~ /scd(\d+)/ } @l); @@ -61,7 +61,7 @@ sub cdroms__faking_ide_scsi { } sub zips__faking_ide_scsi { my @l = raw_zips(); - if (my @l_ide = grep { $_->{interface_type} eq 'ide' && $::isInstall } @l) { + if (my @l_ide = grep { $_->{bus} eq 'ide' && $::isInstall } @l) { require modules; modules::add_alias('scsi_hostadapter', 'ide-scsi'); my $nb = 1 + max(-1, map { if_($_->{device} =~ /sd(\w+)/, ord($1) - ord('a')) } getSCSI()); @@ -158,7 +158,7 @@ sub getSCSI() { my ($id) = /^Host:.*?Id: (\d+)/ or $err->($_); my ($vendor, $model) = /^\s*Vendor:\s*(.*?)\s+Model:\s*(.*?)\s+Rev:/m or $err->($_); my ($type) = /^\s*Type:\s*(.*)/m or $err->($_); - { info => "$vendor $model", id => $id, bus => 0, device => "sg$::i", raw_type => $type }; + { info => "$vendor $model", id => $id, channel => 0, device => "sg$::i", raw_type => $type }; } @l; each_index { @@ -179,8 +179,37 @@ sub getSCSI() { } grep { $_->{raw_type} =~ /Scanner/ } @l; get_sys_cdrom_info(@l); - @l; -} + map {$_->{bus} = 'SCSI' } @l; +} + +my %eide_hds = + ( + "ASUS " => "Asus", + "CD-ROM CDU" => "Sony", + "CD-ROM Drive/F5D" => "ASUSTeK", + "Compaq" => "Compaq", + "CONNER" => "Conner Peripherals", + "IBM-" => "IBM", + "FUJITSU" => "Fujitsu", + "HITACHI" => "Hitachi", + "Lite-On" => "Lite-On Technology Corp.", + "LTN" => "Lite-On Technology Corp.", + "IOMEGA " => "Iomega", + "MAXTOR " => "Maxtor", + "Maxtor " => "Maxtor", + "Micropolis" => "Micropolis", + "PLEXTOR" => "Plextor", + "QUANTUM" => "Quantum", + "SAMSUNG" => "Samsung", + "Seagate " => "Seagate Technology", + "ST3" => "Seagate Technology", + "TEAC" => "Teac", + "TOSHIBA" => "Toshiba", + "TEAC" => "Teac", + "TOSHIBA" => "Toshiba", + "WDC" => "Western Digital Corp.", + ); + sub getIDE() { my @idi; @@ -196,7 +225,16 @@ sub getIDE() { my $info = chomp_(cat_("$d/model")) || "(none)"; my $num = ord (($d =~ /(.)$/)[0]) - ord 'a'; - push @idi, { media_type => $type, device => basename($d), info => $info, bus => $num/2, id => $num%2, interface_type => 'ide' }; + my ($vendor, $model); + foreach my $hd (keys %eide_hds) { + if ($info =~ /^$hd/) { + $vendor = $eide_hds{$hd}; + $model = $info; + $model =~ s/^$hd//; + last; + } + } + push @idi, { media_type => $type, device => basename($d), info => $info, channel => $num/2, id => $num%2, bus => 'ide', Vendor => $vendor, Model => $model }; } get_sys_cdrom_info(@idi); @idi; @@ -213,7 +251,7 @@ sub getCompaqSmartArray() { for (my $i = 0; -r ($f = "${prefix}$i"); $i++) { foreach (cat_($f)) { if (m|^\s*($name/.*?):|) { - push @idi, { device => $1, info => "Compaq RAID logical disk", media_type => 'hd', interface_type => 'ida' }; + push @idi, { device => $1, info => "Compaq RAID logical disk", media_type => 'hd', bus => 'ida' }; } } } @@ -228,7 +266,7 @@ sub getDAC960() { #- /dev/rd/c0d0: RAID-7, Online, 17928192 blocks, Write Thru0123456790123456789012 foreach (syslog()) { my ($device, $info) = m|/dev/(rd/.*?): (.*?),| or next; - $idi{$device} = { info => $info, media_type => 'hd', device => $device, interface_type => 'dac960' }; + $idi{$device} = { info => $info, media_type => 'hd', device => $device, bus => 'dac960' }; } values %idi; } @@ -237,7 +275,7 @@ sub getATARAID { my %l; foreach (syslog()) { my ($device) = m|^\s*(ataraid/d\d+):| or next; - $l{$device} = { info => 'ATARAID block device', media_type => 'hd', device => $device, interface_type => 'ataraid' }; + $l{$device} = { info => 'ATARAID block device', media_type => 'hd', device => $device, bus => 'ataraid' }; log::l("ATARAID: $device"); } values %l; diff --git a/perl-install/diskdrake/interactive.pm b/perl-install/diskdrake/interactive.pm index 1b62cdc47..8c49f9570 100644 --- a/perl-install/diskdrake/interactive.pm +++ b/perl-install/diskdrake/interactive.pm @@ -1127,7 +1127,7 @@ sub format_hd_info { $info .= _("Info: ") . ($hd->{info} || $hd->{media_type}) . "\n" if $::expert && ($hd->{info} || $hd->{media_type}); $info .= _("LVM-disks %s\n", join ", ", map {$_->{device}} @{$hd->{disks}}) if isLVM($hd) && $hd->{disks}; $info .= _("Partition table type: %s\n", $1) if $::expert && ref($hd) =~ /_([^_]+)$/; - $info .= _("on bus %d id %d\n", $hd->{bus}, $hd->{id}) if $::expert && exists $hd->{bus}; + $info .= _("on channel %d id %d\n", $hd->{channel}, $hd->{id}) if $::expert && exists $hd->{channel}; $info; } diff --git a/perl-install/drakxtools.spec b/perl-install/drakxtools.spec index 440478f7c..cd2896a15 100644 --- a/perl-install/drakxtools.spec +++ b/perl-install/drakxtools.spec @@ -216,6 +216,7 @@ done %changelog * Wed Jul 10 2002 Thierry Vignaud 1.1.8-5mdk - code enhancement: increase coherency around the whole drakx code +- decrease the debug verbosity * Wed Jul 10 2002 Thierry Vignaud 1.1.8-4mdk - fix depandancy diff --git a/perl-install/harddrake/ui.pm b/perl-install/harddrake/ui.pm index 90984cf2e..8c1c84804 100644 Binary files a/perl-install/harddrake/ui.pm and b/perl-install/harddrake/ui.pm differ diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index fb5ca0659..014e7a70c 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -794,7 +794,7 @@ sub setupBootloaderBefore { my ($o) = @_; require bootloader; - if (my @l = (grep { $_->{interface_type} eq 'ide' } detect_devices::burners(), detect_devices::raw_zips())) { + if (my @l = (grep { $_->{bus} eq 'ide' } detect_devices::burners(), detect_devices::raw_zips())) { bootloader::add_append($o->{bootloader}, $_->{device}, 'ide-scsi') foreach @l; } if ($o->{miscellaneous}{HDPARM}) { -- cgit v1.2.1