line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::BSD::Softwares; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
91448205
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
62
|
|
4
|
2
|
|
|
2
|
|
16
|
use warnings; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
70
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
497
|
use FusionInventory::Agent::Tools; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
664
|
|
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
|
|
323
|
my $handle = getFileHandle(@_); |
37
|
2
|
50
|
|
|
|
5
|
return unless $handle; |
38
|
|
|
|
|
|
|
|
39
|
2
|
|
|
|
|
2
|
my @packages; |
40
|
2
|
|
|
|
|
19
|
while (my $line = <$handle>) { |
41
|
67
|
50
|
|
|
|
160
|
next unless $line =~ /^(\S+) - (\S+) \s+ (.*)/x; |
42
|
67
|
|
|
|
|
250
|
push @packages, { |
43
|
|
|
|
|
|
|
NAME => $1, |
44
|
|
|
|
|
|
|
VERSION => $2, |
45
|
|
|
|
|
|
|
COMMENTS => $3 |
46
|
|
|
|
|
|
|
}; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
2
|
|
|
|
|
11
|
close $handle; |
50
|
|
|
|
|
|
|
|
51
|
2
|
50
|
|
|
|
9
|
return @packages ? \@packages : undef; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |