package Ocsinventory::Agent::Backend::OS::Generic::Hostname;

sub check {
  return 1 if can_load ("Sys::Hostname::Long");
  return 1 if can_run ("hostname");
  0;
}

# Initialise the distro entry
sub run {
  my $params = shift;
  my $common = $params->{common};

  my $hostname;

  if (can_load("Sys::Hostname::Long")) {
    $hostname = Sys::Hostname::Long::hostname_long();
  } else {
    chomp ( $hostname = `hostname --fqdn` ); # TODO: This is not generic.
  }

  $common->setHardware ({NAME => $hostname});
}

1;
