summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2006-01-20 12:46:40 +0000
committerPascal Rigaux <pixel@mandriva.com>2006-01-20 12:46:40 +0000
commitca81a8740f059ac75fae08a8ac185db19270dffe (patch)
tree8d577cbf405233d2bb392ec1afc8c3146e0bd93a /perl-install
parentb4dfe07443d80899e9bf8b65cde697096d57bed0 (diff)
downloaddrakx-backup-do-not-use-ca81a8740f059ac75fae08a8ac185db19270dffe.tar
drakx-backup-do-not-use-ca81a8740f059ac75fae08a8ac185db19270dffe.tar.gz
drakx-backup-do-not-use-ca81a8740f059ac75fae08a8ac185db19270dffe.tar.bz2
drakx-backup-do-not-use-ca81a8740f059ac75fae08a8ac185db19270dffe.tar.xz
drakx-backup-do-not-use-ca81a8740f059ac75fae08a8ac185db19270dffe.zip
handle new dmidecode output
Diffstat (limited to 'perl-install')
-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 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 };
}