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

sub check {
  eval { require (Sys::Hostname) };
  return 1 unless $@;
  `which hostname 2>&1`;
  return if ($? >> 8)!=0;
  `hostname 2>&1`;
  return if ($? >> 8)!=0;
  1;
}

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

  my $hostname;

  # ico, Tue, 26 May 2009 17:58:27 +0200
  chomp ( my $hostname = `hostname --fqdn` );

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

1;
