summaryrefslogtreecommitdiffstats
path: root/perl-install/detect_devices.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2004-08-18 07:53:05 +0000
committerPascal Rigaux <pixel@mandriva.com>2004-08-18 07:53:05 +0000
commited69d6328f6201595bcbcfe118a88ceea4274611 (patch)
tree2628766b353669dba6ca0485feec738842682993 /perl-install/detect_devices.pm
parenta2fb389cac37ad73397dd109e344ea0afce41d8d (diff)
downloaddrakx-backup-do-not-use-ed69d6328f6201595bcbcfe118a88ceea4274611.tar
drakx-backup-do-not-use-ed69d6328f6201595bcbcfe118a88ceea4274611.tar.gz
drakx-backup-do-not-use-ed69d6328f6201595bcbcfe118a88ceea4274611.tar.bz2
drakx-backup-do-not-use-ed69d6328f6201595bcbcfe118a88ceea4274611.tar.xz
drakx-backup-do-not-use-ed69d6328f6201595bcbcfe118a88ceea4274611.zip
use dmidecode to detect isLaptop()
Diffstat (limited to 'perl-install/detect_devices.pm')
-rw-r--r--perl-install/detect_devices.pm27
1 files changed, 26 insertions, 1 deletions
diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm
index 7af813337..2d21f1cb2 100644
--- a/perl-install/detect_devices.pm
+++ b/perl-install/detect_devices.pm
@@ -730,12 +730,37 @@ 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 $dmidecode_infos if 0;
+
+ if (!$dmidecode_infos) {
+ foreach (run_program::get_stdout('dmidecode')) {
+ if (/^\t\t(.*)/) {
+ $l{$cat} .= "$1\n";
+ } elsif (my ($s) = /^\t(.*)/) {
+ next if $s =~ /^DMI type /;
+ $s =~ s/ Information$//;
+ $cat = $s;
+ }
+ }
+ my $Chassis = $l{Chassis} =~ /^Type:\s*(\S+)/m && $1;
+
+ $dmidecode_infos = {
+ isLaptop => member($Chassis, 'Portable', 'Laptop', 'Notebook', 'Sub Notebook', 'Docking Station'),
+ if_($l{BIOS} =~ /^Release Date:.*?(\d{4})/m, BIOS_Year => $1),
+ };
+ }
+ $dmidecode_infos;
+}
+
#- try to detect a laptop, we assume pcmcia service is an indication of a laptop or
#- the following regexp to match graphics card apparently only used for such systems.
sub isLaptop() {
arch() =~ /ppc/ ?
get_mac_model() =~ /Book/ :
- hasPCMCIA()
+ dmidecode()->{isLaptop}
|| (matching_desc('C&T.*655[45]\d') || matching_desc('C&T.*68554') ||
matching_desc('Neomagic.*Magic(Media|Graph)') ||
matching_desc('ViRGE.MX') || matching_desc('S3.*Savage.*[IM]X') ||