summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2006-01-20 12:48:26 +0000
committerPascal Rigaux <pixel@mandriva.com>2006-01-20 12:48:26 +0000
commitf73144bf37f44c33a08ce8d5d423fde5d7e37cf1 (patch)
tree98f039ebca8916cd5c32c83875ab93c20fb6a8c1
parent965d21362b8e560065ef5475efb2a8a22fb5c8c2 (diff)
downloaddrakx-backup-do-not-use-f73144bf37f44c33a08ce8d5d423fde5d7e37cf1.tar
drakx-backup-do-not-use-f73144bf37f44c33a08ce8d5d423fde5d7e37cf1.tar.gz
drakx-backup-do-not-use-f73144bf37f44c33a08ce8d5d423fde5d7e37cf1.tar.bz2
drakx-backup-do-not-use-f73144bf37f44c33a08ce8d5d423fde5d7e37cf1.tar.xz
drakx-backup-do-not-use-f73144bf37f44c33a08ce8d5d423fde5d7e37cf1.zip
handle new dmidecode output
-rw-r--r--perl-install/detect_devices.pm20
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 };
}