summaryrefslogtreecommitdiffstats
path: root/perl-install/detect_devices.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2000-09-20 13:36:42 +0000
committerPascal Rigaux <pixel@mandriva.com>2000-09-20 13:36:42 +0000
commitb8245fce554382524cff80598839dbca0be24562 (patch)
treef8d1a2f41fedd2df6d97f977348c1e0f1381c32a /perl-install/detect_devices.pm
parentad8a00814c37a9ca71ea7a661aab6508664d238f (diff)
downloaddrakx-backup-do-not-use-b8245fce554382524cff80598839dbca0be24562.tar
drakx-backup-do-not-use-b8245fce554382524cff80598839dbca0be24562.tar.gz
drakx-backup-do-not-use-b8245fce554382524cff80598839dbca0be24562.tar.bz2
drakx-backup-do-not-use-b8245fce554382524cff80598839dbca0be24562.tar.xz
drakx-backup-do-not-use-b8245fce554382524cff80598839dbca0be24562.zip
no_comment
Diffstat (limited to 'perl-install/detect_devices.pm')
-rw-r--r--perl-install/detect_devices.pm13
1 files changed, 10 insertions, 3 deletions
diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm
index 88db1cb2d..169acf627 100644
--- a/perl-install/detect_devices.pm
+++ b/perl-install/detect_devices.pm
@@ -81,6 +81,13 @@ sub hasIDE() { -e "/proc/ide" }
sub hasDAC960() { 1 }
sub hasCompaqSmartArray() { -r "/proc/array/ida0" }
+sub isFloppyOrHD {
+ my ($dev) = @_;
+ require partition_table_raw;
+ my $geom = partition_table_raw::get_geometry(devices::make($dev));
+ $geom->{totalsectors} < 10 << 11 ? 'floppy' : 'hd';
+}
+
sub getSCSI() {
my @drives;
my ($driveNum, $cdromNum, $tapeNum) = qw(0 0 0);
@@ -96,14 +103,14 @@ sub getSCSI() {
$_ = <F>; my ($type) = /^\s*Type:\s*(.*)/ or &$err();
my $device;
if ($type =~ /Direct-Access/) { #- what about LS-120 floppy drive, assuming there are Direct-Access...
- $type = 'hd';
$device = "sd" . chr($driveNum++ + ord('a'));
+ $type = isFloppyOrHD($device);
} elsif ($type =~ /Sequential-Access/) {
- $type = 'tape';
$device = "st" . $tapeNum++;
+ $type = 'tape';
} elsif ($type =~ /CD-ROM/) {
- $type = 'cdrom';
$device = "scd" . $cdromNum++;
+ $type = 'cdrom';
}
$device and push @drives, { device => $device, type => $type, info => "$vendor $model", id => $id, bus => 0 };
}