From 0173cf11e9654d7d16fdc4081ac033c2e8fc3a76 Mon Sep 17 00:00:00 2001 From: Ivan Rako Date: Sat, 31 Aug 2013 16:03:57 +0200 Subject: [PATCH] ispravke za squeeze --- Deb.pm | 26 ++++++++++++++++++++++++++ Hostname.pm | 21 ++++++++++----------- README.CARNet | 3 ++- debian/changelog | 9 +++++++++ debian/compat | 2 +- debian/control | 6 +++--- debian/install | 1 + debian/postinst | 2 ++ debian/postrm | 6 +++++- debian/preinst | 7 ++++++- 10 files changed, 65 insertions(+), 18 deletions(-) create mode 100644 Deb.pm diff --git a/Deb.pm b/Deb.pm new file mode 100644 index 0000000..b64552a --- /dev/null +++ b/Deb.pm @@ -0,0 +1,26 @@ +package Ocsinventory::Agent::Backend::OS::Generic::Packaging::Deb; + +use strict; +use warnings; + +sub check { can_run("dpkg") } + +sub run { + my $params = shift; + my $common = $params->{common}; + +# use dpkg-query --show --showformat='${Package}|||${Version}\n' + foreach(`dpkg-query --show --showformat='\${Status}---\${Package}---\${Version}---\${Installed-Size}---\${Description}\n' | grep ^'install ok installed'`) { + if (/^(\S+)---(\S+)---(\S+)---(\S+)---(.*)/) { + $common->addSoftware ({ + 'NAME' => $2, + 'VERSION' => $3, + 'FILESIZE' => $4, + 'COMMENTS' => $5, + 'FROM' => 'deb' + }); + } + } +} + +1; diff --git a/Hostname.pm b/Hostname.pm index c1b5f31..f35ae2c 100644 --- a/Hostname.pm +++ b/Hostname.pm @@ -1,26 +1,25 @@ package Ocsinventory::Agent::Backend::OS::Generic::Hostname; sub check { - eval { require (Sys::Hostname) }; - return 1 unless $@; - `which hostname 2>&1`; - return if ($? >> 8)!=0; - `hostname 2>&1`; - return if ($? >> 8)!=0; - 1; + 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 $inventory = $params->{inventory}; + my $common = $params->{common}; my $hostname; - # ico, Tue, 26 May 2009 17:58:27 +0200 - chomp ( my $hostname = `hostname --fqdn` ); + if (can_load("Sys::Hostname::Long")) { + $hostname = Sys::Hostname::Long::hostname_long(); + } else { + chomp ( $hostname = `hostname --fqdn` ); # TODO: This is not generic. + } - $inventory->setHardware ({NAME => $hostname}); + $common->setHardware ({NAME => $hostname}); } 1; diff --git a/README.CARNet b/README.CARNet index 4c08e4c..b29eccf 100644 --- a/README.CARNet +++ b/README.CARNet @@ -2,5 +2,6 @@ ocsinventory-agent-cn +-------------------+ Paket zamjenjuje Hostname.pm zbog slanja dugog oblika imena (FQDN). +Takodjer zamjenjuje Deb.pm koji ne salje pakete oznacena kao removed. - -- Ivan Rako Fri, 26 Jun 2009 15:00:05 +0200 + -- Ivan Rako Sat, 31 Aug 2013 15:53:00 +0200 diff --git a/debian/changelog b/debian/changelog index 13489a0..448fc51 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +ocsinventory-agent-cn (1:2.0.5~cn0) stable; urgency=low + + * prva verzija paketa za wheezy + * dodaje novi Deb.pm koji ne salje popis paketa oznacenih kao removed + * dodaje novi ispravljeni Hostname.pm + * ispravke za Lintian + + -- Ivan Rako Sat, 31 Aug 2013 15:53:57 +0200 + ocsinventory-agent-cn (1:1.1.1-1) stable; urgency=low * prva verzija paketa za squeeze diff --git a/debian/compat b/debian/compat index b8626c4..45a4fb7 100644 --- a/debian/compat +++ b/debian/compat @@ -1 +1 @@ -4 +8 diff --git a/debian/control b/debian/control index 1fb1b9c..8a381bc 100644 --- a/debian/control +++ b/debian/control @@ -2,12 +2,12 @@ Source: ocsinventory-agent-cn Section: net Priority: optional Maintainer: Ivan Rako -Build-Depends: debhelper (>= 4.0.0) -Standards-Version: 3.6.1 +Build-Depends: debhelper (>= 8) +Standards-Version: 3.9.3 Package: ocsinventory-agent-cn Architecture: all -Depends: carnet-tools-cn (>= 2.7), ocsinventory-agent (>= 2:1.1.1-2.3), libcrypt-ssleay-perl +Depends: ${misc:Depends}, carnet-tools-cn (>= 2.7), ocsinventory-agent (>= 2:2.0.5-1), 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 8e29198..54a52cc 100644 --- a/debian/install +++ b/debian/install @@ -1 +1,2 @@ Hostname.pm usr/share/perl5/Ocsinventory/Agent/Backend/OS/Generic +Deb.pm /usr/share/perl5/Ocsinventory/Agent/Backend/OS/Generic/Packaging diff --git a/debian/postinst b/debian/postinst index 044b69b..ed61cd0 100755 --- a/debian/postinst +++ b/debian/postinst @@ -40,3 +40,5 @@ fi if ! grep -q ^server= /etc/ocsinventory/ocsinventory-agent.cfg; then echo "server=$ocsserver" >> /etc/ocsinventory/ocsinventory-agent.cfg fi + +#DEBHELPER# diff --git a/debian/postrm b/debian/postrm index 73291ab..a58e1fa 100755 --- a/debian/postrm +++ b/debian/postrm @@ -3,6 +3,10 @@ set -e if [ "$1" = remove ]; then - dpkg-divert --quiet --package ocsinventory-agent-cn --remove --rename \ + dpkg-divert --quiet --package ocsinventory-agent-srce --remove --rename \ /usr/share/perl5/Ocsinventory/Agent/Backend/OS/Generic/Hostname.pm || true + dpkg-divert --quiet --package ocsinventory-agent-srce --remove --rename \ + /usr/share/perl5/Ocsinventory/Agent/Backend/OS/Generic/Packaging/Deb.pm || true fi + +#DEBHELPER# diff --git a/debian/preinst b/debian/preinst index da715bf..e1e64ec 100755 --- a/debian/preinst +++ b/debian/preinst @@ -3,7 +3,12 @@ set -e if [ "$1" = install -o "$1" = upgrade ]; then - dpkg-divert --quiet --package ocsinventory-agent-cn --rename \ + dpkg-divert --quiet --package ocsinventory-agent-srce --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-srce --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 fi + +#DEBHELPER# -- 1.7.10.4