diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2001-02-02 16:35:34 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2001-02-02 16:35:34 +0000 |
commit | 878895a481e4148f04ebc1dec80068f6723f5c05 (patch) | |
tree | ea0bb721d02f82e82f5b73f6368d0015cdf86fd0 /perl-install/detect_devices.pm | |
parent | 60fb9895cc10ace473f874b539e24ebc497fa098 (diff) | |
download | drakx-backup-do-not-use-878895a481e4148f04ebc1dec80068f6723f5c05.tar drakx-backup-do-not-use-878895a481e4148f04ebc1dec80068f6723f5c05.tar.gz drakx-backup-do-not-use-878895a481e4148f04ebc1dec80068f6723f5c05.tar.bz2 drakx-backup-do-not-use-878895a481e4148f04ebc1dec80068f6723f5c05.tar.xz drakx-backup-do-not-use-878895a481e4148f04ebc1dec80068f6723f5c05.zip |
(get): cleanup, remove hasIDE hasSCSI...
Diffstat (limited to 'perl-install/detect_devices.pm')
-rw-r--r-- | perl-install/detect_devices.pm | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm index dfeef40a4..e9b3a2b1c 100644 --- a/perl-install/detect_devices.pm +++ b/perl-install/detect_devices.pm @@ -29,11 +29,7 @@ sub get { #- 2. The first SCSI device if SCSI exists. Or #- 3. The first RAID device if RAID exists. - map { &{$_->[0]}() ? &{$_->[1]}() : () } - [ \&hasIDE, \&getIDE ], - [ \&hasSCSI, \&getSCSI ], - [ \&hasDAC960, \&getDAC960 ], - [ \&hasCompaqSmartArray, \&getCompaqSmartArray ]; + getIDE(), getSCSI(), getDAC960(), getCompaqSmartArray(); } sub hds() { grep { $_->{type} eq 'hd' && ($::isStandalone || !isRemovableDrive($_)) } get(); } sub zips() { grep { $_->{type} =~ /.d/ && isZipDrive($_) } get(); } @@ -74,19 +70,6 @@ sub isLS120Drive { $_[0]->{info} =~ /LS-?120|144MB/ } sub isUSBFDUDrive { $_[0]->{info} =~ /USB-?FDU/ } sub isRemovableDrive { &isZipDrive || &isLS120Drive || &isUSBFDUDrive } #-or &isJazzDrive } -sub hasSCSI() { - local *F; open F, "/proc/scsi/scsi" or return 0; - local $_; - while (<F>) { - /devices: none/ and log::l("no scsi devices are available"), return 0; - } -#- log::l("scsi devices are available"); - 1; -} -sub hasIDE() { -e "/proc/ide" } -sub hasDAC960() { 1 } -sub hasCompaqSmartArray() { -r "/proc/array/ida0" } - sub isFloppyOrHD { my ($dev) = @_; require partition_table_raw; @@ -101,7 +84,7 @@ sub getSCSI() { local $_; local *F; - open F, "/proc/scsi/scsi" or die "failed to open /proc/scsi/scsi"; + open F, "/proc/scsi/scsi" or return; local $_ = <F>; /^Attached devices:/ or return &$err(); while ($_ = <F>) { my ($id) = /^Host:.*?Id: (\d+)/ or return &$err(); @@ -127,7 +110,7 @@ sub getIDE() { my @idi; #- what about a system with absolutely no IDE on it, like some sparc machine. - hasIDE() or return (); + -e "/proc/ide" or return (); #- Great. 2.2 kernel, things are much easier and less error prone. foreach my $d (sort @{[glob_('/proc/ide/hd*')]}) { @@ -145,9 +128,14 @@ sub getCompaqSmartArray() { my @idi; my $f; - for (my $i = 0; -r ($f = "/proc/array/ida$i"); $i++) { + my $dir = "/proc/driver/array"; #- kernel 2.4 places it here + $dir = "/proc/array" if !-d $dir; #- kernel 2.2 + + -e "$dir/ida0" or return; + + for (my $i = 0; -r ($f = "$dir/ida$i"); $i++) { foreach (cat_($f)) { - if (m|^(ida/.*?):|) { + if (m|^\s*(ida/.*?):|) { push @idi, { device => $1, info => "Compaq RAID logical disk", type => 'hd' }; } } |