package Ocsinventory::Agent::Backend::OS::Generic::Hostname;
sub check {
- my $params = shift;
- my $common = $params->{common};
- return 1 if $common->can_run ("hostname");
- 0;
+ 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 $params = shift;
+ my $common = $params->{common};
- my $hostname;
+ my $hostname;
- chomp ( $hostname = `hostname -f` ); # TODO: This is not generic.
+ 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});
+ $common->setHardware ({NAME => $hostname});
}
1;
Priority: optional
Maintainer: Ivan Rako <Ivan.Rako@carnet.hr>
Uploaders: Zeljko Boros <Zeljko.Boros@carnet.hr>
-Build-Depends: debhelper (>= 10)
+Build-Depends: debhelper (>= 9)
Standards-Version: 3.9.8
Package: ocsinventory-agent-cn
Architecture: all
-Depends: ${misc:Depends}, carnet-tools-cn (>= 3.2.1), ocsinventory-agent (>= 2:2.0.5), ocsinventory-agent (<< 2:2.4.2), libcrypt-ssleay-perl, libsys-hostname-long-perl
+Depends: ${misc:Depends}, carnet-tools-cn, ocsinventory-agent (>= 2:2.0.5), ocsinventory-agent (<< 2:2.4.2), libcrypt-ssleay-perl, libsys-hostname-long-perl
Description: Hardware and software inventory tool (client)
Open Computer and Software Inventory Next Generation is an
application designed to help a network or system administrator to
Hostname.pm /usr/share/perl5/Ocsinventory/Agent/Backend/OS/Generic
+Deb.pm /usr/share/perl5/Ocsinventory/Agent/Backend/OS/Generic/Packaging
+Networks.pm /usr/share/perl5/Ocsinventory/Agent/Backend/OS/Linux/Network
PINFILE="/etc/apt/preferences.d/99-carnet"
-# Load CARNET Tools
+# Load CARNet Tools
. /usr/share/carnet-tools/functions.sh
echo "CN: Dodajem pinning ocsinventory-agenta na inačicu 2.0.5..."
if [ "$1" = remove -o "$1" = purge ]; then
dpkg-divert --quiet --package ocsinventory-agent-cn --remove --rename \
/usr/share/perl5/Ocsinventory/Agent/Backend/OS/Generic/Hostname.pm || true
+ dpkg-divert --quiet --package ocsinventory-agent-cn --remove --rename \
+ /usr/share/perl5/Ocsinventory/Agent/Backend/OS/Generic/Packaging/Deb.pm || true
+ dpkg-divert --quiet --package ocsinventory-agent-cn --remove --rename \
+ /usr/share/perl5/Ocsinventory/Agent/Backend/OS/Linux/Network/Networks.pm || true
fi
#DEBHELPER#
dpkg-divert --quiet --package ocsinventory-agent-cn --rename \
--divert /usr/share/perl5/Ocsinventory/Agent/Backend/OS/Generic/Hostname.pm.divert \
/usr/share/perl5/Ocsinventory/Agent/Backend/OS/Generic/Hostname.pm
+ dpkg-divert --quiet --package ocsinventory-agent-cn --rename \
+ --divert /usr/share/perl5/Ocsinventory/Agent/Backend/OS/Generic/Packaging/Deb.pm.divert \
+ /usr/share/perl5/Ocsinventory/Agent/Backend/OS/Generic/Packaging/Deb.pm
+ dpkg-divert --quiet --package ocsinventory-agent-cn --rename \
+ --divert /usr/share/perl5/Ocsinventory/Agent/Backend/OS/Linux/Network/Networks.pm.divert \
+ /usr/share/perl5/Ocsinventory/Agent/Backend/OS/Linux/Network/Networks.pm
fi
#DEBHELPER#