From: Zeljko Boros Date: Mon, 10 May 2021 13:56:48 +0000 (+0200) Subject: fixed errors X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=commitdiff_plain;h=e84f1d9c108f37af4833c28dcfe30935a13ffc35;p=ocsinventory-agent-cn.git fixed errors --- diff --git a/Hostname.pm b/Hostname.pm index c576c58..f35ae2c 100644 --- a/Hostname.pm +++ b/Hostname.pm @@ -1,22 +1,25 @@ 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; diff --git a/debian/compat b/debian/compat index f599e28..ec63514 100644 --- a/debian/compat +++ b/debian/compat @@ -1 +1 @@ -10 +9 diff --git a/debian/control b/debian/control index 08ed4f7..7086e4e 100644 --- a/debian/control +++ b/debian/control @@ -3,12 +3,12 @@ Section: net Priority: optional Maintainer: Ivan Rako Uploaders: Zeljko Boros -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 diff --git a/debian/install b/debian/install index c88252d..b620825 100644 --- a/debian/install +++ b/debian/install @@ -1 +1,3 @@ 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 diff --git a/debian/postinst b/debian/postinst index 93d2f2f..7b65601 100755 --- a/debian/postinst +++ b/debian/postinst @@ -7,7 +7,7 @@ set -e 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..." diff --git a/debian/postrm b/debian/postrm index 10f73ac..498930d 100755 --- a/debian/postrm +++ b/debian/postrm @@ -5,6 +5,10 @@ set -e 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# diff --git a/debian/preinst b/debian/preinst index 00aae29..21ea6b3 100755 --- a/debian/preinst +++ b/debian/preinst @@ -6,6 +6,12 @@ if [ "$1" = install -o "$1" = upgrade ]; then 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#