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