summaryrefslogtreecommitdiffstats
path: root/perl-install/detect_devices.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>1999-09-03 09:43:22 +0000
committerPascal Rigaux <pixel@mandriva.com>1999-09-03 09:43:22 +0000
commit3635161f628098787b71456e735c9ad87578930f (patch)
tree6e8df857210378709669328caaa249e95aad7355 /perl-install/detect_devices.pm
parent2fe429a1283bb382c14b3657ab9f752a8b240233 (diff)
downloaddrakx-backup-do-not-use-3635161f628098787b71456e735c9ad87578930f.tar
drakx-backup-do-not-use-3635161f628098787b71456e735c9ad87578930f.tar.gz
drakx-backup-do-not-use-3635161f628098787b71456e735c9ad87578930f.tar.bz2
drakx-backup-do-not-use-3635161f628098787b71456e735c9ad87578930f.tar.xz
drakx-backup-do-not-use-3635161f628098787b71456e735c9ad87578930f.zip
no_comment
Diffstat (limited to 'perl-install/detect_devices.pm')
-rw-r--r--perl-install/detect_devices.pm33
1 files changed, 24 insertions, 9 deletions
diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm
index 23c58ba7d..c0cdb221d 100644
--- a/perl-install/detect_devices.pm
+++ b/perl-install/detect_devices.pm
@@ -8,7 +8,7 @@ use common qw(:common :file);
use devices;
use c;
-
+my @netdevices = map { my $l = $_; map { "$l$_" } (0..3) } qw(eth tr plip fddi);
my $scsiDeviceAvailable;
my $CSADeviceAvailable;
@@ -99,7 +99,6 @@ sub getIDE() {
@idi;
}
-
sub getCompaqSmartArray() {
my @idi;
my $f;
@@ -117,15 +116,10 @@ sub getCompaqSmartArray() {
sub getDAC960() {
my @idi;
- my $file = "/var/log/dmesg";
- -r $file or $file = "/tmp/syslog";
-
- local *F;
- open F, $file or die "Failed to open $file: $!";
# We are looking for lines of this format:DAC960#0:
# /dev/rd/c0d0: RAID-7, Online, 17928192 blocks, Write Thru0123456790123456789012
- foreach (<F>) {
+ foreach (syslog()) {
my ($devicename, $info) = m|/dev/rd/(.*?): (.*?),| or next;
push @idi, { info => $info, type => 'hd', devicename => $devicename };
log::l("DAC960: $devicename: $info");
@@ -133,9 +127,23 @@ sub getDAC960() {
@idi;
}
+sub net2module {
+ my @modules = map { quotemeta first(split) } cat_("/proc/modules");
+ my $modules = join '|', @modules;
+ my $net = join '|', @netdevices;
+ my ($module, %l);
+ foreach (syslog()) {
+ if (/^($modules)\.c:/) {
+ $module = $1;
+ } elsif (/^($net):/) {
+ $l{$1} = $module if $module;
+ }
+ }
+ %l;
+}
sub getNet() {
- grep { hasNetDevice($_) } qw(eth0 eth1 eth2 eth3 tr0 plip0 plip1 plip2 fddi0);
+ grep { hasNetDevice($_) } @netdevices;
}
sub getPlip() {
foreach (0..2) {
@@ -154,3 +162,10 @@ sub tryOpen($) {
local *F;
sysopen F, devices::make($_[0]), c::O_NONBLOCK();
}
+
+sub syslog {
+ my $file = "/var/log/dmesg";
+ -r $file or $file = "/tmp/syslog";
+ cat_($file);
+ `dmesg`;
+}