@@ -1,22 +1,44 @@
1−{ stdenv, fetchurl, buildPerlPackage, perlPackages
1+{ stdenv, lib, fetchurl, buildPerlPackage, perlPackages, gnused, nix, dmidecode, pciutils, usbutils, iproute, nettools
2+, fetchFromGitHub, makeWrapper
23}:
34
45buildPerlPackage rec {
5− version = "2.3.18";
66 name = "FusionInventory-Agent-${version}";
7− src = fetchurl {
8− url = "mirror://cpan/authors/id/G/GR/GROUSSE/${name}.tar.gz";
9− sha256 = "543d96fa61b8f2a2bc599fe9f694f19d1f2094dc5506bc514d00b8a445bc5401";
7+ version = "2.3.21";
8+
9+ src = fetchFromGitHub {
10+ owner = "fusioninventory";
11+ repo = "fusioninventory-agent";
12+ rev = version;
13+ sha256 = "034clffcn0agx85macjgml4lyhvvck7idn94pqd2c77pk6crvw2y";
1014 };
1115
12− patches = [ ./remove_software_test.patch ];
16+ patches = [
17+ ./remove_software_test.patch
18+ # support for os-release file
19+ (fetchurl {
20+ url = https://github.com/fusioninventory/fusioninventory-agent/pull/396.diff;
21+ sha256 = "0bxrjmff80ab01n23xggci32ajsah6zvcmz5x4hj6ayy6dzwi6jb";
22+ })
23+ # support for Nix software inventory
24+ (fetchurl {
25+ url = https://github.com/fusioninventory/fusioninventory-agent/pull/397.diff;
26+ sha256 = "0pyf7mp0zsb3zcqb6yysr1zfp54p9ciwjn1pzayw6s9flmcgrmbw";
27+ })
28+ ];
1329
1430 postPatch = ''
31+
1532 patchShebangs bin
33+
34+ substituteInPlace "lib/FusionInventory/Agent/Tools/Linux.pm" \
35+ --replace /sbin/ip ${iproute}/sbin/ip
36+ substituteInPlace "lib/FusionInventory/Agent/Task/Inventory/Linux/Networks.pm" \
37+ --replace /sbin/ip ${iproute}/sbin/ip
1638 '';
1739
1840 buildTools = [];
19− buildInputs = with perlPackages; [
41+ buildInputs = [ makeWrapper ] ++ (with perlPackages; [
2042 CGI
2143 DataStructureUtil
2244 FileCopyRecursive
@@ -28,6 +50,7 @@ buildPerlPackage rec {
2850 IPCRun
2951 JSON
3052 LWPProtocolhttps
53+ ModuleInstall
3154 NetSNMP
3255 TestCompile
3356 TestDeep
@@ -35,7 +58,7 @@ buildPerlPackage rec {
3558 TestMockModule
3659 TestMockObject
3760 TestNoWarnings
38− ];
61+ ]);
3962 propagatedBuildInputs = with perlPackages; [
4063 FileWhich
4164 LWP
@@ -52,7 +75,10 @@ buildPerlPackage rec {
5275 cp -r lib $out
5376
5477 for cur in $out/bin/*; do
55− sed -e "s|./lib|$out/lib|" -i "$cur"
78+ if [ -x "$cur" ]; then
79+ sed -e "s|./lib|$out/lib|" -i "$cur"
80+ wrapProgram "$cur" --prefix PATH : ${lib.makeBinPath [nix dmidecode pciutils usbutils nettools iproute]}
81+ fi
5682 done
5783 '';
5884