On Sat, Jan 26, 2013 at 10:59:09PM +0100, intrigeri wrote: > Hi, Hi all, I finally managed to upload a new release. Thank you Julien for pointing out the different issues add sorry for the delay. This upload fixes all the issues reported by Julien Cristau. * Fix issues pointed by Julien Cristau: - Add upstream-fix-backport.diff in the patch serie - Depends on libio-socket-ssl-perl instead of libnet-ssleay-perl directly as advertised in 2.2.3-3 - move /usr/share/doc/fusioninventory-agent/agent.cfg to /usr/share/fusioninventory/etc/agent.cfg because of policy 12.3 (Packages must not require the existence of any files in `/usr/share/doc/' in order to function). - clean up fusioninventory-agent.postrm * Refresh upstream-fix-backport.diff - skip, battery.t which is now broken upstream-fix-backport.diff may look a bit large. It comes from the 2.2.x stable branch of FusionInventory Agent. FusionInventory has a Debian like policy regarding the stable. All these changes are here to fix problems, not to add new features. I attached debdiffs to this mail (against -2 and -5). Best regards, -- Gonéri Le Bouder
diff -u fusioninventory-agent-2.2.3/debian/fusioninventory-agent.install fusioninventory-agent-2.2.3/debian/fusioninventory-agent.install --- fusioninventory-agent-2.2.3/debian/fusioninventory-agent.install +++ fusioninventory-agent-2.2.3/debian/fusioninventory-agent.install @@ -1,2 +1,2 @@ -etc/agent.cfg etc/fusioninventory +etc/agent.cfg usr/share/fusioninventory/etc debian/default/fusioninventory-agent etc/default diff -u fusioninventory-agent-2.2.3/debian/changelog fusioninventory-agent-2.2.3/debian/changelog --- fusioninventory-agent-2.2.3/debian/changelog +++ fusioninventory-agent-2.2.3/debian/changelog @@ -1,3 +1,52 @@ +fusioninventory-agent (2.2.3-6) unstable; urgency=low + + * Fix issues pointed by Julien Cristau: + - Add upstream-fix-backport.diff in the patch serie + - Depends on libio-socket-ssl-perl instead of libnet-ssleay-perl + directly as advertised in 2.2.3-3 + - move /usr/share/doc/fusioninventory-agent/agent.cfg to + /usr/share/fusioninventory/etc/agent.cfg because of policy 12.3 + (Packages must not require the existence of any files in + `/usr/share/doc/' in order to function). + - clean up fusioninventory-agent.postrm + * Refresh upstream-fix-backport.diff + - skip, battery.t which is now broken + + -- Gonéri Le Bouder <goneri@rulezlan.org> Sun, 27 Jan 2013 14:36:00 +0100 + +fusioninventory-agent (2.2.3-5) unstable; urgency=low + + * Yet another maintain scripts update :(, thanks Adam D. Barratt, + (closes: #679299) + * Disable 2 unit tests known for depending to much on the machine + configuration (using port 8080). These tests were enough to create FTBFS + time to time (e.g: s390 for 2.2.3-4) + + -- Gonéri Le Bouder <goneri@rulezlan.org> Sun, 25 Nov 2012 16:14:15 +0100 + +fusioninventory-agent (2.2.3-4) unstable; urgency=low + + * fix the postrm script, thanks Adam D. Barratt, + (closes: #679299) + * Import bug fixes from upstream + * Disable t/components/server.t, the test is too fragile. it needs to be + able to bind port 8080. + + -- Gonéri Le Bouder <goneri@rulezlan.org> Sat, 03 Nov 2012 13:34:31 +0100 + +fusioninventory-agent (2.2.3-3) unstable; urgency=low + + * Add a post{inst,rm} scripts to prepeare and clean up + the config file, thanks Andreas Beckmann (closes: #679299) + * Depends on libio-socket-ssl-perl instead of libnet-ssleay-perl + directly + * Migrate debian/copyright to Machine-readable format + * Add a B-D on libio-socket-ssl-perl + * Backport SSL cert from upstream, the ones from the archive were expired, + thanks Gregor Herrmann and Lucas Nussbaum (closes: #684855) + + -- Gonéri Le Bouder <goneri@rulezlan.org> Wed, 11 Jul 2012 12:11:55 -0300 + fusioninventory-agent (2.2.3-2) unstable; urgency=low * Add a dependency on ucf (closes: #679299) diff -u fusioninventory-agent-2.2.3/debian/fusioninventory-agent.postrm fusioninventory-agent-2.2.3/debian/fusioninventory-agent.postrm --- fusioninventory-agent-2.2.3/debian/fusioninventory-agent.postrm +++ fusioninventory-agent-2.2.3/debian/fusioninventory-agent.postrm @@ -1,44 +1,29 @@ -#!/bin/sh -# postrm script for fusioninventory-agent -# -# see: dh_installdeb(1) - +#! /bin/sh set -e -# summary of how this script can be called: -# * <postrm> `remove' -# * <postrm> `purge' -# * <old-postrm> `upgrade' <new-version> -# * <new-postrm> `failed-upgrade' <old-version> -# * <new-postrm> `abort-install' -# * <new-postrm> `abort-install' <old-version> -# * <new-postrm> `abort-upgrade' <old-version> -# * <disappearer's-postrm> `disappear' <overwriter> -# <overwriter-version> -# for details, see http://www.debian.org/doc/debian-policy/ or -# the debian-policy package - +#DEBHELPER# case "$1" in - purge) - ucf --purge /etc/fusioninventory/agent.cfg - rm -rf /var/lib/fusioninventory-agent - ;; - - remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) - ;; + purge) + for ext in '~' '%' .bak .ucf-new .ucf-old .ucf-dist; do + rm -f /etc/fusioninventory/agent.cfg$ext + done + + # remove the configuration file itself + rm -f /etc/fusioninventory/agent.cfg + rm -r /etc/fusioninventory + + # and finally clear it out from the ucf database + if which ucf >/dev/null; then + ucf --purge /etc/fusioninventory/agent.cfg + fi + if which ucfr >/dev/null; then + ucfr --purge fusioninventory-agent /etc/fusioninventory/agent.cfg + fi - *) - echo "postrm called with unknown argument \`$1'" >&2 - exit 1 ;; + *) + exit 0;; esac -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - -#DEBHELPER# - exit 0 - - diff -u fusioninventory-agent-2.2.3/debian/rules fusioninventory-agent-2.2.3/debian/rules --- fusioninventory-agent-2.2.3/debian/rules +++ fusioninventory-agent-2.2.3/debian/rules @@ -23,11 +23,14 @@ [ ! -f MYMETA.json ] || rm MYMETA.json [ ! -f t/inventory/generic/lspci/controllers.t ] || rm t/inventory/generic/lspci/controllers.t -ifeq ($(BACKPORT),yes) - [ ! -f t/components/client/ocs/response.t ] || rm t/components/client/ocs/response.t + [ ! -f t/components/server.t ] || rm t/components/server.t [ ! -f t/components/client/connection.t ] || rm t/components/client/connection.t + [ ! -f t/components/client/ocs/response.t ] || rm t/components/client/ocs/response.t + [ ! -f t/inventory/generic/dmidecode/battery.t ] || rm t/inventory/generic/dmidecode/battery.t +ifeq ($(BACKPORT),yes) [ ! -f t/components/logger.t ] || rm t/components/logger.t [ ! -f t/xml/response.t ] || rm t/xml/response.t # HTTP::Server::Simple::Authen is missing [ ! -f t/components/client/ssl.t ] || rm t/components/client/ssl.t + [ ! -f t/apps/agent.t ] || rm t/apps/agent.t endif dh_clean diff -u fusioninventory-agent-2.2.3/debian/control fusioninventory-agent-2.2.3/debian/control --- fusioninventory-agent-2.2.3/debian/control +++ fusioninventory-agent-2.2.3/debian/control @@ -4,14 +4,14 @@ Maintainer: Gonéri Le Bouder <goneri@rulezlan.org> Build-Depends: debhelper (>= 7.0.50~), libnet-ip-perl, libwww-perl, quilt, - libnet-ssleay-perl, perl, - libuniversal-require-perl, libtest-compile-perl, + perl, libuniversal-require-perl, libtest-compile-perl, libtest-exception-perl, libhttp-server-simple-perl, libfile-which-perl, libxml-treepp-perl, libyaml-perl, libipc-run-perl, libhttp-proxy-perl, libtext-template-perl, libjson-perl, libio-capture-perl, libtest-simple-perl, libtest-mockmodule-perl, - libhttp-server-simple-authen-perl, libhttp-daemon-perl + libhttp-server-simple-authen-perl, libhttp-daemon-perl, + libio-socket-ssl-perl Standards-Version: 3.9.3 Homepage: http://fusioninventory.org/ Vcs-Browser: http://git.debian.org/?p=users/goneri/fusioninventory-agent.git;a=summary @@ -20,7 +20,7 @@ Package: fusioninventory-agent Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, - ucf, libnet-ip-perl, libwww-perl, libnet-ssleay-perl, + ucf, libnet-ip-perl, libwww-perl, libio-socket-ssl-perl, libproc-daemon-perl, dmidecode [i386-any amd64-any ia64], libuniversal-require-perl, libproc-pid-file-perl, hdparm [linux-any], libfile-which-perl, libxml-treepp-perl, libyaml-perl, libtext-template-perl, diff -u fusioninventory-agent-2.2.3/debian/fusioninventory-agent.docs fusioninventory-agent-2.2.3/debian/fusioninventory-agent.docs --- fusioninventory-agent-2.2.3/debian/fusioninventory-agent.docs +++ fusioninventory-agent-2.2.3/debian/fusioninventory-agent.docs @@ -2 +1,0 @@ -etc/agent.cfg reverted: --- fusioninventory-agent-2.2.3/debian/tools/gen-ppa.sh +++ fusioninventory-agent-2.2.3.orig/debian/tools/gen-ppa.sh @@ -1,13 +0,0 @@ -#!/bin/sh - -VERSION=`dpkg-parsechangelog | awk '/Version/ {print $2}'` -UBUREV=1 - -echo $VERSION - -for dist in natty maverick lucid hardy; do - git checkout HEAD -- debian/changelog - dch --force-distribution -v $VERSION$dist$UBUREV -D $dist "Backport for $dist" - dpkg-buildpackage -S -D -sa -i.git - dput ppa ../fusioninventory-agent_$VERSION$dist${UBUREV}_source.changes -done diff -u fusioninventory-agent-2.2.3/debian/patches/series fusioninventory-agent-2.2.3/debian/patches/series --- fusioninventory-agent-2.2.3/debian/patches/series +++ fusioninventory-agent-2.2.3/debian/patches/series @@ -1,0 +2,2 @@ +ssl_cert_backport.diff +upstream-fix-backport.diff only in patch2: unchanged: --- fusioninventory-agent-2.2.3.orig/debian/fusioninventory-agent.postinst +++ fusioninventory-agent-2.2.3/debian/fusioninventory-agent.postinst @@ -0,0 +1,13 @@ +#! /bin/sh +set -e + +#DEBHELPER# + +case "$1" in + configure) + [ -d "/etc/fusioninventory" ] || mkdir "/etc/fusioninventory" + ucf /usr/share/fusioninventory/etc/agent.cfg /etc/fusioninventory/agent.cfg + ucfr fusioninventory-agent /etc/fusioninventory/agent.cfg +esac + +exit 0 only in patch2: unchanged: --- fusioninventory-agent-2.2.3.orig/debian/tools/prepare-bpo.pl +++ fusioninventory-agent-2.2.3/debian/tools/prepare-bpo.pl @@ -0,0 +1,98 @@ +#!/usr/bin/perl +use strict; +use warnings; +use Data::Dumper; +use Dpkg::Control::Info; +use Dpkg::Changelog::Debian; + +$ENV{'DEBFULLNAME'} = 'Gonéri Le Bouder'; +$ENV{'EMAIL'} = 'goneri@rulezlan.org'; + +my %dropTest = ( + 'fusioninventory-agent' => [ + 't/components/client/ocs/response.t', 't/xml/response.t', + 't/components/logger.t', 't/components/client/ssl.t', + 't/components/client/connection.t', 't/01compile.t', + 't/apps/agent.t', + ], + 'libfusioninventory-agent-task-deploy-perl' => [ 't/server.t', ] + +); + +my %newDeps = ( + 'Depends' => { + 'libfusioninventory-agent-task-esx-perl' => [ 'libio-socket-ssl-perl' ], + }, + 'Build-Depends' => { + 'libfusioninventory-agent-task-esx-perl' => [ 'libio-socket-ssl-perl' ] + + } + +); + +open RULES, "<debian/rules"; +my @origin_rules = <RULES>; +close RULES; +open RULES, ">debian/rules"; +foreach (@origin_rules) { + s/BACKPORT = no/BACKPORT = yes/; + print RULES; +} +close RULES; + +sub bpDeps { + my ($pkg) = @_; + + my $name = $pkg->{Package} || $pkg->{Source}; + foreach my $section (qw/Build-Depends Build-Depends-Indep Depends/) { + next unless $pkg->{$section}; + $pkg->{$section} =~ s/\s*\n//g; + my @list = split( /,/, $pkg->{$section} ); + + my @listFinal; + foreach (@list) { + s/^\s*//; + next if $_ eq "libhttp-daemon-perl"; + next if $_ eq "libhttp-server-simple-authen-perl"; + next if $_ eq "libhttp-cookies-perl"; + push @listFinal, $_; + } + if ( $newDeps{$section}->{$name} ) { + push @listFinal, $_ foreach ( @{ $newDeps{$section}->{$name} } ); + } + $pkg->{$section} = join( ",\n", @listFinal ); + } + +} + +my $c = Dpkg::Control::Info->new("debian/control"); + +my $s = $c->get_source(); +bpDeps($s); +use Data::Dumper; + +my @pList = $c->get_packages(); +foreach my $p (@pList) { + bpDeps($p); +} + +open my $f, ">debian/control"; +$c->output($f); + +foreach ( @{ $dropTest{ $s->{Source} } } ) { + unlink($_); +} + +my $changelog = Dpkg::Changelog::Debian->new(); +$changelog->load('debian/changelog'); +use Data::Dumper; +if ( $changelog->[0]->get_distributions() ne 'squeeze-backports' ) { + system("dch --bpo"); +} + +my $lastVersion = $changelog->[ @$changelog - 1 ]->get_version(); +if ( `rmadison $s->{Source} -s squeeze-backports` =~ /^[^\|]*\|\s(\S+)~bpo6/ ) { + $lastVersion = "-v$1"; +} +print "lastVersion: $lastVersion\n"; +system( "dpkg-buildpackage", "-i", "-sa", "-v$lastVersion" ); only in patch2: unchanged: --- fusioninventory-agent-2.2.3.orig/debian/patches/upstream-fix-backport.diff +++ fusioninventory-agent-2.2.3/debian/patches/upstream-fix-backport.diff @@ -0,0 +1,1110 @@ +diff --git a/fusioninventory-agent b/fusioninventory-agent +index 71f19c9..90e5fa0 100755 +--- a/fusioninventory-agent ++++ b/fusioninventory-agent +@@ -363,7 +363,27 @@ List available tasks and exit + + =item B<--no-category>=I<CATEGORY> + +-Do not list given category items in inventory. ++Do not list given category items in inventory. It can be: ++ ++=over 4 ++ ++=item ++ ++printer ++ ++=item ++ ++software ++ ++=item ++ ++environment ++ ++=item ++ ++process ++ ++=back + + =item B<--scan-homedirs> + +diff --git a/fusioninventory-injector b/fusioninventory-injector +index db01136..57e290d 100755 +--- a/fusioninventory-injector ++++ b/fusioninventory-injector +@@ -24,33 +24,66 @@ my %options = ( + useragent => 'FusionInventory-Injector' + ); + ++GetOptions( ++ \%options, ++ 'help|h', ++ 'directory|d=s', ++ 'file|f=s', ++ 'url|u=s', ++ 'useragent=s', ++ 'remove|r', ++ 'verbose|v', ++ 'stdin', ++); ++ ++$OUTPUT_AUTOFLUSH = 1; ++pod2usage() if $options{help}; ++ ++if ($options{stdin}) { ++ loadstdin(); ++} elsif ($options{file}) { ++ die "file $options{file} does not exist" ++ unless -f $options{file}; ++ loadfile($options{file}); ++} elsif ($options{directory}) { ++ die "directory $options{directory} does not exist" ++ unless -d $options{directory}; ++ loaddirectory($options{directory}); ++} else { ++ pod2usage(); ++} ++ + sub loadfile { +- my $file = shift; ++ my ($file) = @_; + + die "can't read file $file" unless -r $file; + + print "Loading $file..." if $options{verbose}; + +- open (my $fh, '<', $file) or die "can't open file $file: $ERRNO"; ++ open (my $handle, '<', $file) or die "can't open file $file: $ERRNO\n"; + ## no critic (ProhibitBitwise) +- flock ($fh, LOCK_EX | LOCK_NB) or die "can't lock file $file: $ERRNO"; ++ flock ($handle, LOCK_EX | LOCK_NB) or die "can't lock file $file: $ERRNO\n"; + local $RS; +- my $content = <$fh>; +- close $fh or die "Can't close file $file: $ERRNO"; ++ my $content = <$handle>; ++ close $handle or die "Can't close file $file: $ERRNO\n"; + +- sendContent($content); ++ my $success = sendContent($content); ++ if ($success && $options{remove}) { ++ unlink $file or warn "Can't remove $file: $ERRNO\n" ++ } + } + + sub loaddirectory { +- my $directory = shift; ++ my ($directory) = @_; + + die "can't read directory $directory" unless -r $directory; + +- opendir (my $dh, $directory) or die "can't open directory $directory: $ERRNO"; +- foreach ( readdir($dh) ) { +- loadfile("$directory/$_") if (/\.ocs$/); ++ opendir (my $handle, $directory) ++ or die "can't open directory $directory: $ERRNO\n"; ++ foreach my $file (readdir($handle)) { ++ loadfile("$directory/$file") if $file =~ /\.ocs$/; + } +- closedir $dh; ++ closedir $handle; + } + + sub loadstdin { +@@ -76,47 +109,14 @@ sub sendContent { + $request->content(compress($content)); + my $res = $ua->request($request); + +- if ($res->is_success()) { +- print "OK\n" if $options{verbose}; +- print STDERR "Can't remove $options{file}: $ERRNO\n" +- if ($options{remove} && (!unlink $options{file})); +- } else { +- if ($options{verbose}) { +- print "ERROR: "; +- print $res->status_line(), "\n"; +- } ++ if ($options{verbose}) { ++ print $res->is_success() ? ++ "OK\n" : "ERROR: " . $res->status_line() . "\n"; + } +-} +- +-GetOptions( +- \%options, +- 'help|h', +- 'directory|d=s', +- 'file|f=s', +- 'url|u=s', +- 'useragent=s', +- 'remove|r', +- 'verbose|v', +- 'stdin', +-); +- +-$OUTPUT_AUTOFLUSH = 1; +-pod2usage() if $options{help}; + +-if ($options{file}) { +- die "file $options{file} does not exist" unless -f $options{file}; +- loadfile($options{file}); +-} elsif ($options{stdin}) { +- loadstdin(); +-} elsif ($options{directory}) { +- die "directory $options{directory} does not exist" unless -d $options{directory}; +- loaddirectory($options{directory}); +-} else { +- pod2usage(); ++ return $res->is_success(); + } + +-exit(0); +- + __END__ + + =head1 NAME +@@ -125,7 +125,7 @@ fusioninventory-injector - A tool to push inventory in an OCS Inventory or compa + + =head1 SYNOPSIS + +-fusioninventory-injector [options] [--file <file>|--directory <directory|--stdin] ++fusioninventory-injector [options] [--file <file>|--directory <directory>|--stdin] + + Options: + -h --help this menu +diff --git a/lib/FusionInventory/Agent.pm b/lib/FusionInventory/Agent.pm +index 03bf240..3234ddf 100644 +--- a/lib/FusionInventory/Agent.pm ++++ b/lib/FusionInventory/Agent.pm +@@ -22,7 +22,7 @@ use FusionInventory::Agent::Tools; + use FusionInventory::Agent::Tools::Hostname; + use FusionInventory::Agent::XML::Query::Prolog; + +-our $VERSION = '2.2.3'; ++our $VERSION = '2.2.7'; + our $VERSION_STRING = + "FusionInventory unified agent for UNIX, Linux and MacOSX ($VERSION)"; + our $AGENT_STRING = +@@ -143,8 +143,17 @@ sub init { + $logger->error("Can't load Proc::Daemon. Is the module installed?"); + exit 1; + } ++ ++ my $cwd = getcwd(); + Proc::Daemon::Init(); + $logger->debug("Daemon started"); ++ ++ ++ # If we use relative path, we must stay in the current directory ++ if (substr( $params{libdir}, 0, 1 ) ne '/') { ++ chdir($cwd); ++ } ++ + if ($self->_isAlreadyRunning()) { + $logger->debug("An agent is already runnnig, exiting..."); + exit 1; +@@ -520,6 +529,6 @@ Get all available tasks found on the system, as a list of module / version + pairs: + + %tasks = ( +- 'FusionInventory::Agent::Task::Foo' => x, +- 'FusionInventory::Agent::Task::Bar' => y, ++ 'Foo' => x, ++ 'Bar' => y, + ); +diff --git a/lib/FusionInventory/Agent/Config.pm b/lib/FusionInventory/Agent/Config.pm +index f4a910b..4eb28f2 100644 +--- a/lib/FusionInventory/Agent/Config.pm ++++ b/lib/FusionInventory/Agent/Config.pm +@@ -15,6 +15,9 @@ my $default = { + 'backend-collect-timeout' => 30, + 'httpd-port' => 62354, + 'timeout' => 180, ++ # multi-values options that will be converted to array ref ++ 'no-task' => "", ++ 'no-category' => "" + }; + + my $deprecated = { +@@ -50,31 +53,31 @@ my $deprecated = { + }, + 'no-inventory' => { + message => 'use --no-task inventory option instead', +- new => { 'no-task' => 'inventory' } ++ new => { 'no-task' => '+inventory' } + }, + 'no-wakeonlan' => { + message => 'use --no-task wakeonlan option instead', +- new => { 'no-task' => 'wakeonlan' } ++ new => { 'no-task' => '+wakeonlan' } + }, + 'no-netdiscovery' => { + message => 'use --no-task netdiscovery option instead', +- new => { 'no-task' => 'netdiscovery' } ++ new => { 'no-task' => '+netdiscovery' } + }, + 'no-snmpquery' => { + message => 'use --no-task snmpquery option instead', +- new => { 'no-task' => 'snmpquery' } ++ new => { 'no-task' => '+snmpquery' } + }, + 'no-ocsdeploy' => { + message => 'use --no-task ocsdeploy option instead', +- new => { 'no-task' => 'ocsdeploy' } ++ new => { 'no-task' => '+ocsdeploy' } + }, + 'no-printer' => { + message => 'use --no-category printer option instead', +- new => { 'no-category' => 'printer' } ++ new => { 'no-category' => '+printer' } + }, + 'no-software' => { + message => 'use --no-category software option instead', +- new => { 'no-category' => 'software' } ++ new => { 'no-category' => '+software' } + }, + }; + +@@ -84,7 +87,6 @@ sub new { + my $self = {}; + bless $self, $class; + $self->_loadDefaults(); +- + my $backend = + $params{options}->{'conf-file'} ? 'file' : + $params{options}->{config} ? $params{options}->{config} : +@@ -160,7 +162,6 @@ sub _loadFromRegistry { + + sub _loadFromFile { + my ($self, $params) = @_; +- + my $file = $params->{file} ? + $params->{file} : $params->{directory} . '/agent.cfg'; + +@@ -207,6 +208,8 @@ sub _checkContent { + foreach my $old (keys %$deprecated) { + next unless defined $self->{$old}; + ++ next if $old =~ /^no-/ and !$self->{$old}; ++ + my $handler = $deprecated->{$old}; + + # notify user of deprecation +@@ -215,19 +218,25 @@ sub _checkContent { + # transfer the value to the new option, if possible + if ($handler->{new}) { + if (ref $handler->{new} eq 'HASH') { +- # list of new options with new values ++ # old boolean option replaced by new non-boolean options + foreach my $key (keys %{$handler->{new}}) { +- $self->{$key} = $self->{$key} ? +- $self->{$key} . ',' . $handler->{new}->{$key} : +- $handler->{new}->{$key}; ++ my $value = $handler->{new}->{$key}; ++ if ($value =~ /^\+(\S+)/) { ++ # multiple values: add it to exiting one ++ $self->{$key} = $self->{$key} ? ++ $self->{$key} . ',' . $1 : $1; ++ } else { ++ # unique value: replace exiting value ++ $self->{$key} = $value; ++ } + } + } elsif (ref $handler->{new} eq 'ARRAY') { +- # list of new options, with same value ++ # old boolean option replaced by new boolean options + foreach my $new (@{$handler->{new}}) { + $self->{$new} = $self->{$old}; + } + } else { +- # new option, with same value ++ # old non-boolean option replaced by new option + $self->{$handler->{new}} = $self->{$old}; + } + } +@@ -244,10 +253,8 @@ sub _checkContent { + # multi-values options + $self->{logger} = [ split(/,/, $self->{logger}) ] if $self->{logger}; + $self->{server} = [ split(/,/, $self->{server}) ] if $self->{server}; +- $self->{'no-task'} = [ split(/,/, $self->{'no-task'}) ] +- if $self->{'no-task'}; +- $self->{'no-category'} = [ split(/,/, $self->{'no-category'}) ] +- if $self->{'no-category'}; ++ $self->{'no-task'} = [ split(/,/, $self->{'no-task'}) ]; ++ $self->{'no-category'} = [ split(/,/, $self->{'no-category'}) ]; + + # files location + $self->{'ca-cert-file'} = +diff --git a/lib/FusionInventory/Agent/Logger/File.pm b/lib/FusionInventory/Agent/Logger/File.pm +index f0b8cb7..1102245 100644 +--- a/lib/FusionInventory/Agent/Logger/File.pm ++++ b/lib/FusionInventory/Agent/Logger/File.pm +@@ -36,23 +36,30 @@ sub addMessage { + } + + my $handle; +- if (open $handle, '>>', $self->{logfile}) { ++ if (!open $handle, '>>', $self->{logfile}) { ++ die "can't open $self->{logfile}: $ERRNO"; ++ } + +- # get an exclusive lock on log file +- flock($handle, LOCK_EX) +- or die "can't get an exclusive lock on $self->{logfile}: $ERRNO"; ++ my $locked; ++ my $retryTill = time + 60; + +- print {$handle} +- "[". localtime() ."]" . +- "[$level]" . +- " $message\n"; ++ while ($retryTill > time && !$locked) { ++ # get an exclusive lock on log file ++ $locked = 1 if flock($handle, LOCK_EX|LOCK_NB); ++ } + +- # closing handle release the lock automatically +- close $handle; +- } else { +- die "can't open $self->{logfile}: $ERRNO"; ++ if (!$locked) { ++ die "can't get an exclusive lock on $self->{logfile}: $ERRNO"; + } + ++ print {$handle} ++ "[". localtime() ."]" . ++ "[$level]" . ++ " $message\n"; ++ ++ # closing handle release the lock automatically ++ close $handle; ++ + } + + 1; +diff --git a/lib/FusionInventory/Agent/Storage.pm b/lib/FusionInventory/Agent/Storage.pm +index b38df9f..63b140c 100644 +--- a/lib/FusionInventory/Agent/Storage.pm ++++ b/lib/FusionInventory/Agent/Storage.pm +@@ -15,13 +15,14 @@ sub new { + my ($class, %params) = @_; + + die "no directory parameter" unless $params{directory}; +- + if (!-d $params{directory}) { +- mkpath($params{directory}, {error => \my $err}); +- if (@$err) { +- my (undef, $message) = %{$err->[0]}; +- die "Can't create $params{directory}: $message"; +- } ++ # {error => \my $err} is not supported on RHEL 5, ++ # we let mkpath call die() itself ++ # http://forge.fusioninventory.org/issues/1817 ++ eval { ++ mkpath($params{directory}); ++ }; ++ die "Can't create $params{directory}: $EVAL_ERROR" if $EVAL_ERROR; + } + + if (! -w $params{directory}) { +diff --git a/lib/FusionInventory/Agent/Target.pm b/lib/FusionInventory/Agent/Target.pm +index 710df8d..db61331 100644 +--- a/lib/FusionInventory/Agent/Target.pm ++++ b/lib/FusionInventory/Agent/Target.pm +@@ -122,7 +122,7 @@ sub _computeNextRunDate { + + my $ret; + if ($self->{initialDelay}) { +- $ret = time + $self->{initialDelay}; ++ $ret = time + ($self->{initialDelay} / 2) + int rand($self->{initialDelay} / 2); + $self->{initialDelay} = undef; + } else { + $ret = +diff --git a/lib/FusionInventory/Agent/Task/Inventory.pm b/lib/FusionInventory/Agent/Task/Inventory.pm +index 13dc0b0..2cd774a 100644 +--- a/lib/FusionInventory/Agent/Task/Inventory.pm ++++ b/lib/FusionInventory/Agent/Task/Inventory.pm +@@ -61,10 +61,11 @@ sub run { + } + + if (not $ENV{PATH}) { +- # set a minimal PATH if none is set (#1129) +- $ENV{PATH} = '/sbin:/usr/sbin:/bin:/usr/bin'; ++ # set a minimal PATH if none is set (#1129, #1747) ++ $ENV{PATH} = ++ '/sbin:/usr/sbin:/usr/local/sbin:/bin:/usr/bin:/usr/local/bin'; + $self->{logger}->debug( +- "PATH is not set, using /sbin:/usr/sbin:/bin:/usr/bin as default" ++ "PATH is not set, using $ENV{PATH} as default" + ); + } + +diff --git a/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Dmidecode.pm b/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Dmidecode.pm +index 57ed095..c0ccc71 100644 +--- a/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Dmidecode.pm ++++ b/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Dmidecode.pm +@@ -6,27 +6,12 @@ use warnings; + use English qw(-no_match_vars); + use UNIVERSAL::require; + +-use FusionInventory::Agent::Tools; ++use FusionInventory::Agent::Tools::Generic; + + sub isEnabled { + +- if ($OSNAME eq 'MSWin32') { +- # don't run dmidecode on Win2003 +- # http://forge.fusioninventory.org/issues/379 +- Win32->require(); +- my @osver = Win32::GetOSVersion(); +- return if +- $osver[4] == 2 && +- $osver[1] == 5 && +- $osver[2] == 2; +- } +- +- return unless canRun('dmidecode'); +- +- my $count = getLinesCount( +- command => "dmidecode" +- ); +- return $count > 10; ++ return unless getDmidecodeInfos(); ++ + } + + sub doInventory {} +diff --git a/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Dmidecode/Battery.pm b/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Dmidecode/Battery.pm +index 0634a20..b1465bc 100644 +--- a/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Dmidecode/Battery.pm ++++ b/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Dmidecode/Battery.pm +@@ -36,12 +36,16 @@ sub _getBattery { + my $battery = { + NAME => $info->{'Name'}, + MANUFACTURER => $info->{'Manufacturer'}, +- SERIAL => $info->{'Serial Number'}, +- CHEMISTRY => $info->{'Chemistry'}, ++ SERIAL => $info->{'Serial Number'} || ++ $info->{'SBDS Serial Number'}, ++ CHEMISTRY => $info->{'Chemistry'} || ++ $info->{'SBDS Chemistry'}, + }; + +- if ($info->{'Manufacture Date'}) { ++ if ($info->{'Manufacture Date'}) { + $battery->{DATE} = _parseDate($info->{'Manufacture Date'}); ++ } elsif ($info->{'SBDS Manufacture Date'}) { ++ $battery->{DATE} = _parseDate($info->{'SBDS Manufacture Date'}); + } + + if ($info->{'Design Capacity'} && +diff --git a/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Screen.pm b/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Screen.pm +index 0991f88..a9590e2 100644 +--- a/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Screen.pm ++++ b/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Screen.pm +@@ -30,22 +30,18 @@ sub doInventory { + foreach my $screen (_getScreens($logger)) { + + if ($screen->{edid}) { +- my $edid = parseEdid($screen->{edid}); +- if (my $err = checkParsedEdid($edid)) { +- $logger->debug("check failed: bad edid: $err"); +- } else { +- $screen->{CAPTION} = +- $edid->{monitor_name}; +- $screen->{DESCRIPTION} = +- $edid->{week} . "/" . $edid->{year}; +- $screen->{MANUFACTURER} = +- getManufacturerFromCode($edid->{manufacturer_name}); +- $screen->{SERIAL} = $edid->{serial_number2}->[0]; +- } ++ my $info = _getEdidInfo($screen->{edid}, $logger); ++ $screen->{CAPTION} = $info->{CAPTION}; ++ $screen->{DESCRIPTION} = $info->{DESCRIPTION}; ++ $screen->{MANUFACTURER} = $info->{MANUFACTURER}; ++ $screen->{SERIAL} = $info->{SERIAL}; ++ + $screen->{BASE64} = encode_base64($screen->{edid}); ++ } + ++ if (defined($screen->{edid})) { ++ delete $screen->{edid}; + } +- delete $screen->{edid}; + + $inventory->addEntry( + section => 'MONITORS', +@@ -54,6 +50,61 @@ sub doInventory { + } + } + ++sub _getEdidInfo { ++ my ($raw_edid, $logger) = @_; ++ ++ my $edid = parseEdid($raw_edid); ++ if (my $error = checkParsedEdid($edid)) { ++ $logger->debug("bad edid: $error"); ++ return; ++ } ++ ++ my $info = { ++ CAPTION => $edid->{monitor_name}, ++ DESCRIPTION => $edid->{week} . "/" . $edid->{year}, ++ MANUFACTURER => getManufacturerFromCode($edid->{manufacturer_name}) || ++ $edid->{manufacturer_name} ++ }; ++ ++ # they are two different serial numbers in EDID ++ # - a mandatory 4 bytes numeric value ++ # - an optional 13 bytes ASCII value ++ # we use the ASCII value if present, the numeric value as an hex string ++ # unless for a few list of known exceptions deserving specific handling ++ # References: ++ # http://forge.fusioninventory.org/issues/1607 ++ # http://forge.fusioninventory.org/issues/1614 ++ if ( ++ $edid->{EISA_ID} && ++ $edid->{EISA_ID} =~ /^ACR(0018|0020|0024|00A8|7883|ad49|adaf)$/ ++ ) { ++ $info->{SERIAL} = ++ substr($edid->{serial_number2}->[0], 0, 8) . ++ sprintf("%08x", $edid->{serial_number}) . ++ substr($edid->{serial_number2}->[0], 8, 4) ; ++ } elsif ( ++ $edid->{EISA_ID} && ++ $edid->{EISA_ID} eq 'GSM4b21' ++ ) { ++ # split serial in two parts ++ my ($high, $low) = $edid->{serial_number} =~ /(\d+) (\d\d\d)$/x; ++ ++ # translate the first part using a custom alphabet ++ my @alphabet = split(//, "0123456789ABCDEFGHJKLMNPQRSTUVWXYZ"); ++ my $base = scalar @alphabet; ++ ++ $info->{SERIAL} = ++ $alphabet[$high / $base] . $alphabet[$high % $base] . ++ $low; ++ } else { ++ $info->{SERIAL} = $edid->{serial_number2} ? ++ $edid->{serial_number2}->[0] : ++ sprintf("%08x", $edid->{serial_number}); ++ } ++ ++ return $info; ++} ++ + sub _getScreensFromWindows { + my ($logger) = @_; + +@@ -117,25 +168,23 @@ sub _getScreensFromUnix { + + my @screens; + +- if (-d '/sys') { ++ if (-d '/sys/devices') { + my $wanted = sub { +- return unless $File::Find::name =~ m{/edid$}; +- open my $handle, '<', $File::Find::name; +- my $edid = <$handle>; +- close $handle; +- ++ return unless $_ eq 'edid'; ++ return unless -s $File::Find::name; ++ my $edid = getAllLines(file => $File::Find::name); + push @screens, { edid => $edid } if $edid; + }; + + no warnings 'File::Find'; +- File::Find::find($wanted, '/sys'); ++ File::Find::find($wanted, '/sys/devices'); + + return @screens if @screens; + } + + my $edid = +- getFirstLine(command => 'monitor-get-edid-using-vbe') || +- getFirstLine(command => 'monitor-get-edid'); ++ getAllLines(command => 'monitor-get-edid-using-vbe') || ++ getAllLines(command => 'monitor-get-edid'); + push @screens, { edid => $edid }; + + return @screens if @screens; +diff --git a/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Storages/HP.pm b/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Storages/HP.pm +index ce1818f..8a161d1 100644 +--- a/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Storages/HP.pm ++++ b/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Storages/HP.pm +@@ -55,103 +55,93 @@ sub doInventory { + my $inventory = $params{inventory}; + my $logger = $params{logger}; + +- my ($serialnumber, $model, $capacity, $firmware, $description, $media, $manufacturer); +- +- my $hpacuacliPath = canRun('hpacucli') ? ++ my $path = canRun('hpacucli') ? + "hpacucli": + _getHpacuacliFromWinRegistry($logger); + +- my $handle1 = getFileHandle( +- logger => $logger, +- command => "$hpacuacliPath ctrl all show" +- ); ++ foreach my $slot (_getSlots(path => $path)) { ++ foreach my $drive (_getDrives(path => $path, slot => $slot)) { + +- return unless $handle1; ++ $inventory->addEntry( ++ section => 'STORAGES', ++ entry => _getStorage( ++ path => $path, slot => $slot, drive => $drive ++ ) ++ ); ++ } ++ } ++} + +-# Example output : +-# +-# Smart Array E200 in Slot 2 (sn: PA6C90K9SUH1ZA) +- while (my $line1 = <$handle1>) { +- next unless $line1 =~ /Slot\s(\d*)/; ++sub _getSlots { ++ my %params = @_; + +- my $slot = $1; +- my $handle2 = getFileHandle( +- logger => $logger, +- command => "$hpacuacliPath ctrl slot=$slot pd all show" +- ); +- next unless $handle2; ++ my $command = $params{path} ? ++ "%params{path} ctrl all show" : undef; ++ my $handle = getFileHandle(%params, command => $command); ++ return unless $handle; + +-# Example output : +-# +-# Smart Array E200 in Slot 2 +-# +-# array A +-# +-# physicaldrive 2I:1:1 (port 2I:box 1:bay 1, SATA, 74.3 GB, OK) +-# physicaldrive 2I:1:2 (port 2I:box 1:bay 2, SATA, 74.3 GB, OK) +- while (my $line2 = <$handle2>) { +- next unless $line2 =~ /physicaldrive\s(\S*)/; +- +- my $pd = $1; +- my $handle3 = getFileHandle( +- logger => $logger, +- command => "$hpacuacliPath ctrl slot=$slot pd $pd show" +- ); +- next unless $handle3; ++ my @slots; ++ while (my $line = <$handle>) { ++ next unless $line =~ /Slot (\d+)/; ++ push @slots, $1; ++ } ++ close $handle; + +-# Example output : +-# +-# Smart Array E200 in Slot 2 +-# +-# array A +-# +-# physicaldrive 1:1 +-# Port: 2I +-# Box: 1 +-# Bay: 1 +-# Status: OK +-# Drive Type: Data Drive +-# Interface Type: SATA +-# Size: 74.3 GB +-# Firmware Revision: 21.07QR4 +-# Serial Number: WD-WMANS1732855 +-# Model: ATA WDC WD740ADFD-00 +-# SATA NCQ Capable: False +-# PHY Count: 1 +- while (my $line3 = <$handle3>) { +- $model = $1 if $line3 =~ /Model:\s(.*)/; +- $description = $1 if $line3 =~ /Interface Type:\s(.*)/; +- $media = $1 if $line3 =~ /Drive Type:\s(.*)/; +- $capacity = 1000*$1 if $line3 =~ /Size:\s(.*)/; +- $serialnumber = $1 if $line3 =~ /Serial Number:\s(.*)/; +- $firmware = $1 if $line3 =~ /Firmware Revision:\s(.*)/; +- } +- close $handle3; +- $serialnumber =~ s/^\s+//; +- $model =~ s/^ATA\s+//; # ex: ATA WDC WD740ADFD-00 +- $model =~ s/\s+/ /; +- $manufacturer = getCanonicalManufacturer($model); +- if ($media eq 'Data Drive') { +- $media = 'disk'; +- } ++ return @slots; ++} + +- $inventory->addEntry( +- section => 'STORAGES', +- entry => { +- NAME => $model, +- MANUFACTURER => $manufacturer, +- MODEL => $model, +- DESCRIPTION => $description, +- TYPE => $media, +- DISKSIZE => $capacity, +- SERIALNUMBER => $serialnumber, +- FIRMWARE => $firmware +- } +- ); +- } +- close $handle2; ++sub _getDrives { ++ my %params = @_; ++ ++ my $command = $params{path} && $params{slot} ? ++ "%params{path} ctrl slot=$params{slot} pd all show" : undef; ++ my $handle = getFileHandle(%params, command => $command); ++ next unless $handle; ++ ++ my @drives; ++ while (my $line = <$handle>) { ++ next unless $line =~ /physicaldrive (\S+)/; ++ push @drives, $1; ++ } ++ close $handle; ++ ++ return @drives; ++} ++ ++sub _getStorage { ++ my %params = @_; ++ ++ my $command = $params{path} && $params{slot} && $params{drive} ? ++ "%params{path} ctrl slot=$params{slot} pd $params{drive} show" : undef; ++ my $handle = getFileHandle(%params, command => $command); ++ next unless $handle; ++ ++ my %data; ++ while (my $line = <$handle>) { ++ next unless $line =~ /(\S[^:]+) : \s+ (.+)/x; ++ $data{$1} = $2; + } +- close $handle1; ++ close $handle; ++ ++ my $storage = { ++ DESCRIPTION => $data{'Interface Type'}, ++ SERIALNUMBER => $data{'Serial Number'}, ++ FIRMWARE => $data{'Firmware Revision'} ++ }; ++ ++ my $model = $data{'Model'}; ++ $model =~ s/^ATA\s+//; # ex: ATA WDC WD740ADFD-00 ++ $model =~ s/\s+/ /; ++ $storage->{NAME} = $model; ++ $storage->{MODEL} = $model; ++ ++ $storage->{MANUFACTURER} = getCanonicalManufacturer($model); ++ $storage->{DISKSIZE} = getCanonicalSize($data{'Size'}); ++ ++ $storage->{TYPE} = $data{'Drive Type'} eq 'Data Drive' ? ++ 'disk' : $data{'Drive Type'}; ++ ++ return $storage; + } + + 1; +diff --git a/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/LVM.pm b/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/LVM.pm +index d4bf1a8..d775a80 100644 +--- a/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/LVM.pm ++++ b/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/LVM.pm +@@ -71,6 +71,11 @@ sub _getPhysicalVolumes { + while (my $line = <$handle>) { + my @infos = split(/\s+/, $line); + ++ my $pe_size; ++ if ($infos[7] && $infos[7]>0) { ++ $pe_size = int($infos[4] / $infos[7]); ++ } ++ + push @volumes, { + DEVICE => $infos[1], + FORMAT => $infos[2], +@@ -79,7 +84,7 @@ sub _getPhysicalVolumes { + FREE => int($infos[5]||0), + PV_UUID => $infos[6], + PV_PE_COUNT => $infos[7], +- PE_SIZE => int($infos[4] / $infos[7]), ++ PE_SIZE => $pe_size, + VG_UUID => $infos[8] + }; + } +diff --git a/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages.pm b/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages.pm +index 1b01862..bd1bb68 100644 +--- a/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages.pm ++++ b/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages.pm +@@ -37,7 +37,8 @@ sub doInventory { + } + } + +- # fallback on sysfs if udev didn't worked ++ # fallback on sysfs if /dev/.udev is not available. That's the ++ # case on any up to date Linux system + if (!@devices) { + @devices = getDevicesFromProc(logger => $logger); + } +diff --git a/lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Qemu.pm b/lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Qemu.pm +index 6c333ff..e0052c3 100644 +--- a/lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Qemu.pm ++++ b/lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Qemu.pm +@@ -28,7 +28,7 @@ sub doInventory { + )) { + # match only if an qemu instance + next unless +- $process->{CMD} =~ /(qemu|kvm|qemu-kvm) .* -([fhsv]d[a-d]|cdrom)/x; ++ $process->{CMD} =~ /(qemu|kvm|qemu-kvm) .* -([fhsv]d[a-z]|cdrom|drive)/x; + + my $name; + my $mem = 0; +diff --git a/lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Vmsystem.pm b/lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Vmsystem.pm +index 9f5bd60..8416eb4 100644 +--- a/lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Vmsystem.pm ++++ b/lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Vmsystem.pm +@@ -191,8 +191,8 @@ sub _getStatus { + logger => $logger + ); + while (my $line = <$handle>) { +- my ( $varID, $varValue ) = split( ":", $line ); +- $result = "Virtuozzo" if ( $varID eq 'envID' && $varValue > 0 ); ++ my ($key, $value) = split(/:/, $line); ++ $result = "Virtuozzo" if $key eq 'envID' && $value > 0; + } + } + return $result if $result; +diff --git a/lib/FusionInventory/Agent/Task/Inventory/Inventory.pm b/lib/FusionInventory/Agent/Task/Inventory/Inventory.pm +index 17479c9..b755cb6 100644 +--- a/lib/FusionInventory/Agent/Task/Inventory/Inventory.pm ++++ b/lib/FusionInventory/Agent/Task/Inventory/Inventory.pm +@@ -354,6 +354,9 @@ sub computeChecksum { + $self->{last_state_content} = XML::TreePP->new()->parsefile( + $self->{last_state_file} + ); ++ }; ++ if (ref($self->{last_state_content}) ne 'HASH') { ++ $self->{last_state_file} = {}; + } + } else { + $logger->debug( +@@ -530,7 +533,7 @@ System Serial number + + =item BDATE + +-BIOS release date ++BIOS release date in the Month/Day/Year format (e.g: 09/27/2010) + + =item BVERSION + +diff --git a/lib/FusionInventory/Agent/Task/WakeOnLan.pm b/lib/FusionInventory/Agent/Task/WakeOnLan.pm +index fc35b51..106b1b1 100644 +--- a/lib/FusionInventory/Agent/Task/WakeOnLan.pm ++++ b/lib/FusionInventory/Agent/Task/WakeOnLan.pm +@@ -9,6 +9,7 @@ use constant PF_PACKET => 17; + use constant SOCK_PACKET => 10; + + use English qw(-no_match_vars); ++use List::Util qw(first); + use Socket; + + use FusionInventory::Agent::Tools; +@@ -85,6 +86,8 @@ sub run { + # degraded WOL by UDP + eval { + socket(SOCKET, PF_INET, SOCK_DGRAM, getprotobyname('udp')); ++ setsockopt(SOCKET, SOL_SOCKET, SO_BROADCAST, 1) ++ or warn "Can't do setsockopt: $ERRNO\n"; + my $magic_packet = + chr(0xFF) x 6 . + (pack('H12', $target) x 16); +diff --git a/lib/FusionInventory/Agent/Tools.pm b/lib/FusionInventory/Agent/Tools.pm +index c507bc3..39a206b 100644 +--- a/lib/FusionInventory/Agent/Tools.pm ++++ b/lib/FusionInventory/Agent/Tools.pm +@@ -57,6 +57,8 @@ if ($OSNAME ne 'MSWin32') { + sub getFormatedLocalTime { + my ($time) = @_; + ++ return unless $time; ++ + my ($year, $month , $day, $hour, $min, $sec) = + (localtime ($time))[5, 4, 3, 2, 1, 0]; + +@@ -357,7 +359,8 @@ sub hex2char { + return undef unless $value; + return $value unless $value =~ /^0x/; + +- $value =~ s/^0x//; ++ $value =~ s/^0x//; # drop hex prefix ++ $value =~ s/00$//; # drop trailing null-character + $value =~ s/(\w{2})/chr(hex($1))/eg; + + return $value; +@@ -571,8 +574,9 @@ of line removed. + + =head2 getAllLines(%params) + +-Returns all the lines of given command output or given file content, with end +-of line removed. ++Returns all the lines of given command output or given file content, as a list ++of strings with end of line removed in list context, as a single string ++otherwise. + + =over + +diff --git a/lib/FusionInventory/Agent/Tools/Generic.pm b/lib/FusionInventory/Agent/Tools/Generic.pm +index 840e68c..37532af 100644 +--- a/lib/FusionInventory/Agent/Tools/Generic.pm ++++ b/lib/FusionInventory/Agent/Tools/Generic.pm +@@ -24,8 +24,18 @@ sub getDmidecodeInfos { + @_ + ); + +- my $handle = getFileHandle(%params); ++ if ($OSNAME eq 'MSWin32') { ++ # don't run dmidecode on Win2003 ++ # http://forge.fusioninventory.org/issues/379 ++ Win32->require(); ++ my @osver = Win32::GetOSVersion(); ++ return if ++ $osver[4] == 2 && ++ $osver[1] == 5 && ++ $osver[2] == 2; ++ } + ++ my $handle = getFileHandle(%params); + my ($info, $block, $type); + + while (my $line = <$handle>) { +@@ -59,6 +69,9 @@ sub getDmidecodeInfos { + } + close $handle; + ++ # do not return anything if dmidecode output is obviously truncated ++ return if keys %$info < 2; ++ + return $info; + } + +diff --git a/lib/FusionInventory/Agent/Tools/Linux.pm b/lib/FusionInventory/Agent/Tools/Linux.pm +index 228d81a..ed1626e 100644 +--- a/lib/FusionInventory/Agent/Tools/Linux.pm ++++ b/lib/FusionInventory/Agent/Tools/Linux.pm +@@ -41,7 +41,7 @@ sub getDevicesFromUdev { + } + + foreach my $device (@devices) { +- next if $device->{TYPE} eq 'cd'; ++ next if $device->{TYPE} && $device->{TYPE} eq 'cd'; + $device->{DISKSIZE} = getDeviceCapacity(device => '/dev/' . $device->{NAME}) + } + +@@ -297,28 +297,61 @@ sub getInterfacesFromIfconfig { + next; + } + +- if ($line =~ /^(\S+)/) { ++ if ($line =~ /^([\w\d.]+)/) { + # new interface ++ + $interface = { + STATUS => 'Down', + DESCRIPTION => $1 + } ++ ++ } ++ if ($line =~ / ++ inet \s ($ip_address_pattern) \s+ ++ netmask \s ($ip_address_pattern) \s+ ++ broadcast \s $ip_address_pattern ++ /x) { ++ $interface->{IPADDRESS} = $1; ++ $interface->{IPMASK} = $2; ++ } ++ ++ if ($line =~ / ++ ether \s ($mac_address_pattern) ++ .+ ++ \( ([^)]+) \) ++ /x) { ++ $interface->{MACADDR} = $1; ++ $interface->{TYPE} = $2; ++ } ++ ++ if ($line =~ /inet6 \s (\S+)/x) { ++ $interface->{IPADDRESS6} = $1; + } ++ + if ($line =~ /inet addr:($ip_address_pattern)/i) { + $interface->{IPADDRESS} = $1; + } ++ + if ($line =~ /Mask:($ip_address_pattern)/) { + $interface->{IPMASK} = $1; + } ++ + if ($line =~ /inet6 addr: (\S+)/i) { + $interface->{IPADDRESS6} = $1; + } ++ + if ($line =~ /hwadd?r\s+($mac_address_pattern)/i) { + $interface->{MACADDR} = $1; + } ++ + if ($line =~ /^\s+UP\s/) { + $interface->{STATUS} = 'Up'; + } ++ ++ if ($line =~ /flags=.*[<,]UP[>,]/) { ++ $interface->{STATUS} = 'Up'; ++ } ++ + if ($line =~ /link encap:(\S+)/i) { + $interface->{TYPE} = $1; + } +@@ -411,7 +444,8 @@ This module provides some generic functions for Linux. + + =head2 getDevicesFromUdev(%params) + +-Returns a list of devices, by parsing udev database. ++Returns a list of devices, by parsing /dev/.udev directory. ++This directory is not exported anymore with recent udev. + + Availables parameters: + +diff --git a/lib/FusionInventory/Agent/Tools/Screen.pm b/lib/FusionInventory/Agent/Tools/Screen.pm +index 25111b8..16bb9a7 100644 +--- a/lib/FusionInventory/Agent/Tools/Screen.pm ++++ b/lib/FusionInventory/Agent/Tools/Screen.pm +@@ -450,7 +450,7 @@ sub parseEdid { + while (length($v) >= 18) { + (my $pixel_clock, my $vv, $v) = unpack("v a16 a*", $v); + last if !$pixel_clock; +- my $h = build_detailed_timing($pixel_clock, $vv); ++ my $h = _build_detailed_timing($pixel_clock, $vv); + push @{$edid{detailed_timings}}, $h + if $h->{horizontal_active} > 1 && $h->{vertical_active} > 1; + } +diff --git a/lib/FusionInventory/Agent/XML/Response.pm b/lib/FusionInventory/Agent/XML/Response.pm +index 3afcb0f..5f21bd6 100644 +--- a/lib/FusionInventory/Agent/XML/Response.pm ++++ b/lib/FusionInventory/Agent/XML/Response.pm +@@ -11,7 +11,7 @@ sub new { + + my $tpp = XML::TreePP->new( + force_array => [ qw/ +- OPTION PARAM MODEL AUTHENTICATION RANGEIP DEVICE ++ OPTION PARAM MODEL AUTHENTICATION RANGEIP DEVICE GET WALK + / ], + attr_prefix => '', + text_node_key => 'content' only in patch2: unchanged: --- fusioninventory-agent-2.2.3.orig/debian/patches/ssl_cert_backport.diff +++ fusioninventory-agent-2.2.3/debian/patches/ssl_cert_backport.diff @@ -0,0 +1,266 @@ +diff --git a/t/ssl/cnf/ca.cnf b/t/ssl/cnf/ca.cnf +index efd29d7..d9cd935 100644 +--- a/t/ssl/cnf/ca.cnf ++++ b/t/ssl/cnf/ca.cnf +@@ -21,7 +21,7 @@ authorityKeyIdentifier = keyid:always,issuer:always + default_ca = default_ca + + [ default_ca ] +-dir = t/ssl ++dir = . + certificate = $dir/crt/ca.pem + private_key = $dir/key/ca.pem + certs = $dir/crt # Where the issued certs are kept +@@ -31,7 +31,7 @@ database = $dir/index.txt # database index file. + new_certs_dir = $dir/new # default place for new certs. + crl_dir = $dir/crl # Where the issued crl are kept + +-default_days = 730 # how long to certify for ++default_days = 3650 # how long to certify for + default_crl_days= 30 # how long before next CRL + default_md = md5 # which md to use. + preserve = no # keep passed DN ordering +diff --git a/t/ssl/crt/good.pem b/t/ssl/crt/good.pem +index 90fe0bc..3e5a323 100644 +--- a/t/ssl/crt/good.pem ++++ b/t/ssl/crt/good.pem +@@ -2,69 +2,69 @@ Certificate: + Data: + Version: 1 (0x0) + Serial Number: 1 (0x1) +- Signature Algorithm: md5WithRSAEncryption ++ Signature Algorithm: md5WithRSAEncryption + Issuer: O=fusioninventory.org, OU=test certification authority, CN=test_ca/emailAddress=test@fusioninventory.org + Validity +- Not Before: Jul 29 20:21:23 2010 GMT +- Not After : Jul 28 20:21:23 2012 GMT ++ Not Before: Aug 1 15:43:22 2012 GMT ++ Not After : Jul 30 15:43:22 2022 GMT + Subject: O=fusioninventory.org, OU=trusted test certificate, CN=localhost/emailAddress=test@fusioninventory.org + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + Public-Key: (2048 bit) + Modulus: +- 00:b6:21:74:de:3d:8c:65:2a:8e:32:54:ca:6a:ab: +- f7:8c:2b:01:4d:b0:9a:39:1c:85:bd:26:5b:67:c4: +- b8:b0:26:73:59:e2:f0:4a:a1:0d:99:32:d0:54:18: +- ae:ae:f2:8e:42:ef:71:1a:3f:f9:1e:df:7f:81:4e: +- 7c:a3:53:e8:6d:b2:82:b0:76:d0:ea:f7:83:42:6a: +- 66:85:a3:98:69:b0:07:ea:38:b5:5d:62:9d:6f:b3: +- a1:64:39:c4:a3:94:c3:cb:fd:a7:d1:4a:01:ce:99: +- b6:dd:83:ed:29:48:96:63:09:9b:96:86:d6:6c:fa: +- 35:82:19:65:42:be:16:c0:65:ef:50:22:25:ad:2a: +- 9a:a3:21:e4:76:42:28:bb:7a:9b:4f:7d:11:78:5a: +- a6:04:fc:33:03:30:e9:6a:ae:f0:8c:d5:67:43:17: +- 07:06:43:d6:bc:f9:61:b3:68:a5:1c:04:c6:a7:93: +- 23:7b:fe:15:35:97:3c:60:0b:78:22:54:a6:3d:4c: +- 9d:52:3b:33:23:ad:c1:a7:08:24:0b:e5:5d:9c:cb: +- 39:18:68:b3:80:61:76:e3:6f:81:c8:0e:fa:b9:33: +- 36:56:a7:e8:43:10:a8:03:91:55:57:f2:73:ff:b2: +- ac:85:bc:0d:af:9e:fd:a4:fe:40:00:e8:9b:7f:d0: +- c4:53 ++ 00:c7:15:c2:3f:2d:59:57:04:a8:0f:e9:2d:49:59: ++ 3a:c6:5b:0e:36:c9:b5:8c:e7:7d:5e:2c:9f:7f:d9: ++ 66:41:71:4f:38:69:de:fb:62:ae:7f:3c:41:82:99: ++ 78:6c:fe:5c:ed:82:0d:a0:27:43:bd:6f:32:36:be: ++ 54:87:ae:a2:1a:21:d5:b3:58:cc:ff:63:65:ba:f2: ++ 10:5b:03:c8:51:77:37:20:a9:21:6d:d0:43:fc:89: ++ 9b:29:49:14:aa:46:9f:cf:0b:74:7a:c0:ea:af:b4: ++ eb:25:e7:b5:d4:35:57:65:ee:f5:db:a2:c3:94:5f: ++ cd:01:db:5a:14:4c:9c:a4:22:51:94:14:8c:8c:54: ++ fc:a5:a9:ca:93:09:5f:eb:e4:37:23:fb:1e:87:b4: ++ a5:8c:85:df:3e:16:78:a4:84:29:e0:3f:b8:db:c8: ++ b9:fd:2e:d2:b5:83:c4:dc:f6:8f:e4:80:2e:36:57: ++ f2:15:8c:bc:d1:96:ae:c6:04:37:03:6d:cc:a6:5c: ++ 00:8f:d8:48:4e:49:0e:62:cf:55:68:6c:30:37:8f: ++ 9e:30:ae:5c:5c:d9:77:45:35:49:68:08:65:f0:61: ++ 6a:77:3c:9e:e1:e0:73:74:a8:5d:69:44:18:cf:d3: ++ 63:17:76:80:e9:5f:63:33:dc:0e:cc:cf:a7:c6:be: ++ 29:81 + Exponent: 65537 (0x10001) + Signature Algorithm: md5WithRSAEncryption +- d0:91:39:7a:e6:d8:71:4c:ef:fc:a5:f9:bd:3d:e8:e7:3b:59: +- 83:ec:26:0a:67:ee:4a:7b:ca:0c:41:ed:a6:98:14:4a:06:09: +- f7:1c:76:e7:68:72:7e:10:e0:4e:f9:98:07:f1:10:86:2b:6c: +- 8d:53:c5:82:f0:f5:02:0b:a8:8d:44:b9:8d:0b:f7:7e:4e:11: +- dd:e6:2e:a0:37:e1:b9:16:1c:25:f5:29:52:31:8b:38:e2:89: +- db:49:89:2c:f0:35:a9:06:d7:b7:e5:70:9f:fa:27:a7:b2:ec: +- 3c:b8:bc:33:d8:f6:f3:7e:e9:80:73:e2:5c:99:a0:a5:ce:2e: +- 08:9c:2d:96:d8:2d:c9:38:4b:ed:76:7a:fa:fc:2f:ac:32:62: +- ba:16:e5:36:3a:ea:8b:22:1d:8c:fd:18:2c:c9:b2:83:91:5b: +- 61:9e:8e:11:a2:ab:ad:09:99:1e:00:56:37:d6:d3:e9:f3:97: +- d2:2a:65:41:a4:44:db:1b:e2:ae:51:69:f0:38:f9:29:4f:b0: +- 57:9b:60:3a:b1:aa:8d:8c:31:11:d9:64:12:8a:c0:ab:c4:5a: +- 02:08:3c:ef:2d:f2:14:67:ef:97:9a:d7:85:df:18:a1:47:15: +- cb:9c:f8:2b:1a:d9:c0:f5:b2:d1:58:66:a0:ef:df:44:6c:d7: +- ce:a6:59:bf ++ 45:a9:47:c1:9c:80:66:7c:47:92:e5:87:d5:69:d1:be:91:19: ++ ca:cd:1f:16:c9:7b:d8:45:7b:6b:f8:06:fb:d4:83:93:54:65: ++ 15:6f:0e:fb:d9:2e:1d:08:c5:37:d2:83:56:ab:6a:4e:24:27: ++ a5:e6:79:84:30:62:3f:16:b5:c1:13:83:6b:8e:04:d3:ac:f9: ++ 13:ec:bf:a5:e3:d7:89:c9:a6:17:bd:32:d1:0d:fc:c7:e0:c1: ++ 56:88:4c:f9:7f:ad:f9:10:21:1e:96:a9:43:77:00:68:61:8c: ++ ae:84:c8:20:30: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ADggEBAEWpR8GcgGZ8R5Llh9Vp0b6RGcrNHxbJe9hFe2v4BvvUg5NUZRVvDvvZ ++Lh0IxTfSg1arak4kJ6XmeYQwYj8WtcETg2uOBNOs+RPsv6Xj14nJphe9MtEN/Mfg ++wVaITPl/rfkQIR6WqUN3AGhhjK6EyCAwg1LEirIMnOZrHlxqWjwzQ83ISKJYn60Z ++kumNhTf+x+cj2U1HGBWApF/19gOu8omgYaXPbCSojBsBVYd+oQbOW146B8Iyz68Q ++cUarQIBO40Q/75ta9/f9OZ5dQJhEi9AdrNPAt4tIBNtOhRVt+ZpuHj72/FyosZk8 ++TF0Ll4dF/5j9mvhHv1FJlisLe+ic30A= + -----END CERTIFICATE----- +diff --git a/t/ssl/key/ca.pem b/t/ssl/key/ca.pem +index f131645..3caf2e4 100644 +--- a/t/ssl/key/ca.pem ++++ b/t/ssl/key/ca.pem +@@ -1,30 +1,27 @@ +------BEGIN ENCRYPTED PRIVATE KEY----- +-MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQIk1RxLj1MgGkCAggA +-MBQGCCqGSIb3DQMHBAibQ2NS4+8FHQSCBMiP9wNXU4tO44RNix6C3dUa3/P+fQ2N +-MvmGVJDmJDp3iq+RDKG8O29Qnv/h7/9L6cud8meQ56E4rrI9vw7Lmu325QSAfkqz +-xFnBpcJ1YufDfKcd8Asm+v/vpRYQw9pnkir0NLOhPAz1nwKbxV0sArDUBdwKpVbi +-0OXGg3XARIRrvdstIuaGIB5PApKAfNI++v60/8gA45Y6Nc6KwcezXcuvsLKH1tHz +-zy7ALZUXVQGhFXjL4ytHc21cHS3j/SpmYONSQei/w5xLG2w9G8KZ7/tL+7wPvrUZ +-mNAYh7PCf32n0IdxFA8lakktvZAgfGXp+6jIKJORAVnUWPPy0r8O5U2CdWY8yi45 +-lxVSIPLa/4QP9MTbdge9rvKi6T1cyr92c4nxkxwGWWAAnz42KTqn4TQ3pTnz7/pl +-qSAhAvK+7pPfXTx+s09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2r ++eohO89kR0sA0QjOqzkraGBP+J0yykMb1yAyTqn/ZcVm41Z7TimLBVpfTAoGBAPEL ++TrIlj9CqJtQhPk16nS1OnuIZ7D3ws3iJVFo+zeMKnqi1uAbh6ytFWVrDlbzstuq7 ++RvQnyoesAjIbILqxTrtMRId8gw/OIl31PY8cBvrHgglmJHB0vHdiqfcILm2kkBMv ++qxbczZozndRlPQ83Lw/vw6P2sTD0FoHu1wPD2zglAoGBAMbkv2PFcrJrci4Y/mDT ++GHagSpshShJZ4mFZG5cDPb8c/91lqBya7Mz2CpO7Qo0eQjlhvqRgeikJ3PTlJlpo ++gZnpIPwgbbvI/Az4vELEHurzuzohgFRBso7SuEjN4RH4NFq4xe9Q80Dpkm8t6vOL ++ssLRMm+gsEUTS/lXKAfeTalzAoGAT2lRQOGdErqr1iEpnG7zz1RihczShsmA5wof ++Tyf3vn/mK2DKwwG072mGeZ+L+lTmIkkWpCNj1vS1OHq1eqwlaxFCVnyP1SotKlU8 ++NaSfLAmEbsJG6QGcgZxwsGDyos6fZKLEs+CEn/O3YJ0F07hzecWc56zDTYRs0du0 ++3Jmu5D0CgYBTYh8wZkswTlayiblLCEs515sFWCYeegtve5ttfl2HGng2IEThqOuc ++kU64C00R2GsEE6bU3OfOeLjSat2p/jYD9+Zpc8w48kM84D57Fxoa3IBvjmaYElX4 ++1Ci2EVvHiwokvqZaQFA+zDCHnCPawOPnohh/GxXjlYcmeRHLy1oGVw== ++-----END RSA PRIVATE KEY----- +diff --git a/t/ssl/key/good.pem b/t/ssl/key/good.pem +index e8eeccf..7fcd48e 100644 +--- a/t/ssl/key/good.pem ++++ b/t/ssl/key/good.pem +@@ -1,28 +1,28 @@ + -----BEGIN PRIVATE KEY----- +-MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC2IXTePYxlKo4y +-VMpqq/eMKwFNsJo5HIW9JltnxLiwJnNZ4vBKoQ2ZMtBUGK6u8o5C73EaP/ke33+B +-TnyjU+htso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ZkVwULxMKpoN7ZgRRK1lqXXrA== + -----END PRIVATE KEY-----
diff -u fusioninventory-agent-2.2.3/debian/fusioninventory-agent.install fusioninventory-agent-2.2.3/debian/fusioninventory-agent.install --- fusioninventory-agent-2.2.3/debian/fusioninventory-agent.install +++ fusioninventory-agent-2.2.3/debian/fusioninventory-agent.install @@ -1,2 +1,2 @@ -etc/agent.cfg etc/fusioninventory +etc/agent.cfg usr/share/fusioninventory/etc debian/default/fusioninventory-agent etc/default diff -u fusioninventory-agent-2.2.3/debian/changelog fusioninventory-agent-2.2.3/debian/changelog --- fusioninventory-agent-2.2.3/debian/changelog +++ fusioninventory-agent-2.2.3/debian/changelog @@ -1,3 +1,19 @@ +fusioninventory-agent (2.2.3-6) unstable; urgency=low + + * Fix issues pointed by Julien Cristau: + - Add upstream-fix-backport.diff in the patch serie + - Depends on libio-socket-ssl-perl instead of libnet-ssleay-perl + directly as advertised in 2.2.3-3 + - move /usr/share/doc/fusioninventory-agent/agent.cfg to + /usr/share/fusioninventory/etc/agent.cfg because of policy 12.3 + (Packages must not require the existence of any files in + `/usr/share/doc/' in order to function). + - clean up fusioninventory-agent.postrm + * Refresh upstream-fix-backport.diff + - skip, battery.t which is now broken + + -- Gonéri Le Bouder <goneri@rulezlan.org> Sun, 27 Jan 2013 14:36:00 +0100 + fusioninventory-agent (2.2.3-5) unstable; urgency=low * Yet another maintain scripts update :(, thanks Adam D. Barratt, diff -u fusioninventory-agent-2.2.3/debian/fusioninventory-agent.postrm fusioninventory-agent-2.2.3/debian/fusioninventory-agent.postrm --- fusioninventory-agent-2.2.3/debian/fusioninventory-agent.postrm +++ fusioninventory-agent-2.2.3/debian/fusioninventory-agent.postrm @@ -4,23 +4,7 @@ #DEBHELPER# case "$1" in - remove) - # This package is being removed, but its configuration has not yet - # been purged. - : - - # ldconfig is NOT needed during removal of a library, only during - # installation - - ;; purge) - # This package has previously been removed and is now having - # its configuration purged from the system. - : - - # we mimic dpkg as closely as possible, so we remove configuration - # files with dpkg backup extensions too: - ### Some of the following is from Tore Anderson: for ext in '~' '%' .bak .ucf-new .ucf-old .ucf-dist; do rm -f /etc/fusioninventory/agent.cfg$ext done @@ -38,60 +22,7 @@ fi ;; - disappear) - if test "$2" != overwriter; then - echo "$0: undocumented call to \`postrm $*'" 1>&2 - exit 0 - fi - # This package has been completely overwritten by package $3 - # (version $4). All our files are already gone from the system. - # This is a special case: neither "prerm remove" nor "postrm remove" - # have been called, because dpkg didn't know that this package would - # disappear until this stage. - : - - ;; - upgrade) - # About to upgrade FROM THIS VERSION to version $2 of this package. - # "prerm upgrade" has been called for this version, and "preinst - # upgrade" has been called for the new version. Last chance to - # clean up. - : - - ;; - failed-upgrade) - # About to upgrade from version $2 of this package TO THIS VERSION. - # "prerm upgrade" has been called for the old version, and "preinst - # upgrade" has been called for this version. This is only used if - # the previous version's "postrm upgrade" couldn't handle it and - # returned non-zero. (Fix old postrm bugs here.) - : - - ;; - abort-install) - # Back out of an attempt to install this package. Undo the effects of - # "preinst install...". There are two sub-cases. - : - - if test "${2+set}" = set; then - # When the install was attempted, version $2's configuration - # files were still on the system. Undo the effects of "preinst - # install $2". - : - - else - # We were being installed from scratch. Undo the effects of - # "preinst install". - : - - fi ;; - abort-upgrade) - # Back out of an attempt to upgrade this package from version $2 - # TO THIS VERSION. Undo the effects of "preinst upgrade $2". - : - - ;; - *) echo "$0: didn't understand being called with \`$1'" 1>&2 + *) exit 0;; esac diff -u fusioninventory-agent-2.2.3/debian/rules fusioninventory-agent-2.2.3/debian/rules --- fusioninventory-agent-2.2.3/debian/rules +++ fusioninventory-agent-2.2.3/debian/rules @@ -25,6 +25,7 @@ [ ! -f t/components/server.t ] || rm t/components/server.t [ ! -f t/components/client/connection.t ] || rm t/components/client/connection.t [ ! -f t/components/client/ocs/response.t ] || rm t/components/client/ocs/response.t + [ ! -f t/inventory/generic/dmidecode/battery.t ] || rm t/inventory/generic/dmidecode/battery.t ifeq ($(BACKPORT),yes) [ ! -f t/components/logger.t ] || rm t/components/logger.t [ ! -f t/xml/response.t ] || rm t/xml/response.t diff -u fusioninventory-agent-2.2.3/debian/control fusioninventory-agent-2.2.3/debian/control --- fusioninventory-agent-2.2.3/debian/control +++ fusioninventory-agent-2.2.3/debian/control @@ -4,8 +4,7 @@ Maintainer: Gonéri Le Bouder <goneri@rulezlan.org> Build-Depends: debhelper (>= 7.0.50~), libnet-ip-perl, libwww-perl, quilt, - libnet-ssleay-perl, perl, - libuniversal-require-perl, libtest-compile-perl, + perl, libuniversal-require-perl, libtest-compile-perl, libtest-exception-perl, libhttp-server-simple-perl, libfile-which-perl, libxml-treepp-perl, libyaml-perl, libipc-run-perl, libhttp-proxy-perl, libtext-template-perl, @@ -21,13 +20,12 @@ Package: fusioninventory-agent Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, - ucf, libnet-ip-perl, libwww-perl, libnet-ssleay-perl, + ucf, libnet-ip-perl, libwww-perl, libio-socket-ssl-perl, libproc-daemon-perl, dmidecode [i386-any amd64-any ia64], libuniversal-require-perl, libproc-pid-file-perl, hdparm [linux-any], libfile-which-perl, libxml-treepp-perl, libyaml-perl, libtext-template-perl, libjson-perl, pciutils, libhttp-daemon-perl, Suggests: smartmontools, read-edid -Recommends: libio-socket-ssl-perl Description: Hardware and software inventory tool (client) FusionInventory Agent is an application designed to help a network or system administrator to keep track of the hardware and software diff -u fusioninventory-agent-2.2.3/debian/fusioninventory-agent.docs fusioninventory-agent-2.2.3/debian/fusioninventory-agent.docs --- fusioninventory-agent-2.2.3/debian/fusioninventory-agent.docs +++ fusioninventory-agent-2.2.3/debian/fusioninventory-agent.docs @@ -2 +1,0 @@ -etc/agent.cfg diff -u fusioninventory-agent-2.2.3/debian/copyright fusioninventory-agent-2.2.3/debian/copyright --- fusioninventory-agent-2.2.3/debian/copyright +++ fusioninventory-agent-2.2.3/debian/copyright @@ -1,57 +1,44 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Contact: FusionInventory Team -Source: http://search.cpan.org/dist/FusionInventory-Agent/ -Upstream-Name: FusionInventory-Agent - -Files: * -Copyright: 2006-2010 OCS Inventory contributors - 2010 FusionInventory Team - 2007 Gonéri Le Bouder <goneri@rulezlan.org> - 2008 Jean Parpaillon <jean.parpaillon@kerlabs.com> - 2005-2010 Mandriva SA -License: GPL-2+ - This program is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later - version. - . - This program is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied - warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the GNU General Public License for more - details. - . - You should have received a copy of the GNU General Public - License along with this package; if not, write to the Free - Software Foundation, Inc., 51 Franklin St, Fifth Floor, - Boston, MA 02110-1301 USA - . - On Debian systems, the full text of the GNU General Public - License version 2 can be found in the file - `/usr/share/common-licenses/GPL-2'. - -Files: debian/* -Copyright: 2012, Gonéri Le Bouder <goneri@rulezlan.org> -License: GPL-2+ - This program is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later - version. - . - This program is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied - warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the GNU General Public License for more - details. - . - You should have received a copy of the GNU General Public - License along with this package; if not, write to the Free - Software Foundation, Inc., 51 Franklin St, Fifth Floor, - Boston, MA 02110-1301 USA - . - On Debian systems, the full text of the GNU General Public - License version 2 can be found in the file - `/usr/share/common-licenses/GPL-2'. +It was downloaded from http://search.cpan.org/dist/FusionInventory-Agent/ + +Upstream maintainer: Gonéri Le Bouder <goneri@rulezlan.org> + +Copyright 2006-2010 OCS Inventory contributors +Copyright 2010 FusionInventory Team +Copyright 2005 Mandriva +Copyright 2007 Gonéri Le Bouder <goneri@rulezlan.org> +Copyright 2008 Jean Parpaillon <jean.parpaillon@kerlabs.com> + + +License: + +lib/FusionInventory/Agent/Task/Inventory/OS/Generic/Screen.pm +and memconf are released under this license: + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + +The rest of the files are released under this license: + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + +On Debian GNU/Linux systems, the complete text of the GNU General +Public License can be found in `/usr/share/common-licenses/GPL-2'. + + +The Debian packaging is Copyright (C) 2007-2010,Pierre Chifflier, + Benoit Mortier and Gonéri Le Bouder and is licensed under the +GPLv2, see `/usr/share/common-licenses/GPL-2'. diff -u fusioninventory-agent-2.2.3/debian/fusioninventory-agent.postinst fusioninventory-agent-2.2.3/debian/fusioninventory-agent.postinst --- fusioninventory-agent-2.2.3/debian/fusioninventory-agent.postinst +++ fusioninventory-agent-2.2.3/debian/fusioninventory-agent.postinst @@ -6,7 +6,7 @@ case "$1" in configure) [ -d "/etc/fusioninventory" ] || mkdir "/etc/fusioninventory" - ucf /usr/share/doc/fusioninventory-agent/agent.cfg /etc/fusioninventory/agent.cfg + ucf /usr/share/fusioninventory/etc/agent.cfg /etc/fusioninventory/agent.cfg ucfr fusioninventory-agent /etc/fusioninventory/agent.cfg esac diff -u fusioninventory-agent-2.2.3/debian/patches/upstream-fix-backport.diff fusioninventory-agent-2.2.3/debian/patches/upstream-fix-backport.diff --- fusioninventory-agent-2.2.3/debian/patches/upstream-fix-backport.diff +++ fusioninventory-agent-2.2.3/debian/patches/upstream-fix-backport.diff @@ -1,5 +1,181 @@ +diff --git a/fusioninventory-agent b/fusioninventory-agent +index 71f19c9..90e5fa0 100755 +--- a/fusioninventory-agent ++++ b/fusioninventory-agent +@@ -363,7 +363,27 @@ List available tasks and exit + + =item B<--no-category>=I<CATEGORY> + +-Do not list given category items in inventory. ++Do not list given category items in inventory. It can be: ++ ++=over 4 ++ ++=item ++ ++printer ++ ++=item ++ ++software ++ ++=item ++ ++environment ++ ++=item ++ ++process ++ ++=back + + =item B<--scan-homedirs> + +diff --git a/fusioninventory-injector b/fusioninventory-injector +index db01136..57e290d 100755 +--- a/fusioninventory-injector ++++ b/fusioninventory-injector +@@ -24,33 +24,66 @@ my %options = ( + useragent => 'FusionInventory-Injector' + ); + ++GetOptions( ++ \%options, ++ 'help|h', ++ 'directory|d=s', ++ 'file|f=s', ++ 'url|u=s', ++ 'useragent=s', ++ 'remove|r', ++ 'verbose|v', ++ 'stdin', ++); ++ ++$OUTPUT_AUTOFLUSH = 1; ++pod2usage() if $options{help}; ++ ++if ($options{stdin}) { ++ loadstdin(); ++} elsif ($options{file}) { ++ die "file $options{file} does not exist" ++ unless -f $options{file}; ++ loadfile($options{file}); ++} elsif ($options{directory}) { ++ die "directory $options{directory} does not exist" ++ unless -d $options{directory}; ++ loaddirectory($options{directory}); ++} else { ++ pod2usage(); ++} ++ + sub loadfile { +- my $file = shift; ++ my ($file) = @_; + + die "can't read file $file" unless -r $file; + + print "Loading $file..." if $options{verbose}; + +- open (my $fh, '<', $file) or die "can't open file $file: $ERRNO"; ++ open (my $handle, '<', $file) or die "can't open file $file: $ERRNO\n"; + ## no critic (ProhibitBitwise) +- flock ($fh, LOCK_EX | LOCK_NB) or die "can't lock file $file: $ERRNO"; ++ flock ($handle, LOCK_EX | LOCK_NB) or die "can't lock file $file: $ERRNO\n"; + local $RS; +- my $content = <$fh>; +- close $fh or die "Can't close file $file: $ERRNO"; ++ my $content = <$handle>; ++ close $handle or die "Can't close file $file: $ERRNO\n"; + +- sendContent($content); ++ my $success = sendContent($content); ++ if ($success && $options{remove}) { ++ unlink $file or warn "Can't remove $file: $ERRNO\n" ++ } + } + + sub loaddirectory { +- my $directory = shift; ++ my ($directory) = @_; + + die "can't read directory $directory" unless -r $directory; + +- opendir (my $dh, $directory) or die "can't open directory $directory: $ERRNO"; +- foreach ( readdir($dh) ) { +- loadfile("$directory/$_") if (/\.ocs$/); ++ opendir (my $handle, $directory) ++ or die "can't open directory $directory: $ERRNO\n"; ++ foreach my $file (readdir($handle)) { ++ loadfile("$directory/$file") if $file =~ /\.ocs$/; + } +- closedir $dh; ++ closedir $handle; + } + + sub loadstdin { +@@ -76,47 +109,14 @@ sub sendContent { + $request->content(compress($content)); + my $res = $ua->request($request); + +- if ($res->is_success()) { +- print "OK\n" if $options{verbose}; +- print STDERR "Can't remove $options{file}: $ERRNO\n" +- if ($options{remove} && (!unlink $options{file})); +- } else { +- if ($options{verbose}) { +- print "ERROR: "; +- print $res->status_line(), "\n"; +- } ++ if ($options{verbose}) { ++ print $res->is_success() ? ++ "OK\n" : "ERROR: " . $res->status_line() . "\n"; + } +-} +- +-GetOptions( +- \%options, +- 'help|h', +- 'directory|d=s', +- 'file|f=s', +- 'url|u=s', +- 'useragent=s', +- 'remove|r', +- 'verbose|v', +- 'stdin', +-); +- +-$OUTPUT_AUTOFLUSH = 1; +-pod2usage() if $options{help}; + +-if ($options{file}) { +- die "file $options{file} does not exist" unless -f $options{file}; +- loadfile($options{file}); +-} elsif ($options{stdin}) { +- loadstdin(); +-} elsif ($options{directory}) { +- die "directory $options{directory} does not exist" unless -d $options{directory}; +- loaddirectory($options{directory}); +-} else { +- pod2usage(); ++ return $res->is_success(); + } + +-exit(0); +- + __END__ + + =head1 NAME +@@ -125,7 +125,7 @@ fusioninventory-injector - A tool to push inventory in an OCS Inventory or compa + + =head1 SYNOPSIS + +-fusioninventory-injector [options] [--file <file>|--directory <directory|--stdin] ++fusioninventory-injector [options] [--file <file>|--directory <directory>|--stdin] + + Options: + -h --help this menu diff --git a/lib/FusionInventory/Agent.pm b/lib/FusionInventory/Agent.pm -index 03bf240..f2a8482 100644 +index 03bf240..3234ddf 100644 --- a/lib/FusionInventory/Agent.pm +++ b/lib/FusionInventory/Agent.pm @@ -22,7 +22,7 @@ use FusionInventory::Agent::Tools; @@ -7,7 +183,7 @@ use FusionInventory::Agent::XML::Query::Prolog; -our $VERSION = '2.2.3'; -+our $VERSION = '2.2.3debian'; ++our $VERSION = '2.2.7'; our $VERSION_STRING = "FusionInventory unified agent for UNIX, Linux and MacOSX ($VERSION)"; our $AGENT_STRING = @@ -39,19 +215,20 @@ + 'Bar' => y, ); diff --git a/lib/FusionInventory/Agent/Config.pm b/lib/FusionInventory/Agent/Config.pm -index f4a910b..f1345da 100644 +index f4a910b..4eb28f2 100644 --- a/lib/FusionInventory/Agent/Config.pm +++ b/lib/FusionInventory/Agent/Config.pm -@@ -15,6 +15,8 @@ my $default = { +@@ -15,6 +15,9 @@ my $default = { 'backend-collect-timeout' => 30, 'httpd-port' => 62354, 'timeout' => 180, -+ 'no-task' => [], -+ 'no-category' => [] ++ # multi-values options that will be converted to array ref ++ 'no-task' => "", ++ 'no-category' => "" }; my $deprecated = { -@@ -50,31 +52,31 @@ my $deprecated = { +@@ -50,31 +53,31 @@ my $deprecated = { }, 'no-inventory' => { message => 'use --no-task inventory option instead', @@ -90,7 +267,32 @@ }, }; -@@ -215,19 +217,25 @@ sub _checkContent { +@@ -84,7 +87,6 @@ sub new { + my $self = {}; + bless $self, $class; + $self->_loadDefaults(); +- + my $backend = + $params{options}->{'conf-file'} ? 'file' : + $params{options}->{config} ? $params{options}->{config} : +@@ -160,7 +162,6 @@ sub _loadFromRegistry { + + sub _loadFromFile { + my ($self, $params) = @_; +- + my $file = $params->{file} ? + $params->{file} : $params->{directory} . '/agent.cfg'; + +@@ -207,6 +208,8 @@ sub _checkContent { + foreach my $old (keys %$deprecated) { + next unless defined $self->{$old}; + ++ next if $old =~ /^no-/ and !$self->{$old}; ++ + my $handler = $deprecated->{$old}; + + # notify user of deprecation +@@ -215,19 +218,25 @@ sub _checkContent { # transfer the value to the new option, if possible if ($handler->{new}) { if (ref $handler->{new} eq 'HASH') { @@ -122,7 +324,7 @@ $self->{$handler->{new}} = $self->{$old}; } } -@@ -244,10 +252,8 @@ sub _checkContent { +@@ -244,10 +253,8 @@ sub _checkContent { # multi-values options $self->{logger} = [ split(/,/, $self->{logger}) ] if $self->{logger}; $self->{server} = [ split(/,/, $self->{server}) ] if $self->{server}; @@ -274,11 +476,35 @@ } sub doInventory {} +diff --git a/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Dmidecode/Battery.pm b/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Dmidecode/Battery.pm +index 0634a20..b1465bc 100644 +--- a/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Dmidecode/Battery.pm ++++ b/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Dmidecode/Battery.pm +@@ -36,12 +36,16 @@ sub _getBattery { + my $battery = { + NAME => $info->{'Name'}, + MANUFACTURER => $info->{'Manufacturer'}, +- SERIAL => $info->{'Serial Number'}, +- CHEMISTRY => $info->{'Chemistry'}, ++ SERIAL => $info->{'Serial Number'} || ++ $info->{'SBDS Serial Number'}, ++ CHEMISTRY => $info->{'Chemistry'} || ++ $info->{'SBDS Chemistry'}, + }; + +- if ($info->{'Manufacture Date'}) { ++ if ($info->{'Manufacture Date'}) { + $battery->{DATE} = _parseDate($info->{'Manufacture Date'}); ++ } elsif ($info->{'SBDS Manufacture Date'}) { ++ $battery->{DATE} = _parseDate($info->{'SBDS Manufacture Date'}); + } + + if ($info->{'Design Capacity'} && diff --git a/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Screen.pm b/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Screen.pm -index 0991f88..7846745 100644 +index 0991f88..a9590e2 100644 --- a/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Screen.pm +++ b/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Screen.pm -@@ -30,22 +30,15 @@ sub doInventory { +@@ -30,22 +30,18 @@ sub doInventory { foreach my $screen (_getScreens($logger)) { if ($screen->{edid}) { @@ -294,21 +520,23 @@ - getManufacturerFromCode($edid->{manufacturer_name}); - $screen->{SERIAL} = $edid->{serial_number2}->[0]; - } -- $screen->{BASE64} = encode_base64($screen->{edid}); + my $info = _getEdidInfo($screen->{edid}, $logger); + $screen->{CAPTION} = $info->{CAPTION}; + $screen->{DESCRIPTION} = $info->{DESCRIPTION}; + $screen->{MANUFACTURER} = $info->{MANUFACTURER}; + $screen->{SERIAL} = $info->{SERIAL}; ++ + $screen->{BASE64} = encode_base64($screen->{edid}); ++ } -+ $screen->{BASE64} = encode_base64($screen->{edid}); ++ if (defined($screen->{edid})) { + delete $screen->{edid}; } - delete $screen->{edid}; $inventory->addEntry( section => 'MONITORS', -@@ -54,6 +47,61 @@ sub doInventory { +@@ -54,6 +50,61 @@ sub doInventory { } } @@ -370,7 +598,7 @@ sub _getScreensFromWindows { my ($logger) = @_; -@@ -117,25 +165,23 @@ sub _getScreensFromUnix { +@@ -117,25 +168,23 @@ sub _getScreensFromUnix { my @screens; @@ -403,6 +631,191 @@ push @screens, { edid => $edid }; return @screens if @screens; +diff --git a/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Storages/HP.pm b/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Storages/HP.pm +index ce1818f..8a161d1 100644 +--- a/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Storages/HP.pm ++++ b/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Storages/HP.pm +@@ -55,103 +55,93 @@ sub doInventory { + my $inventory = $params{inventory}; + my $logger = $params{logger}; + +- my ($serialnumber, $model, $capacity, $firmware, $description, $media, $manufacturer); +- +- my $hpacuacliPath = canRun('hpacucli') ? ++ my $path = canRun('hpacucli') ? + "hpacucli": + _getHpacuacliFromWinRegistry($logger); + +- my $handle1 = getFileHandle( +- logger => $logger, +- command => "$hpacuacliPath ctrl all show" +- ); ++ foreach my $slot (_getSlots(path => $path)) { ++ foreach my $drive (_getDrives(path => $path, slot => $slot)) { + +- return unless $handle1; ++ $inventory->addEntry( ++ section => 'STORAGES', ++ entry => _getStorage( ++ path => $path, slot => $slot, drive => $drive ++ ) ++ ); ++ } ++ } ++} + +-# Example output : +-# +-# Smart Array E200 in Slot 2 (sn: PA6C90K9SUH1ZA) +- while (my $line1 = <$handle1>) { +- next unless $line1 =~ /Slot\s(\d*)/; ++sub _getSlots { ++ my %params = @_; + +- my $slot = $1; +- my $handle2 = getFileHandle( +- logger => $logger, +- command => "$hpacuacliPath ctrl slot=$slot pd all show" +- ); +- next unless $handle2; ++ my $command = $params{path} ? ++ "%params{path} ctrl all show" : undef; ++ my $handle = getFileHandle(%params, command => $command); ++ return unless $handle; + +-# Example output : +-# +-# Smart Array E200 in Slot 2 +-# +-# array A +-# +-# physicaldrive 2I:1:1 (port 2I:box 1:bay 1, SATA, 74.3 GB, OK) +-# physicaldrive 2I:1:2 (port 2I:box 1:bay 2, SATA, 74.3 GB, OK) +- while (my $line2 = <$handle2>) { +- next unless $line2 =~ /physicaldrive\s(\S*)/; +- +- my $pd = $1; +- my $handle3 = getFileHandle( +- logger => $logger, +- command => "$hpacuacliPath ctrl slot=$slot pd $pd show" +- ); +- next unless $handle3; ++ my @slots; ++ while (my $line = <$handle>) { ++ next unless $line =~ /Slot (\d+)/; ++ push @slots, $1; ++ } ++ close $handle; + +-# Example output : +-# +-# Smart Array E200 in Slot 2 +-# +-# array A +-# +-# physicaldrive 1:1 +-# Port: 2I +-# Box: 1 +-# Bay: 1 +-# Status: OK +-# Drive Type: Data Drive +-# Interface Type: SATA +-# Size: 74.3 GB +-# Firmware Revision: 21.07QR4 +-# Serial Number: WD-WMANS1732855 +-# Model: ATA WDC WD740ADFD-00 +-# SATA NCQ Capable: False +-# PHY Count: 1 +- while (my $line3 = <$handle3>) { +- $model = $1 if $line3 =~ /Model:\s(.*)/; +- $description = $1 if $line3 =~ /Interface Type:\s(.*)/; +- $media = $1 if $line3 =~ /Drive Type:\s(.*)/; +- $capacity = 1000*$1 if $line3 =~ /Size:\s(.*)/; +- $serialnumber = $1 if $line3 =~ /Serial Number:\s(.*)/; +- $firmware = $1 if $line3 =~ /Firmware Revision:\s(.*)/; +- } +- close $handle3; +- $serialnumber =~ s/^\s+//; +- $model =~ s/^ATA\s+//; # ex: ATA WDC WD740ADFD-00 +- $model =~ s/\s+/ /; +- $manufacturer = getCanonicalManufacturer($model); +- if ($media eq 'Data Drive') { +- $media = 'disk'; +- } ++ return @slots; ++} + +- $inventory->addEntry( +- section => 'STORAGES', +- entry => { +- NAME => $model, +- MANUFACTURER => $manufacturer, +- MODEL => $model, +- DESCRIPTION => $description, +- TYPE => $media, +- DISKSIZE => $capacity, +- SERIALNUMBER => $serialnumber, +- FIRMWARE => $firmware +- } +- ); +- } +- close $handle2; ++sub _getDrives { ++ my %params = @_; ++ ++ my $command = $params{path} && $params{slot} ? ++ "%params{path} ctrl slot=$params{slot} pd all show" : undef; ++ my $handle = getFileHandle(%params, command => $command); ++ next unless $handle; ++ ++ my @drives; ++ while (my $line = <$handle>) { ++ next unless $line =~ /physicaldrive (\S+)/; ++ push @drives, $1; ++ } ++ close $handle; ++ ++ return @drives; ++} ++ ++sub _getStorage { ++ my %params = @_; ++ ++ my $command = $params{path} && $params{slot} && $params{drive} ? ++ "%params{path} ctrl slot=$params{slot} pd $params{drive} show" : undef; ++ my $handle = getFileHandle(%params, command => $command); ++ next unless $handle; ++ ++ my %data; ++ while (my $line = <$handle>) { ++ next unless $line =~ /(\S[^:]+) : \s+ (.+)/x; ++ $data{$1} = $2; + } +- close $handle1; ++ close $handle; ++ ++ my $storage = { ++ DESCRIPTION => $data{'Interface Type'}, ++ SERIALNUMBER => $data{'Serial Number'}, ++ FIRMWARE => $data{'Firmware Revision'} ++ }; ++ ++ my $model = $data{'Model'}; ++ $model =~ s/^ATA\s+//; # ex: ATA WDC WD740ADFD-00 ++ $model =~ s/\s+/ /; ++ $storage->{NAME} = $model; ++ $storage->{MODEL} = $model; ++ ++ $storage->{MANUFACTURER} = getCanonicalManufacturer($model); ++ $storage->{DISKSIZE} = getCanonicalSize($data{'Size'}); ++ ++ $storage->{TYPE} = $data{'Drive Type'} eq 'Data Drive' ? ++ 'disk' : $data{'Drive Type'}; ++ ++ return $storage; + } + + 1; diff --git a/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/LVM.pm b/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/LVM.pm index d4bf1a8..d775a80 100644 --- a/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/LVM.pm @@ -470,29 +883,8 @@ } } return $result if $result; -diff --git a/lib/FusionInventory/Agent/Task/Inventory/Input/Win32/Bios.pm b/lib/FusionInventory/Agent/Task/Inventory/Input/Win32/Bios.pm -index b664c67..cfb11d0 100644 ---- a/lib/FusionInventory/Agent/Task/Inventory/Input/Win32/Bios.pm -+++ b/lib/FusionInventory/Agent/Task/Inventory/Input/Win32/Bios.pm -@@ -31,7 +31,7 @@ sub doInventory { - foreach my $object (getWmiObjects( - class => 'Win32_Bios', - properties => [ qw/ -- SerialNumber Version Manufacturer SMBIOSBIOSVersion BIOSVersion -+ SerialNumber Version Manufacturer SMBIOSBIOSVersion BIOSVersion ReleaseDate - / ] - )) { - $bios->{BIOSSERIAL} = $object->{SerialNumber}; -@@ -40,6 +40,7 @@ sub doInventory { - $bios->{BVERSION} = $object->{SMBIOSBIOSVersion} || - $object->{BIOSVersion} || - $object->{Version}; -+ $bios->{BDATE} = $object->{ReleaseDate}; - } - - foreach my $object (getWmiObjects( diff --git a/lib/FusionInventory/Agent/Task/Inventory/Inventory.pm b/lib/FusionInventory/Agent/Task/Inventory/Inventory.pm -index 17479c9..abaca7e 100644 +index 17479c9..b755cb6 100644 --- a/lib/FusionInventory/Agent/Task/Inventory/Inventory.pm +++ b/lib/FusionInventory/Agent/Task/Inventory/Inventory.pm @@ -354,6 +354,9 @@ sub computeChecksum { @@ -505,6 +897,15 @@ } } else { $logger->debug( +@@ -530,7 +533,7 @@ System Serial number + + =item BDATE + +-BIOS release date ++BIOS release date in the Month/Day/Year format (e.g: 09/27/2010) + + =item BVERSION + diff --git a/lib/FusionInventory/Agent/Task/WakeOnLan.pm b/lib/FusionInventory/Agent/Task/WakeOnLan.pm index fc35b51..106b1b1 100644 --- a/lib/FusionInventory/Agent/Task/WakeOnLan.pm @@ -527,10 +928,19 @@ chr(0xFF) x 6 . (pack('H12', $target) x 16); diff --git a/lib/FusionInventory/Agent/Tools.pm b/lib/FusionInventory/Agent/Tools.pm -index c507bc3..97e19e6 100644 +index c507bc3..39a206b 100644 --- a/lib/FusionInventory/Agent/Tools.pm +++ b/lib/FusionInventory/Agent/Tools.pm -@@ -357,7 +357,8 @@ sub hex2char { +@@ -57,6 +57,8 @@ if ($OSNAME ne 'MSWin32') { + sub getFormatedLocalTime { + my ($time) = @_; + ++ return unless $time; ++ + my ($year, $month , $day, $hour, $min, $sec) = + (localtime ($time))[5, 4, 3, 2, 1, 0]; + +@@ -357,7 +359,8 @@ sub hex2char { return undef unless $value; return $value unless $value =~ /^0x/; @@ -540,7 +950,7 @@ $value =~ s/(\w{2})/chr(hex($1))/eg; return $value; -@@ -571,8 +572,9 @@ of line removed. +@@ -571,8 +574,9 @@ of line removed. =head2 getAllLines(%params) @@ -688 +1098,13 @@ - +diff --git a/lib/FusionInventory/Agent/XML/Response.pm b/lib/FusionInventory/Agent/XML/Response.pm +index 3afcb0f..5f21bd6 100644 +--- a/lib/FusionInventory/Agent/XML/Response.pm ++++ b/lib/FusionInventory/Agent/XML/Response.pm +@@ -11,7 +11,7 @@ sub new { + + my $tpp = XML::TreePP->new( + force_array => [ qw/ +- OPTION PARAM MODEL AUTHENTICATION RANGEIP DEVICE ++ OPTION PARAM MODEL AUTHENTICATION RANGEIP DEVICE GET WALK + / ], + attr_prefix => '', + text_node_key => 'content' diff -u fusioninventory-agent-2.2.3/debian/patches/series fusioninventory-agent-2.2.3/debian/patches/series --- fusioninventory-agent-2.2.3/debian/patches/series +++ fusioninventory-agent-2.2.3/debian/patches/series @@ -2,0 +3 @@ +upstream-fix-backport.diff
Attachment:
pgpUYhQ1dmtRw.pgp
Description: PGP signature