line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::Generic::Softwares::Pacman; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
128415067
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
79
|
|
4
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
89
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
624
|
use FusionInventory::Agent::Tools; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
239
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub isEnabled { |
9
|
0
|
|
|
0
|
0
|
|
return canRun('pacman'); |
10
|
|
|
|
|
|
|
} |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub doInventory { |
13
|
0
|
|
|
0
|
0
|
|
my (%params) = @_; |
14
|
|
|
|
|
|
|
|
15
|
0
|
|
|
|
|
|
my $inventory = $params{inventory}; |
16
|
0
|
|
|
|
|
|
my $logger = $params{logger}; |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
|
my $handle = getFileHandle( |
19
|
|
|
|
|
|
|
logger => $logger, |
20
|
|
|
|
|
|
|
command => 'pacman -Q' |
21
|
|
|
|
|
|
|
); |
22
|
0
|
0
|
|
|
|
|
return unless $handle; |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
while (my $line = <$handle>) { |
25
|
0
|
0
|
|
|
|
|
next unless $line =~ /^(\S+)\s+(\S+)/; |
26
|
0
|
|
|
|
|
|
my $name = $1; |
27
|
0
|
|
|
|
|
|
my $version = $2; |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
$inventory->addEntry( |
30
|
|
|
|
|
|
|
section => 'SOFTWARES', |
31
|
|
|
|
|
|
|
entry => { |
32
|
|
|
|
|
|
|
NAME => $name, |
33
|
|
|
|
|
|
|
VERSION => $version |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
} |
37
|
0
|
|
|
|
|
|
close $handle; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |