X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=blobdiff_plain;f=Hostname.pm;h=c576c588c1adf5335a0e2e85437dc27808092e7f;hb=HEAD;hp=f35ae2c15209dfe54f3ea0c3aea67aceb7c4c3c5;hpb=0173cf11e9654d7d16fdc4081ac033c2e8fc3a76;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;