line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::BSD; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
26047537
|
use strict; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
68
|
|
4
|
1
|
|
|
1
|
|
10
|
use warnings; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
68
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
4
|
use English qw(-no_match_vars); |
|
1
|
|
|
|
|
36
|
|
|
1
|
|
|
|
|
20
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
1251
|
use FusionInventory::Agent::Tools; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
380
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $runAfter = ["FusionInventory::Agent::Task::Inventory::Generic"]; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub isEnabled { |
13
|
0
|
|
|
0
|
0
|
|
return $OSNAME =~ /freebsd|openbsd|netbsd|gnukfreebsd|gnuknetbsd|dragonfly/; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub doInventory { |
17
|
0
|
|
|
0
|
0
|
|
my (%params) = @_; |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
my $inventory = $params{inventory}; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# basic operating system informations |
22
|
0
|
|
|
|
|
|
my $kernelVersion = getFirstLine(command => 'uname -v'); |
23
|
0
|
|
|
|
|
|
my $kernelRelease = getFirstLine(command => 'uname -r'); |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
my $boottime = getFirstMatch( |
26
|
|
|
|
|
|
|
command => "sysctl -n kern.boottime", |
27
|
|
|
|
|
|
|
pattern => qr/sec = (\d+)/ |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
|
30
|
0
|
0
|
|
|
|
|
my $name = canRun('lsb_release') ? |
31
|
|
|
|
|
|
|
getFirstMatch( |
32
|
|
|
|
|
|
|
command => 'lsb_release -d', |
33
|
|
|
|
|
|
|
pattern => qr/Description:\s+(.+)/ |
34
|
|
|
|
|
|
|
) : $OSNAME; |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
$inventory->setHardware({ |
37
|
|
|
|
|
|
|
OSNAME => $name, |
38
|
|
|
|
|
|
|
OSVERSION => $kernelRelease, |
39
|
|
|
|
|
|
|
OSCOMMENTS => $kernelVersion, |
40
|
|
|
|
|
|
|
}); |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
$inventory->setOperatingSystem({ |
43
|
|
|
|
|
|
|
NAME => $name, |
44
|
|
|
|
|
|
|
FULL_NAME => $OSNAME, |
45
|
|
|
|
|
|
|
VERSION => $kernelRelease, |
46
|
|
|
|
|
|
|
KERNEL_VERSION => $kernelRelease, |
47
|
|
|
|
|
|
|
BOOT_TIME => getFormatedLocalTime($boottime) |
48
|
|
|
|
|
|
|
}); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |