diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2006-01-20 12:48:26 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2006-01-20 12:48:26 +0000 |
commit | f73144bf37f44c33a08ce8d5d423fde5d7e37cf1 (patch) | |
tree | 98f039ebca8916cd5c32c83875ab93c20fb6a8c1 | |
parent | 965d21362b8e560065ef5475efb2a8a22fb5c8c2 (diff) | |
download | drakx-f73144bf37f44c33a08ce8d5d423fde5d7e37cf1.tar drakx-f73144bf37f44c33a08ce8d5d423fde5d7e37cf1.tar.gz drakx-f73144bf37f44c33a08ce8d5d423fde5d7e37cf1.tar.bz2 drakx-f73144bf37f44c33a08ce8d5d423fde5d7e37cf1.tar.xz drakx-f73144bf37f44c33a08ce8d5d423fde5d7e37cf1.zip |
handle new dmidecode output
-rw-r--r-- | perl-install/detect_devices.pm | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm index a067d97cd..827aa84c5 100644 --- a/perl-install/detect_devices.pm +++ b/perl-install/detect_devices.pm @@ -884,12 +884,22 @@ my (@dmis, $dmidecode_already_runned); sub dmidecode() { return @dmis if $dmidecode_already_runned; - foreach (run_program::get_stdout('dmidecode')) { - if (/^\t\t(.*)/) { + my ($ver, @l) = run_program::get_stdout('dmidecode'); + + my $tab = "\t"; + if ($ver =~ /(\d+\.\d+)/ && $1 >= 2.7) { + #- new dmidecode output is less indented + $tab = ''; + #- drop header + shift @l while $l[0] ne "\n"; + } + + foreach (@l) { + if (/^$tab\t(.*)/) { $dmis[-1]{string} .= "$1\n"; - $dmis[-1]{$1} = $2 if /^\t\t(.*): (.*)$/; - } elsif (my ($s) = /^\t(.*)/) { - next if $s =~ /^DMI type /; + $dmis[-1]{$1} = $2 if /^$tab\t(.*): (.*)$/; + } elsif (my ($s) = /^$tab(.*)/) { + next if $s =~ /^$/ || $s =~ /\bDMI type \d+/; $s =~ s/ Information$//; push @dmis, { name => $s }; } |