File: Bios.pm

package info (click to toggle)
ocsinventory-agent 2%3A2.0.5-1.2
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 4,120 kB
  • ctags: 899
  • sloc: perl: 20,687; sh: 576; objc: 468; ansic: 333; makefile: 55
file content (32 lines) | stat: -rw-r--r-- 1,134 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package Ocsinventory::Agent::Backend::OS::MacOS::Bios;
use strict;

sub check { return can_load("Mac::SysProfile") }

sub run {
        my $params = shift;
        my $common = $params->{common};

        # use Mac::SysProfile to get the respected datatype
        my $profile = Mac::SysProfile->new();
        my $data = $profile->gettype('SPHardwareDataType');

        # unless we get a real hash value, return with nothing
        return(undef) unless($data && ref($data) eq 'ARRAY');
		
	my $h = $data->[0];

        # set the bios informaiton from the apple system profiler
        $common->setBios({
                SMANUFACTURER   => 'Apple Inc', # duh
                SMODEL          => $h->{'model_identifier'} || $h->{'machine_model'},
        #       SSN             => $h->{'Serial Number'}
        # New method to get the SSN, because of MacOS 10.5.7 update
        # system_profiler gives 'Serial Number (system): XXXXX' where 10.5.6
        # and lower give 'Serial Number: XXXXX'
                SSN             => $h->{'serial_number'},
                BVERSION        => $h->{'boot_rom_version'},
        });
}

1;