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

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

Copyt trusty code

File size: 604 bytes
Line 
1package Ocsinventory::Agent::Backend::OS::Solaris::Domains;
2use strict;
3
4sub check { can_run ("domainname") }
5
6sub run { 
7  my $params = shift;
8  my $common = $params->{common};
9
10  my $domain;
11
12  chomp($domain = `domainname`);
13
14  if (!$domain) {
15    my %domain;
16
17    if (open RESOLV, "/etc/resolv.conf") {
18      while(<RESOLV>) {
19        $domain{$2} = 1 if (/^(domain|search)\s+(.+)/);
20      }
21      close RESOLV;
22    }
23    $domain = join "/", keys %domain;
24  }
25# If no domain name, we send "WORKGROUP"
26  $domain = 'WORKGROUP' unless $domain;
27  $common->setHardware({
28      WORKGROUP => $domain
29      });
30}
31
321;
Note: See TracBrowser for help on using the repository browser.