source: ocsinventory-agent/trunk/fuentes/lib/Ocsinventory/Agent/Backend/OS/MacOS/Hostname.pm @ 468

Last change on this file since 468 was 468, checked in by mabarracus, 4 years ago

Copyt trusty code

File size: 514 bytes
Line 
1package Ocsinventory::Agent::Backend::OS::MacOS::Hostname;
2
3sub check {
4  return 1 if can_load ("Mac::SysProfile");
5  0;
6}
7
8# Initialise the distro entry
9sub run {
10  my $params = shift;
11  my $common = $params->{common};
12
13  my $hostname;
14
15  my $profile = Mac::SysProfile->new();
16  my $data = $profile->gettype('SPSoftwareDataType');
17 
18  return undef unless(ref($data) eq 'ARRAY');
19
20  my $h = $data->[0]; 
21
22  $hostname = $h->{'local_host_name'};
23 
24  $common->setHardware ({NAME => $hostname}) if $hostname;
25}
26
271;
Note: See TracBrowser for help on using the repository browser.