From ca81a8740f059ac75fae08a8ac185db19270dffe Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Fri, 20 Jan 2006 12:46:40 +0000 Subject: handle new dmidecode output --- perl-install/detect_devices.pm | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'perl-install/detect_devices.pm') diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm index 15075b8a3..3ab051fc3 100644 --- a/perl-install/detect_devices.pm +++ b/perl-install/detect_devices.pm @@ -900,12 +900,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 }; } -- cgit v1.2.1