Prva verzija za buster.
[ocsinventory-agent-cn.git] / Hostname.pm
index f35ae2c..c576c58 100644 (file)
@@ -1,25 +1,22 @@
 package Ocsinventory::Agent::Backend::OS::Generic::Hostname;
 
 sub check {
-  return 1 if can_load ("Sys::Hostname::Long");
-  return 1 if can_run ("hostname");
-  0;
+    my $params = shift;
+    my $common = $params->{common};
+    return 1 if $common->can_run ("hostname");
+    0;
 }
 
 # Initialise the distro entry
 sub run {
-  my $params = shift;
-  my $common = $params->{common};
+    my $params = shift;
+    my $common = $params->{common};
 
-  my $hostname;
+    my $hostname;
 
-  if (can_load("Sys::Hostname::Long")) {
-    $hostname = Sys::Hostname::Long::hostname_long();
-  } else {
-    chomp ( $hostname = `hostname --fqdn` ); # TODO: This is not generic.
-  }
+    chomp ( $hostname = `hostname -f` ); # TODO: This is not generic.
 
-  $common->setHardware ({NAME => $hostname});
+    $common->setHardware ({NAME => $hostname});
 }
 
 1;