diff options
author | Thierry Vignaud <tvignaud@mandriva.org> | 2004-11-02 11:02:00 +0000 |
---|---|---|
committer | Thierry Vignaud <tvignaud@mandriva.org> | 2004-11-02 11:02:00 +0000 |
commit | 66a8d421d8325c862284e02dc72baeef138dfa8e (patch) | |
tree | 5448bb437b517ad3636346e1339be16882534723 /perl-install | |
parent | 5740e8d94be069ef81e2a04a35c6d6a056550feb (diff) | |
download | drakx-66a8d421d8325c862284e02dc72baeef138dfa8e.tar drakx-66a8d421d8325c862284e02dc72baeef138dfa8e.tar.gz drakx-66a8d421d8325c862284e02dc72baeef138dfa8e.tar.bz2 drakx-66a8d421d8325c862284e02dc72baeef138dfa8e.tar.xz drakx-66a8d421d8325c862284e02dc72baeef138dfa8e.zip |
(dmidecode) handle multiple devices with same name
(computer_info) split it out of dmidecode()
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/detect_devices.pm | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm index e78de8480..a3566739c 100644 --- a/perl-install/detect_devices.pm +++ b/perl-install/detect_devices.pm @@ -783,29 +783,34 @@ sub hasSMP() { sub hasPCMCIA() { $::o->{pcmcia} } #- because /proc/pcmcia seems not to be present on 2.4 at least (or use /var/run/stab) sub dmidecode() { - my (%l, $cat); + my @l; - my $dmidecode_infos if 0; - - if (!$dmidecode_infos) { foreach (run_program::get_stdout('dmidecode')) { if (/^\t\t(.*)/) { - $l{$cat} .= "$1\n"; + $l[-1]->{string} .= "$1\n"; } elsif (my ($s) = /^\t(.*)/) { next if $s =~ /^DMI type /; $s =~ s/ Information$//; - $cat = $s; + push @l, { name => $s }; } } - my $Chassis = $l{Chassis} =~ /^Type:\s*(\S+)/m && $1; - my $BIOS_Year = $l{BIOS} =~ m!^Release Date:.*?(\d{4})!m && $1 || - $l{BIOS} =~ m!^Release Date:.*?\d\d/\d\d/(\d\d)!m && "20$1"; + @l; +} + +sub computer_info() { + my $dmidecode_infos; + my @l = dmidecode(); + my $chassis = (find { $_->{name} eq 'Chassis' } @l) || { string => '' }; + my $Chassis = $chassis->{string} =~ /^Type:\s*(\S+)/m && $1; + my $BIOS = (find { $_->{name} eq 'BIOS' } @l) || { string => '' }; + my $BIOS_Year = $BIOS->{string} =~ m!^Release Date:.*?(\d{4})!m && $1 || + $BIOS->{string} =~ m!^Release Date:.*?\d\d/\d\d/(\d\d)!m && "20$1"; $dmidecode_infos = { isLaptop => member($Chassis, 'Portable', 'Laptop', 'Notebook', 'Sub Notebook', 'Docking Station'), if_($BIOS_Year, BIOS_Year => $BIOS_Year), }; - } + $dmidecode_infos; } |