aboutsummaryrefslogtreecommitdiff
path: root/net-mgmt
diff options
context:
space:
mode:
authorSteve Wills <swills@FreeBSD.org>2012-08-25 20:20:28 +0000
committerSteve Wills <swills@FreeBSD.org>2012-08-25 20:20:28 +0000
commit195df866ab058f815c38f2085606d026cf580a57 (patch)
tree8a574b8b3fd14faa1490bf0dea0f8b40ce9384c0 /net-mgmt
parente828f9956432c61c066e73d22e655a8e652912a9 (diff)
downloadports-195df866ab058f815c38f2085606d026cf580a57.tar.gz
ports-195df866ab058f815c38f2085606d026cf580a57.zip
Notes
Diffstat (limited to 'net-mgmt')
-rw-r--r--net-mgmt/p5-FusionInventory-Agent/Makefile78
-rw-r--r--net-mgmt/p5-FusionInventory-Agent/distinfo4
-rw-r--r--net-mgmt/p5-FusionInventory-Agent/files/patch-Makefile.PL30
-rw-r--r--net-mgmt/p5-FusionInventory-Agent/files/patch-add_jails_support64
-rw-r--r--net-mgmt/p5-FusionInventory-Agent/files/patch-fix_install_paths26
-rw-r--r--net-mgmt/p5-FusionInventory-Agent/files/patch-more_raid_support442
-rw-r--r--net-mgmt/p5-FusionInventory-Agent/pkg-plist20
7 files changed, 602 insertions, 62 deletions
diff --git a/net-mgmt/p5-FusionInventory-Agent/Makefile b/net-mgmt/p5-FusionInventory-Agent/Makefile
index bca5d58052ea..99967cb1e00a 100644
--- a/net-mgmt/p5-FusionInventory-Agent/Makefile
+++ b/net-mgmt/p5-FusionInventory-Agent/Makefile
@@ -6,7 +6,7 @@
#
PORTNAME= FusionInventory-Agent
-PORTVERSION= 2.2.4
+PORTVERSION= 2.2.5
CATEGORIES= net-mgmt
MASTER_SITES= CPAN
MASTER_SITE_SUBDIR= CPAN:FUSINV
@@ -15,34 +15,41 @@ PKGNAMEPREFIX= p5-
MAINTAINER= g.veniamin@googlemail.com
COMMENT= Agent for OCS Inventory server and FusionInventory for GLPI servers
+OPTIONS= CUPS "Enable CUPS" OFF \
+ HTTP "Enable HTTP daemon mode" OFF \
+ ZLIB "Enable Zlib compression" ON \
+ SSL "Enable SSL" OFF \
+ DMIDECODE "Enable dmidecode hardware information" ON \
+ PCIUTILS "Enable pciutils hardware information" ON \
+ NMAP "Enable NMAP network inventory" OFF
+
LICENSE= GPLv2
-BUILD_DEPENDS= p5-Crypt-SSLeay>=0:${PORTSDIR}/security/p5-Crypt-SSLeay \
- p5-File-ShareDir>=0:${PORTSDIR}/devel/p5-File-ShareDir \
- p5-HTTP-Daemon>=0:${PORTSDIR}/www/p5-HTTP-Daemon \
- p5-HTTP-Server-Simple>=0:${PORTSDIR}/www/p5-HTTP-Server-Simple \
- p5-HTTP-Server-Simple-Authen>=0:${PORTSDIR}/www/p5-HTTP-Server-Simple-Authen \
- p5-Net-CUPS>=0.6:${PORTSDIR}/print/p5-Net-CUPS \
- p5-Net-IP>=0:${PORTSDIR}/net-mgmt/p5-Net-IP \
- p5-Proc-Daemon>=0:${PORTSDIR}/devel/p5-Proc-Daemon \
- p5-Proc-PID-File>=0:${PORTSDIR}/devel/p5-Proc-PID-File \
+USE_GMAKE= yes
+
+BUILD_DEPENDS= p5-Text-Template>=0:${PORTSDIR}/textproc/p5-Text-Template \
+ p5-ExtUtils-MakeMaker>=6.59:${PORTSDIR}/devel/p5-ExtUtils-MakeMaker \
p5-UNIVERSAL-require>=0:${PORTSDIR}/devel/p5-UNIVERSAL-require \
- p5-XML-Simple>=0:${PORTSDIR}/textproc/p5-XML-Simple \
+ p5-Net-IP>=0:${PORTSDIR}/net-mgmt/p5-Net-IP \
+ p5-Digest-MD5>=0:${PORTSDIR}/security/p5-Digest-MD5 \
p5-XML-TreePP>=0:${PORTSDIR}/textproc/p5-XML-TreePP \
- p5-libwww>=0:${PORTSDIR}/www/p5-libwww
+ p5-libwww>=0:${PORTSDIR}/www/p5-libwww \
+ p5-File-Which>=0:${PORTSDIR}/sysutils/p5-File-Which
RUN_DEPENDS:= ${BUILD_DEPENDS}
-RUN_DEPENDS+= dmidecode:${PORTSDIR}/sysutils/dmidecode \
- lspci:${PORTSDIR}/sysutils/pciutils \
- nmap:${PORTSDIR}/security/nmap
-TEST_DEPENDS= p5-Test-Exception>=0:${PORTSDIR}/devel/p5-Test-Exception
+TEST_DEPENDS= p5-Test-Exception>=0:${PORTSDIR}/devel/p5-Test-Exception \
+ p5-Test-MockModule>=0:${PORTSDIR}/devel/p5-Test-MockModule \
+ p5-HTTP-Server-Simple>=0:${PORTSDIR}/www/p5-HTTP-Server-Simple \
+ p5-HTTP-Server-Simple-Authen>=0:${PORTSDIR}/www/p5-HTTP-Server-Simple-Authen \
+ p5-HTTP-Proxy>=0:${PORTSDIR}/www/p5-HTTP-Proxy \
+ p5-IPC-Run>=0:${PORTSDIR}/devel/p5-IPC-Run \
+ p5-YAML>=0:${PORTSDIR}/textproc/p5-YAML \
+ p5-IO-Capture>=0:${PORTSDIR}/devel/p5-IO-Capture \
PERL_CONFIGURE= yes
-MAN3PREFIX= ${PREFIX}
MAN1= fusioninventory-agent.1 \
fusioninventory-injector.1
-
MAN3= FusionInventory::Agent.3 \
FusionInventory::Agent::Config.3 \
FusionInventory::Agent::HTTP::Client.3 \
@@ -84,9 +91,38 @@ MAN3= FusionInventory::Agent.3 \
.include <bsd.port.pre.mk>
-.if ${PERL_LEVEL} < 501000
-BUILD_DEPENDS+= p5-IO-Compress>=0:${PORTSDIR}/archivers/p5-IO-Compress
-RUN_DEPENDS+= p5-IO-Compress>=0:${PORTSDIR}/archivers/p5-IO-Compress
+.if defined(WITH_CUPS)
+RUN_DEPENDS+= p5-Net-CUPS>=0.6:${PORTSDIR}/print/p5-Net-CUPS
+.endif
+
+.if defined(WITH_HTTP)
+RUN_DEPENDS+= p5-HTTP-Daemon>=0:${PORTSDIR}/www/p5-HTTP-Daemon
.endif
+.if defined(WITH_ZLIB)
+RUN_DEPENDS+= p5-Compress-Raw-Zlib>=0:${PORTSDIR}/archivers/p5-Compress-Raw-Zlib
+.endif
+
+.if defined(WITH_SSL)
+RUN_DEPENDS+= p5-Crypt-SSLeay>=0:${PORTSDIR}/security/p5-Crypt-SSLeay \
+ p5-LWP-Protocol-https>=0:${PORTSDIR}/www/p5-LWP-Protocol-https
+.endif
+
+.if defined(WITH_DMIDECODE)
+RUN_DEPENDS+= dmidecode:${PORTSDIR}/sysutils/dmidecode
+.endif
+
+.if defined(WITH_PCIUTILS)
+RUN_DEPENDS+= lspci:${PORTSDIR}/sysutils/pciutils
+.endif
+
+.if defined(WITH_NMAP)
+RUN_DEPENDS+= nmap:${PORTSDIR}/security/nmap
+.endif
+
+post-patch-script:
+ @${ECHO_MSG} -n ">> Removing unneeded patched files..."
+ @${FIND} ${WRKSRC} -type f \( -name '*.orig' \) -delete
+ @${ECHO_MSG} " [ DONE ]"
+
.include <bsd.port.post.mk>
diff --git a/net-mgmt/p5-FusionInventory-Agent/distinfo b/net-mgmt/p5-FusionInventory-Agent/distinfo
index 6faf1db5a9ac..f8b98d039b2f 100644
--- a/net-mgmt/p5-FusionInventory-Agent/distinfo
+++ b/net-mgmt/p5-FusionInventory-Agent/distinfo
@@ -1,2 +1,2 @@
-SHA256 (FusionInventory-Agent-2.2.4.tar.gz) = 4a3976d6db551eb33a15fa4609e9b0c3c83a536783ac6d3a23fe7f3400587cd6
-SIZE (FusionInventory-Agent-2.2.4.tar.gz) = 1160610
+SHA256 (FusionInventory-Agent-2.2.5.tar.gz) = f082e55f561c92e2ed4af0d7946f00c19984401723c0e2b3e233757320aa8804
+SIZE (FusionInventory-Agent-2.2.5.tar.gz) = 1172852
diff --git a/net-mgmt/p5-FusionInventory-Agent/files/patch-Makefile.PL b/net-mgmt/p5-FusionInventory-Agent/files/patch-Makefile.PL
index c0f2329c3d1d..e69de29bb2d1 100644
--- a/net-mgmt/p5-FusionInventory-Agent/files/patch-Makefile.PL
+++ b/net-mgmt/p5-FusionInventory-Agent/files/patch-Makefile.PL
@@ -1,30 +0,0 @@
---- Makefile.PL.orig 2012-07-23 01:47:59.000000000 +0400
-+++ Makefile.PL 2012-08-13 11:36:04.404805799 +0400
-@@ -105,12 +105,12 @@
- INSTALLLIB => '$(DATADIR)/lib',
- INSTALLSITELIB => '$(DATADIR)/lib',
- INSTALLVENDORLIB => '$(DATADIR)/lib',
-- INSTALLMAN1DIR => '$(PREFIX)/share/man/man1',
-- INSTALLSITEMAN1DIR => '$(PREFIX)/share/man/man1',
-- INSTALLVENDORMAN1DIR => '$(PREFIX)/share/man/man1',
-- INSTALLMAN3DIR => '$(PREFIX)/share/man/man3',
-- INSTALLSITEMAN3DIR => '$(PREFIX)/share/man/man3',
-- INSTALLVENDORMAN3DIR => '$(PREFIX)/share/man/man3',
-+ INSTALLMAN1DIR => '$(PREFIX)/man/man1',
-+ INSTALLSITEMAN1DIR => '$(PREFIX)/man/man1',
-+ INSTALLVENDORMAN1DIR => '$(PREFIX)/man/man1',
-+ INSTALLMAN3DIR => '$(PREFIX)/man/man3',
-+ INSTALLSITEMAN3DIR => '$(PREFIX)/man/man3',
-+ INSTALLVENDORMAN3DIR => '$(PREFIX)/man/man3',
- SYSCONFDIR => '$(PREFIX)/etc/fusioninventory',
- DATADIR => '$(PREFIX)/share/fusioninventory',
- LOCALSTATEDIR => '$(PREFIX)/var/fusioninventory',
-@@ -201,7 +201,7 @@
- $manifypods =~ s/manifypods : pure_all/manifypods : pure_all fusioninventory-agent.1.html/;
- $manifypods .= <<'EOF';
- fusioninventory-agent.1.html: fusioninventory-agent
-- pod2html --infile=$< --outfile=$@
-+ pod2html --infile=$? --outfile=$@
-
- EOF
- return $manifypods;
diff --git a/net-mgmt/p5-FusionInventory-Agent/files/patch-add_jails_support b/net-mgmt/p5-FusionInventory-Agent/files/patch-add_jails_support
new file mode 100644
index 000000000000..4e2603612579
--- /dev/null
+++ b/net-mgmt/p5-FusionInventory-Agent/files/patch-add_jails_support
@@ -0,0 +1,64 @@
+--- lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Jails.pm 1970-01-01 01:00:00.000000000 +0100
++++ lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Jails.pm 2012-05-29 09:35:00.000000000 +0100
+@@ -0,0 +1,61 @@
++package FusionInventory::Agent::Task::Inventory::Input::Virtualization::Jails;
++
++use strict;
++use warnings;
++
++use FusionInventory::Agent::Tools;
++
++sub isEnabled {
++ return canRun('jls');
++}
++
++sub doInventory {
++ my (%params) = @_;
++
++ my $inventory = $params{inventory};
++ my $logger = $params{inventory};
++
++ my $command = 'jls -n';
++ foreach my $machine (_getVirtualMachines(logger => $logger)) {
++ $inventory->addEntry(
++ section => 'VIRTUALMACHINES', entry => $machine
++ );
++ }
++}
++
++sub _getVirtualMachines {
++ my (%params) = (
++ command => 'jls -n',
++ @_
++ );
++
++ my $handle = getFileHandle(%params);
++
++ return unless $handle;
++
++ my @machines;
++ while (my $line = <$handle>) {
++ my $info;
++ foreach my $item (split(' ', $line)) {
++ next unless $item =~ /(\S+)=(\S+)/;
++ my $key = $1;
++ my $value = $2;
++ $info->{$1} = $2;
++ }
++
++ my $machine = {
++ VMTYPE => 'jail',
++ NAME => $info->{'host.hostname'},
++ VMID => $info->{'jid'},
++ STATUS => 'running'
++ };
++
++ push @machines, $machine;
++
++ }
++ close $handle;
++
++ return @machines;
++}
++
++1;
diff --git a/net-mgmt/p5-FusionInventory-Agent/files/patch-fix_install_paths b/net-mgmt/p5-FusionInventory-Agent/files/patch-fix_install_paths
new file mode 100644
index 000000000000..e17d5e4a6c5a
--- /dev/null
+++ b/net-mgmt/p5-FusionInventory-Agent/files/patch-fix_install_paths
@@ -0,0 +1,26 @@
+--- Makefile.PL.orig 2012-04-05 10:25:15.000000000 +0200
++++ Makefile.PL 2012-04-17 12:20:45.000000000 +0200
+@@ -95,22 +95,12 @@
+
+ # for some reason, initialising variables from the global scope doesn't work
+ %variables = (
+- PREFIX => '/usr/local',
+- INSTALLSCRIPT => '$(PREFIX)/bin',
+- INSTALLSITESCRIPT => '$(PREFIX)/bin',
+- INSTALLVENDORSCRIPT => '$(PREFIX)/bin',
+ INSTALLLIB => '$(DATADIR)/lib',
+ INSTALLSITELIB => '$(DATADIR)/lib',
+ INSTALLVENDORLIB => '$(DATADIR)/lib',
+- INSTALLMAN1DIR => '$(PREFIX)/share/man/man1',
+- INSTALLSITEMAN1DIR => '$(PREFIX)/share/man/man1',
+- INSTALLVENDORMAN1DIR => '$(PREFIX)/share/man/man1',
+- INSTALLMAN3DIR => '$(PREFIX)/share/man/man3',
+- INSTALLSITEMAN3DIR => '$(PREFIX)/share/man/man3',
+- INSTALLVENDORMAN3DIR => '$(PREFIX)/share/man/man3',
+ SYSCONFDIR => '$(PREFIX)/etc/fusioninventory',
+ DATADIR => '$(PREFIX)/share/fusioninventory',
+- LOCALSTATEDIR => '$(PREFIX)/var/fusioninventory',
++ LOCALSTATEDIR => '/var/run/fusioninventory',
+ );
+
+ # allow variables defined on command line to override defaults
diff --git a/net-mgmt/p5-FusionInventory-Agent/files/patch-more_raid_support b/net-mgmt/p5-FusionInventory-Agent/files/patch-more_raid_support
new file mode 100644
index 000000000000..b6ba50d88b24
--- /dev/null
+++ b/net-mgmt/p5-FusionInventory-Agent/files/patch-more_raid_support
@@ -0,0 +1,442 @@
+--- lib/FusionInventory/Agent/Task/Inventory/Input/BSD/Storages/Megaraid.pm.orig 1970-01-01 01:00:00.000000000 +0100
++++ lib/FusionInventory/Agent/Task/Inventory/Input/BSD/Storages/Megaraid.pm 2012-08-24 11:02:56.000000000 +0200
+@@ -0,0 +1,50 @@
++package FusionInventory::Agent::Task::Inventory::Input::BSD::Storages::Megaraid;
++
++# Authors: Egor Shornikov <se@wbr.su>, Egor Morozov <akrus@flygroup.st>
++# License: GPLv2+
++
++use strict;
++use warnings;
++
++use FusionInventory::Agent::Tools;
++use FusionInventory::Agent::Task::Inventory::Input::BSD::Storages;
++
++sub isEnabled {
++ return canRun('mfiutil');
++}
++
++sub doInventory {
++ my (%params) = @_;
++
++ my $inventory = $params{inventory};
++ my $logger = $params{logger};
++
++ my $handle = getFileHandle(
++ logger => $logger,
++ command => 'mfiutil show drives'
++ );
++ return unless $handle;
++
++ while (my $line = <$handle>) {
++ unless ( $line =~ m/^[^(]*\(\s+(\d+\w+)\)\s+\S+\s+<(\S+)\s+(\S+)\s+\S+\s+serial=(\S+)>\s+(\S+)\s+.*$/ ) { next; }
++ my ( $size, $vendor, $model, $serial, $type ) = ( $1, $2, $3, $4, $5 );
++
++ if ( $size =~ /(\d+)G/ ){
++ $size = $1 * 1024;
++ } elsif( $size =~ /(\d+)T/ ){
++ $size = $1 * 1024 * 1024;
++ }
++
++ my $storage;
++ $storage->{NAME} = "$vendor $model";
++ $storage->{DESCRIPTION} = $type;
++ $storage->{TYPE} = 'disk';
++ $storage->{DISKSIZE} = $size;
++ $storage->{SERIALNUMBER} = $serial;
++
++ $inventory->addEntry(section => 'STORAGES', entry => $storage);
++ }
++ close $handle;
++}
++
++1;
+--- lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Storages/3ware.pm.orig 1970-01-01 01:00:00.000000000 +0100
++++ lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Storages/3ware.pm 2012-08-24 10:58:20.000000000 +0200
+@@ -0,0 +1,178 @@
++package FusionInventory::Agent::Task::Inventory::Input::Generic::Storages::3ware;
++
++use strict;
++use warnings;
++
++use FusionInventory::Agent::Tools;
++use FusionInventory::Agent::Tools::Linux;
++
++use English qw(-no_match_vars);
++
++# Tested on 2.6.* kernels
++#
++# Cards tested :
++#
++# 8006-2LP
++# 9500S-4LP
++# 9550SXU-4LP
++# 9550SXU-8LP
++# 9650SE-2LP
++# 9650SE-4LPML
++# 9650SE-8LPML
++#
++# AMCC/3ware CLI (version 2.00.0X.XXX)
++
++sub isEnabled {
++ return canRun('tw_cli');
++}
++
++sub doInventory {
++ my (%params) = @_;
++
++ my $inventory = $params{inventory};
++ my $logger = $params{logger};
++
++ my @devices;
++
++ foreach my $card (_getCards()) {
++ foreach my $unit (_getUnits($card)) {
++
++ # Try do get unit's serial in order to compare it to what was found
++ # in udev db.
++ # Works only on newer cards.
++ # Allow us to associate a node to a drive : sda -> WD-WMANS1648590
++ my $sn = getFirstMatch(
++ logger => $logger,
++ command => "tw_cli info $card->{id} $unit->{id} serial",
++ pattern => qr/serial number\s=\s(\w+)/
++ );
++
++ foreach my $port (_getPorts($card, $unit)) {
++ # Finally, getting drives' values.
++ my $storage = _getStorage($card, $port);
++
++ if ($OSNAME eq 'Linux') {
++
++ @devices = getDevicesFromUdev(logger => $logger) unless @devices;
++
++ foreach my $device (@devices) {
++# How does this work with multiple older cards
++# where serial for units is not implemented ?
++# Need to be tested on a system with multiple
++# 3ware cards.
++ if (
++ $device->{SERIALNUMBER} eq 'AMCC_' . $sn ||
++ $device->{MODEL} eq 'Logical_Disk_' . $unit->{index}
++ ) {
++ $storage->{NAME} = $device->{NAME};
++ }
++ }
++ }
++
++ $inventory->addEntry(section => 'STORAGES', entry => $storage);
++ }
++ }
++ }
++}
++
++
++sub _getCards {
++ my ($file) = @_;
++
++ my $handle = getFileHandle(
++ file => $file,
++ command => "tw_cli info"
++ );
++ return unless $handle;
++
++ my @cards;
++ while (my $line = <$handle>) {
++ next unless $line =~ /^(c\d+)\s+([\w-]+)/;
++ push @cards, { id => $1, model => $2 };
++ }
++ close $handle;
++
++ return @cards;
++}
++
++sub _getUnits {
++ my ($card, $file) = @_;
++
++ my $handle = getFileHandle(
++ file => $file,
++ command => "tw_cli info $card->{id}"
++ );
++ return unless $handle;
++
++ my @units;
++ while (my $line = <$handle>) {
++ next unless $line =~ /^(u(\d+))/;
++ push @units, { id => $1, index => $2 };
++ }
++ close $handle;
++
++ return @units;
++}
++
++sub _getPorts {
++ my ($card, $unit, $file) = @_;
++
++ my $handle = getFileHandle(
++ file => $file,
++ command => "tw_cli info $card->{id} $unit->{id}"
++ );
++ return unless $handle;
++
++ my @ports;
++ while (my $line = <$handle>) {
++ next unless $line =~ /(p\d+)/;
++ push @ports, { id => $1 };
++ }
++ close $handle;
++
++ return @ports;
++}
++
++sub _getStorage {
++ my ($card, $port, $file) = @_;
++
++ my $handle = getFileHandle(
++ file => $file,
++ command =>
++ "tw_cli info $card->{id} $port->{id} model serial capacity firmware"
++ );
++ return unless $handle;
++
++ my $storage;
++ while (my $line = <$handle>) {
++ if ($line =~ /Model\s=\s(.*)/) {
++ $storage->{MODEL} = $1;
++ } elsif ($line =~ /Serial\s=\s(.*)/) {
++ $storage->{SERIALNUMBER} = $1;
++ } elsif ($line =~ /Capacity\s=\s(\S+)\sGB.*/) {
++ $storage->{DISKSIZE} = 1024 * $1;
++ } elsif ($line =~ /Firmware Version\s=\s(.*)/) {
++ $storage->{FIRMWARE} = $1
++ }
++ }
++ close $handle;
++
++ $storage->{MANUFACTURER} = getCanonicalManufacturer(
++ $storage->{MODEL}
++ );
++ $storage->{TYPE} = 'disk';
++
++ # Getting description from card model, very basic
++ # and unreliable
++ # Assuming only IDE drives can be plugged in
++ # 5xxx/6xxx cards and
++ # SATA drives only to 7xxx/8xxx/9xxxx cards
++ $storage->{DESCRIPTION} =
++ $card->{model} =~ /^[56]/ ? 'IDE' :
++ $card->{model} =~ /^[789]/ ? 'SATA' :
++ undef;
++
++ return $storage;
++}
++
++1;
+--- lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/3ware.pm.orig 2012-08-24 10:57:58.000000000 +0200
++++ lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/3ware.pm 1970-01-01 01:00:00.000000000 +0100
+@@ -1,171 +0,0 @@
+-package FusionInventory::Agent::Task::Inventory::Input::Linux::Storages::3ware;
+-
+-use strict;
+-use warnings;
+-
+-use FusionInventory::Agent::Tools;
+-use FusionInventory::Agent::Tools::Linux;
+-
+-# Tested on 2.6.* kernels
+-#
+-# Cards tested :
+-#
+-# 8006-2LP
+-# 9500S-4LP
+-# 9550SXU-4LP
+-# 9550SXU-8LP
+-# 9650SE-2LP
+-# 9650SE-4LPML
+-# 9650SE-8LPML
+-#
+-# AMCC/3ware CLI (version 2.00.0X.XXX)
+-
+-sub isEnabled {
+- return canRun('tw_cli');
+-}
+-
+-sub doInventory {
+- my (%params) = @_;
+-
+- my $inventory = $params{inventory};
+- my $logger = $params{logger};
+-
+- my @devices = getDevicesFromUdev(logger => $logger);
+-
+- foreach my $card (_getCards()) {
+- foreach my $unit (_getUnits($card)) {
+-
+- # Try do get unit's serial in order to compare it to what was found
+- # in udev db.
+- # Works only on newer cards.
+- # Allow us to associate a node to a drive : sda -> WD-WMANS1648590
+- my $sn = getFirstMatch(
+- logger => $logger,
+- command => "tw_cli info $card->{id} $unit->{id} serial",
+- pattern => qr/serial number\s=\s(\w+)/
+- );
+-
+- foreach my $port (_getPorts($card, $unit)) {
+- # Finally, getting drives' values.
+- my $storage = _getStorage($card, $port);
+-
+- foreach my $device (@devices) {
+- # How does this work with multiple older cards
+- # where serial for units is not implemented ?
+- # Need to be tested on a system with multiple
+- # 3ware cards.
+- if (
+- $device->{SERIALNUMBER} eq 'AMCC_' . $sn ||
+- $device->{MODEL} eq 'Logical_Disk_' . $unit->{index}
+- ) {
+- $storage->{NAME} = $device->{NAME};
+- }
+- }
+-
+- $inventory->addEntry(section => 'STORAGES', entry => $storage);
+- }
+- }
+- }
+-}
+-
+-
+-sub _getCards {
+- my ($file) = @_;
+-
+- my $handle = getFileHandle(
+- file => $file,
+- command => "tw_cli info"
+- );
+- return unless $handle;
+-
+- my @cards;
+- while (my $line = <$handle>) {
+- next unless $line =~ /^(c\d+)\s+([\w-]+)/;
+- push @cards, { id => $1, model => $2 };
+- }
+- close $handle;
+-
+- return @cards;
+-}
+-
+-sub _getUnits {
+- my ($card, $file) = @_;
+-
+- my $handle = getFileHandle(
+- file => $file,
+- command => "tw_cli info $card->{id}"
+- );
+- return unless $handle;
+-
+- my @units;
+- while (my $line = <$handle>) {
+- next unless $line =~ /^(u(\d+))/;
+- push @units, { id => $1, index => $2 };
+- }
+- close $handle;
+-
+- return @units;
+-}
+-
+-sub _getPorts {
+- my ($card, $unit, $file) = @_;
+-
+- my $handle = getFileHandle(
+- file => $file,
+- command => "tw_cli info $card->{id} $unit->{id}"
+- );
+- return unless $handle;
+-
+- my @ports;
+- while (my $line = <$handle>) {
+- next unless $line =~ /(p\d+)/;
+- push @ports, { id => $1 };
+- }
+- close $handle;
+-
+- return @ports;
+-}
+-
+-sub _getStorage {
+- my ($card, $port, $file) = @_;
+-
+- my $handle = getFileHandle(
+- file => $file,
+- command =>
+- "tw_cli info $card->{id} $port->{id} model serial capacity firmware"
+- );
+- return unless $handle;
+-
+- my $storage;
+- while (my $line = <$handle>) {
+- if ($line =~ /Model\s=\s(.*)/) {
+- $storage->{MODEL} = $1;
+- } elsif ($line =~ /Serial\s=\s(.*)/) {
+- $storage->{SERIALNUMBER} = $1;
+- } elsif ($line =~ /Capacity\s=\s(\S+)\sGB.*/) {
+- $storage->{DISKSIZE} = 1024 * $1;
+- } elsif ($line =~ /Firmware Version\s=\s(.*)/) {
+- $storage->{FIRMWARE} = $1
+- }
+- }
+- close $handle;
+-
+- $storage->{MANUFACTURER} = getCanonicalManufacturer(
+- $storage->{MODEL}
+- );
+- $storage->{TYPE} = 'disk';
+-
+- # Getting description from card model, very basic
+- # and unreliable
+- # Assuming only IDE drives can be plugged in
+- # 5xxx/6xxx cards and
+- # SATA drives only to 7xxx/8xxx/9xxxx cards
+- $storage->{DESCRIPTION} =
+- $card->{model} =~ /^[56]/ ? 'IDE' :
+- $card->{model} =~ /^[789]/ ? 'SATA' :
+- undef;
+-
+- return $storage;
+-}
+-
+-1;
+--- MANIFEST.orig 2012-08-24 11:06:47.000000000 +0200
++++ MANIFEST 2012-08-24 11:07:32.000000000 +0200
+@@ -67,6 +67,7 @@
+ lib/FusionInventory/Agent/Task/Inventory/Input/BSD/Networks.pm
+ lib/FusionInventory/Agent/Task/Inventory/Input/BSD/Softwares.pm
+ lib/FusionInventory/Agent/Task/Inventory/Input/BSD/Storages.pm
++lib/FusionInventory/Agent/Task/Inventory/Input/BSD/Storages/Megaraid.pm
+ lib/FusionInventory/Agent/Task/Inventory/Input/BSD/Uptime.pm
+ lib/FusionInventory/Agent/Task/Inventory/Input/Generic.pm
+ lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Dmidecode.pm
+@@ -94,6 +95,7 @@
+ lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Softwares/RPM.pm
+ lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Softwares/Slackware.pm
+ lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Storages.pm
++lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Storages/3ware.pm
+ lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Storages/HP.pm
+ lib/FusionInventory/Agent/Task/Inventory/Input/Generic/USB.pm
+ lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Users.pm
+@@ -128,7 +130,6 @@
+ lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Memory.pm
+ lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Networks.pm
+ lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages.pm
+-lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/3ware.pm
+ lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Adaptec.pm
+ lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Lsilogic.pm
+ lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/ServeRaid.pm
+@@ -160,6 +161,7 @@
+ lib/FusionInventory/Agent/Task/Inventory/Input/Solaris/Storages.pm
+ lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization.pm
+ lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Hpvm.pm
++lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Jails.pm
+ lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Libvirt.pm
+ lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Lxc.pm
+ lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Parallels.pm
diff --git a/net-mgmt/p5-FusionInventory-Agent/pkg-plist b/net-mgmt/p5-FusionInventory-Agent/pkg-plist
index 67bd7a01ade7..29098233fcdf 100644
--- a/net-mgmt/p5-FusionInventory-Agent/pkg-plist
+++ b/net-mgmt/p5-FusionInventory-Agent/pkg-plist
@@ -1,12 +1,5 @@
bin/fusioninventory-agent
bin/fusioninventory-injector
-etc/fusioninventory/agent.cfg
-share/fusioninventory/html/favicon.ico
-share/fusioninventory/html/index.tpl
-share/fusioninventory/html/inventory.tpl
-share/fusioninventory/html/logo.png
-share/fusioninventory/html/now.tpl
-share/fusioninventory/html/site.css
share/fusioninventory/lib/FusionInventory/Agent.pm
share/fusioninventory/lib/FusionInventory/Agent/Config.pm
share/fusioninventory/lib/FusionInventory/Agent/HTTP/Client.pm
@@ -52,6 +45,7 @@ share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Input/BSD/Drives.
share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Input/BSD/Memory.pm
share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Input/BSD/Networks.pm
share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Input/BSD/Softwares.pm
+share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Input/BSD/Storages/Megaraid.pm
share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Input/BSD/Storages.pm
share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Input/BSD/Uptime.pm
share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Input/Generic.pm
@@ -80,6 +74,7 @@ share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Sof
share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Softwares/RPM.pm
share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Softwares/Slackware.pm
share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Storages.pm
+share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Storages/3ware.pm
share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Storages/HP.pm
share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/USB.pm
share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Users.pm
@@ -113,7 +108,6 @@ share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/LVM.p
share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Memory.pm
share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Networks.pm
share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages.pm
-share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/3ware.pm
share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Adaptec.pm
share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/Lsilogic.pm
share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Input/Linux/Storages/ServeRaid.pm
@@ -146,6 +140,7 @@ share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Input/Solaris/Sof
share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Input/Solaris/Storages.pm
share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization.pm
share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Hpvm.pm
+share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Jails.pm
share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Libvirt.pm
share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Lxc.pm
share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Parallels.pm
@@ -199,7 +194,14 @@ share/fusioninventory/lib/FusionInventory/Agent/XML/Query.pm
share/fusioninventory/lib/FusionInventory/Agent/XML/Query/Inventory.pm
share/fusioninventory/lib/FusionInventory/Agent/XML/Query/Prolog.pm
share/fusioninventory/lib/FusionInventory/Agent/XML/Response.pm
+share/fusioninventory/html/favicon.ico
+share/fusioninventory/html/index.tpl
+share/fusioninventory/html/inventory.tpl
+share/fusioninventory/html/logo.png
+share/fusioninventory/html/now.tpl
+share/fusioninventory/html/site.css
share/fusioninventory/pci.ids
+@dirrm share/fusioninventory/html
@dirrm share/fusioninventory/lib/FusionInventory/Agent/XML/Query
@dirrm share/fusioninventory/lib/FusionInventory/Agent/XML
@dirrm share/fusioninventory/lib/FusionInventory/Agent/Tools
@@ -218,6 +220,7 @@ share/fusioninventory/pci.ids
@dirrm share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Dmidecode
@dirrm share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Input/Generic
@dirrm share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Input/BSD/Archs
+@dirrm share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Input/BSD/Storages
@dirrm share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Input/BSD
@dirrm share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Input/AIX
@dirrm share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Input
@@ -231,6 +234,5 @@ share/fusioninventory/pci.ids
@dirrm share/fusioninventory/lib/FusionInventory/Agent
@dirrm share/fusioninventory/lib/FusionInventory
@dirrm share/fusioninventory/lib
-@dirrm share/fusioninventory/html
@dirrm share/fusioninventory
@dirrmtry etc/fusioninventory