line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::BSD::Softwares; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
109573774
|
use strict; |
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
84
|
|
4
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
100
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
714
|
use FusionInventory::Agent::Tools; |
|
2
|
|
|
|
|
18
|
|
|
2
|
|
|
|
|
931
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub isEnabled { |
9
|
0
|
|
|
0
|
0
|
0
|
my (%params) = @_; |
10
|
|
|
|
|
|
|
|
11
|
0
|
0
|
|
|
|
0
|
return if $params{no_category}->{software}; |
12
|
|
|
|
|
|
|
|
13
|
0
|
|
0
|
|
|
0
|
return canRun('pkg_info') || canRun('pkg'); |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub doInventory { |
17
|
0
|
|
|
0
|
0
|
0
|
my (%params) = @_; |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
0
|
my $inventory = $params{inventory}; |
20
|
0
|
|
|
|
|
0
|
my $logger = $params{logger}; |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
0
|
|
|
0
|
my $packages = |
23
|
|
|
|
|
|
|
_getPackagesList(logger => $logger, command => 'pkg_info') || |
24
|
|
|
|
|
|
|
_getPackagesList(logger => $logger, command => 'pkg info'); |
25
|
0
|
0
|
|
|
|
0
|
return unless $packages; |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
0
|
foreach my $package (@$packages) { |
28
|
0
|
|
|
|
|
0
|
$inventory->addEntry( |
29
|
|
|
|
|
|
|
section => 'SOFTWARES', |
30
|
|
|
|
|
|
|
entry => $package |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub _getPackagesList { |
36
|
2
|
|
|
2
|
|
522
|
my $handle = getFileHandle(@_); |
37
|
2
|
50
|
|
|
|
7
|
return unless $handle; |
38
|
|
|
|
|
|
|
|
39
|
2
|
|
|
|
|
3
|
my @packages; |
40
|
2
|
|
|
|
|
29
|
while (my $line = <$handle>) { |
41
|
67
|
50
|
|
|
|
253
|
next unless $line =~ /^(\S+) - (\S+) \s+ (.*)/x; |
42
|
67
|
|
|
|
|
459
|
push @packages, { |
43
|
|
|
|
|
|
|
NAME => $1, |
44
|
|
|
|
|
|
|
VERSION => $2, |
45
|
|
|
|
|
|
|
COMMENTS => $3 |
46
|
|
|
|
|
|
|
}; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
2
|
|
|
|
|
51
|
close $handle; |
50
|
|
|
|
|
|
|
|
51
|
2
|
50
|
|
|
|
15
|
return @packages ? \@packages : undef; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |