line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::Solaris::Bios; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
102799988
|
use strict; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
61
|
|
4
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
71
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
9
|
use Config; |
|
2
|
|
|
|
|
39
|
|
|
2
|
|
|
|
|
145
|
|
7
|
2
|
|
|
2
|
|
9
|
use List::Util qw(first); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
281
|
|
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
748
|
use FusionInventory::Agent::Tools; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
250
|
|
10
|
2
|
|
|
2
|
|
776
|
use FusionInventory::Agent::Tools::Solaris; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1293
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub isEnabled { |
13
|
|
|
|
|
|
|
return |
14
|
0
|
|
0
|
0
|
0
|
0
|
canRun('showrev') || |
15
|
|
|
|
|
|
|
canRun('/usr/sbin/smbios'); |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub doInventory { |
19
|
0
|
|
|
0
|
0
|
0
|
my (%params) = @_; |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
0
|
my $inventory = $params{inventory}; |
22
|
0
|
|
|
|
|
0
|
my $logger = $params{logger}; |
23
|
|
|
|
|
|
|
|
24
|
0
|
0
|
|
|
|
0
|
my $arch = $Config{archname} =~ /^i86pc/ ? 'i386' : 'sparc'; |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
0
|
my ($bios, $hardware); |
27
|
|
|
|
|
|
|
|
28
|
0
|
0
|
|
|
|
0
|
if (getZone() eq 'global') { |
29
|
0
|
0
|
|
|
|
0
|
if (canRun('showrev')) { |
30
|
0
|
|
|
|
|
0
|
my $infos = _parseShowRev(logger => $logger); |
31
|
0
|
|
|
|
|
0
|
$bios->{SMODEL} = $infos->{'Application architecture'}; |
32
|
0
|
|
|
|
|
0
|
$bios->{SMANUFACTURER} = $infos->{'Hardware provider'}; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
0
|
0
|
|
|
|
0
|
if ($arch eq "i386") { |
36
|
0
|
|
|
|
|
0
|
my $infos = _parseSmbios(logger => $logger); |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
0
|
my $biosInfos = $infos->{SMB_TYPE_BIOS}; |
39
|
0
|
|
|
|
|
0
|
$bios->{BMANUFACTURER} = $biosInfos->{'Vendor'}; |
40
|
0
|
|
|
|
|
0
|
$bios->{BVERSION} = $biosInfos->{'Version String'}; |
41
|
0
|
|
|
|
|
0
|
$bios->{BDATE} = $biosInfos->{'Release Date'}; |
42
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
0
|
my $systemInfos = $infos->{SMB_TYPE_SYSTEM}; |
44
|
0
|
|
|
|
|
0
|
$bios->{SMANUFACTURER} = $systemInfos->{'Manufacturer'}; |
45
|
0
|
|
|
|
|
0
|
$bios->{SMODEL} = $systemInfos->{'Product'}; |
46
|
0
|
|
|
|
|
0
|
$bios->{SKUNUMBER} = $systemInfos->{'SKU Number'}; |
47
|
0
|
|
|
|
|
0
|
$hardware->{UUID} = $systemInfos->{'UUID'}; |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
0
|
my $motherboardInfos = $infos->{SMB_TYPE_BASEBOARD}; |
50
|
0
|
|
|
|
|
0
|
$bios->{MMODEL} = $motherboardInfos->{'Product'}; |
51
|
0
|
|
|
|
|
0
|
$bios->{MSN} = $motherboardInfos->{'Serial Number'}; |
52
|
0
|
|
|
|
|
0
|
$bios->{MMANUFACTURER} = $motherboardInfos->{'Manufacturer'}; |
53
|
|
|
|
|
|
|
} else { |
54
|
0
|
|
|
|
|
0
|
my $info = getPrtconfInfos(logger => $logger); |
55
|
0
|
0
|
|
|
|
0
|
if ($info) { |
56
|
0
|
|
|
0
|
|
0
|
my $root = first { ref $_ eq 'HASH' } values %$info; |
|
0
|
|
|
|
|
0
|
|
57
|
0
|
|
|
|
|
0
|
$bios->{SMODEL} = $root->{'banner-name'}; |
58
|
0
|
0
|
|
|
|
0
|
if ($root->{openprom}->{version} =~ |
59
|
|
|
|
|
|
|
m{OBP \s+ ([\d.]+) \s+ (\d{4})/(\d{2})/(\d{2})}x) { |
60
|
0
|
|
|
|
|
0
|
$bios->{BVERSION} = $1; |
61
|
0
|
|
|
|
|
0
|
$bios->{BDATE} = join('/', $4, $3, $2); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
0
|
0
|
|
|
|
0
|
my $command = -x '/opt/SUNWsneep/bin/sneep' ? |
66
|
|
|
|
|
|
|
'/opt/SUNWsneep/bin/sneep' : 'sneep'; |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
0
|
$bios->{SSN} = getFirstLine( |
69
|
|
|
|
|
|
|
command => $command, |
70
|
|
|
|
|
|
|
logger => $logger |
71
|
|
|
|
|
|
|
); |
72
|
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
0
|
$hardware->{UUID} = _getUUID( |
74
|
|
|
|
|
|
|
command => '/usr/sbin/zoneadm -z global list -p', |
75
|
|
|
|
|
|
|
logger => $logger |
76
|
|
|
|
|
|
|
); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
} else { |
79
|
0
|
|
|
|
|
0
|
my $infos = _parseShowRev(logger => $logger); |
80
|
0
|
|
|
|
|
0
|
$bios->{SMANUFACTURER} = $infos->{'Hardware provider'}; |
81
|
0
|
|
|
|
|
0
|
$bios->{SMODEL} = "Solaris Containers"; |
82
|
|
|
|
|
|
|
|
83
|
0
|
0
|
|
|
|
0
|
if ($arch eq 'sparc') { |
84
|
0
|
|
|
|
|
0
|
$hardware->{UUID} = _getUUID( |
85
|
|
|
|
|
|
|
command => '/usr/sbin/zoneadm list -p', |
86
|
|
|
|
|
|
|
logger => $logger |
87
|
|
|
|
|
|
|
) |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
0
|
$inventory->setBios($bios); |
92
|
0
|
|
|
|
|
0
|
$inventory->setHardware($hardware); |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub _parseShowRev { |
96
|
5
|
|
|
5
|
|
10905
|
my (%params) = ( |
97
|
|
|
|
|
|
|
command => 'showrev', |
98
|
|
|
|
|
|
|
@_ |
99
|
|
|
|
|
|
|
); |
100
|
|
|
|
|
|
|
|
101
|
5
|
|
|
|
|
19
|
my $handle = getFileHandle(%params); |
102
|
5
|
50
|
|
|
|
11
|
return unless $handle; |
103
|
|
|
|
|
|
|
|
104
|
5
|
|
|
|
|
4
|
my $infos; |
105
|
5
|
|
|
|
|
48
|
while (my $line = <$handle>) { |
106
|
40
|
100
|
|
|
|
97
|
next unless $line =~ /^ ([^:]+) : \s+ (\S+)/x; |
107
|
33
|
|
|
|
|
103
|
$infos->{$1} = $2; |
108
|
|
|
|
|
|
|
} |
109
|
5
|
|
|
|
|
26
|
close $handle; |
110
|
|
|
|
|
|
|
|
111
|
5
|
|
|
|
|
16
|
return $infos; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub _parseSmbios { |
115
|
2
|
|
|
2
|
|
4571
|
my (%params) = ( |
116
|
|
|
|
|
|
|
command => '/usr/sbin/smbios', |
117
|
|
|
|
|
|
|
@_ |
118
|
|
|
|
|
|
|
); |
119
|
|
|
|
|
|
|
|
120
|
2
|
|
|
|
|
7
|
my $handle = getFileHandle(%params); |
121
|
2
|
50
|
|
|
|
6
|
return unless $handle; |
122
|
|
|
|
|
|
|
|
123
|
2
|
|
|
|
|
2
|
my ($infos, $current); |
124
|
2
|
|
|
|
|
35
|
while (my $line = <$handle>) { |
125
|
102
|
100
|
|
|
|
166
|
if ($line =~ /^ \d+ \s+ \d+ \s+ (\S+)/x) { |
126
|
6
|
|
|
|
|
13
|
$current = $1; |
127
|
6
|
|
|
|
|
12
|
next; |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
96
|
100
|
|
|
|
227
|
if ($line =~ /^ \s* ([^:]+) : \s* (.+) $/x) { |
131
|
52
|
|
|
|
|
120
|
$infos->{$current}->{$1} = $2; |
132
|
52
|
|
|
|
|
107
|
next; |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
} |
135
|
2
|
|
|
|
|
11
|
close $handle; |
136
|
|
|
|
|
|
|
|
137
|
2
|
|
|
|
|
9
|
return $infos; |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
sub _getUUID { |
141
|
0
|
|
|
0
|
|
|
my (%params) = ( |
142
|
|
|
|
|
|
|
command => '/usr/sbin/zoneadm list -p', |
143
|
|
|
|
|
|
|
@_ |
144
|
|
|
|
|
|
|
); |
145
|
|
|
|
|
|
|
|
146
|
0
|
|
|
|
|
|
my $line = getFirstLine(%params); |
147
|
0
|
0
|
|
|
|
|
return unless $line; |
148
|
|
|
|
|
|
|
|
149
|
0
|
|
|
|
|
|
my @info = split(/:/, $line); |
150
|
0
|
|
|
|
|
|
my $uuid = $info[4]; |
151
|
|
|
|
|
|
|
|
152
|
0
|
|
|
|
|
|
return $uuid; |
153
|
|
|
|
|
|
|
} |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
1; |