Prva verzija za buster.
[ocsinventory-agent-cn.git] / Hostname.pm
1 package Ocsinventory::Agent::Backend::OS::Generic::Hostname;
2
3 sub check {
4   return 1 if can_load ("Sys::Hostname::Long");
5   return 1 if can_run ("hostname");
6   0;
7 }
8
9 # Initialise the distro entry
10 sub run {
11   my $params = shift;
12   my $common = $params->{common};
13
14   my $hostname;
15
16   if (can_load("Sys::Hostname::Long")) {
17     $hostname = Sys::Hostname::Long::hostname_long();
18   } else {
19     chomp ( $hostname = `hostname --fqdn` ); # TODO: This is not generic.
20   }
21
22   $common->setHardware ({NAME => $hostname});
23 }
24
25 1;