X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=blobdiff_plain;ds=sidebyside;f=Hostname.pm;h=c576c588c1adf5335a0e2e85437dc27808092e7f;hb=fc72421b816581b504987adf8d9ba47dc4dc1f0c;hp=f35ae2c15209dfe54f3ea0c3aea67aceb7c4c3c5;hpb=86635ba11f25f1580bb058a044eaf10b7d8a4f39;p=ocsinventory-agent-cn.git diff --git a/Hostname.pm b/Hostname.pm index f35ae2c..c576c58 100644 --- a/Hostname.pm +++ b/Hostname.pm @@ -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;