File: Bios.pm

package info (click to toggle)
ocsinventory-agent 2%3A2.10.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,424 kB
  • sloc: perl: 26,492; xml: 773; objc: 528; sh: 386; ansic: 333; makefile: 12
file content (39 lines) | stat: -rw-r--r-- 1,275 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
33
34
35
36
37
38
39
package Ocsinventory::Agent::Backend::OS::MacOS::Bios;
use strict;

sub check { 
    my $params = shift;
    my $common = $params->{common};
    return $common->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 information from the apple system profiler
    $common->setBios({
        SMANUFACTURER   => 'Apple Inc', # duh
        SMODEL          => $h->{'model_identifier'} || $h->{'machine_model'},
        TYPE            => $h->{'machine_name'},
        BMANUFACTURER   => 'Apple Inc',
        MMANUFACTURER   => 'Apple Inc',
        #       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;