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;
|