line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::MacOS::Softwares; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
63185846
|
use strict; |
|
1
|
|
|
|
|
17
|
|
|
1
|
|
|
|
|
113
|
|
4
|
1
|
|
|
1
|
|
11
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
72
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
492
|
use FusionInventory::Agent::Tools; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
236
|
|
7
|
1
|
|
|
1
|
|
717
|
use FusionInventory::Agent::Tools::MacOS; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
441
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub isEnabled { |
10
|
0
|
|
|
0
|
0
|
|
my (%params) = @_; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
return |
13
|
0
|
|
0
|
|
|
|
!$params{no_category}->{software} && |
14
|
|
|
|
|
|
|
canRun('/usr/sbin/system_profiler'); |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub doInventory { |
18
|
0
|
|
|
0
|
0
|
|
my (%params) = @_; |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
my $inventory = $params{inventory}; |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
|
my $softwares = _getSoftwaresList(logger => $params{logger}); |
23
|
0
|
0
|
|
|
|
|
return unless $softwares; |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
foreach my $software (@$softwares) { |
26
|
0
|
|
|
|
|
|
$inventory->addEntry( |
27
|
|
|
|
|
|
|
section => 'SOFTWARES', |
28
|
|
|
|
|
|
|
entry => $software |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub _getSoftwaresList { |
34
|
0
|
|
|
0
|
|
|
my $infos = getSystemProfilerInfos( |
35
|
|
|
|
|
|
|
type => 'SPApplicationsDataType', |
36
|
|
|
|
|
|
|
@_ |
37
|
|
|
|
|
|
|
); |
38
|
0
|
|
|
|
|
|
my $info = $infos->{Applications}; |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
my @softwares; |
41
|
0
|
|
|
|
|
|
foreach my $name (keys %$info) { |
42
|
0
|
|
|
|
|
|
my $app = $info->{$name}; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# Windows application found by Parallels (issue #716) |
45
|
|
|
|
|
|
|
next if |
46
|
0
|
0
|
0
|
|
|
|
$app->{'Get Info String'} && |
47
|
|
|
|
|
|
|
$app->{'Get Info String'} =~ /^\S+, [A-Z]:\\/; |
48
|
|
|
|
|
|
|
|
49
|
0
|
0
|
|
|
|
|
push @softwares, { |
50
|
|
|
|
|
|
|
NAME => $name, |
51
|
|
|
|
|
|
|
VERSION => $app->{'Version'}, |
52
|
|
|
|
|
|
|
COMMENTS => $app->{'Kind'} ? '[' . $app->{'Kind'} . ']' : undef, |
53
|
|
|
|
|
|
|
PUBLISHER => $app->{'Get Info String'}, |
54
|
|
|
|
|
|
|
}; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
return \@softwares; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |