line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::MacOS; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
24675302
|
use strict; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
66
|
|
4
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
62
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
4
|
use English qw(-no_match_vars); |
|
1
|
|
|
|
|
39
|
|
|
1
|
|
|
|
|
19
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
1105
|
use FusionInventory::Agent::Tools; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
136
|
|
9
|
1
|
|
|
1
|
|
431
|
use FusionInventory::Agent::Tools::MacOS; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
242
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub isEnabled { |
12
|
0
|
|
|
0
|
0
|
|
return $OSNAME eq 'darwin'; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub doInventory { |
16
|
0
|
|
|
0
|
0
|
|
my (%params) = @_; |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
|
my $inventory = $params{inventory}; |
19
|
0
|
|
|
|
|
|
my $logger = $params{logger}; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# basic operating system informations |
22
|
0
|
|
|
|
|
|
my $kernelVersion = getFirstLine(command => 'uname -v'); |
23
|
0
|
|
|
|
|
|
my $kernelRelease = getFirstLine(command => 'uname -r'); |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
my ($name, $version); |
26
|
0
|
|
|
|
|
|
my $infos = getSystemProfilerInfos(logger => $logger); |
27
|
0
|
|
|
|
|
|
my $SystemVersion = |
28
|
|
|
|
|
|
|
$infos->{'Software'}->{'System Software Overview'}->{'System Version'}; |
29
|
0
|
0
|
|
|
|
|
if ($SystemVersion =~ /^(.*?)\s+(\d+.*)/) { |
30
|
0
|
|
|
|
|
|
$name = $1; |
31
|
0
|
|
|
|
|
|
$version = $2; |
32
|
|
|
|
|
|
|
} else { |
33
|
0
|
|
|
|
|
|
$name = "Mac OS X"; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
my $boottime = getFirstMatch( |
37
|
|
|
|
|
|
|
command => "sysctl -n kern.boottime", |
38
|
|
|
|
|
|
|
pattern => qr/sec = (\d+)/ |
39
|
|
|
|
|
|
|
); |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
$inventory->setHardware({ |
42
|
|
|
|
|
|
|
OSNAME => $name, |
43
|
|
|
|
|
|
|
OSVERSION => $version, |
44
|
|
|
|
|
|
|
OSCOMMENTS => $kernelVersion, |
45
|
|
|
|
|
|
|
}); |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
$inventory->setOperatingSystem({ |
48
|
|
|
|
|
|
|
NAME => "MacOSX", |
49
|
|
|
|
|
|
|
FULL_NAME => $name, |
50
|
|
|
|
|
|
|
VERSION => $version, |
51
|
|
|
|
|
|
|
KERNEL_VERSION => $kernelRelease, |
52
|
|
|
|
|
|
|
BOOT_TIME => getFormatedLocalTime($boottime) |
53
|
|
|
|
|
|
|
}); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |