tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
ntopng: 1.2.1 -> 2.0.0
Mariusz `shd` Gliwiński
10 years ago
6783f8dd
51ca02f9
+35
-56
3 changed files
expand all
collapse all
unified
split
pkgs
tools
networking
ntopng
0001-Undo-weird-modification-of-data_dir.patch
0002-Remove-requirement-to-have-writeable-callback-dir.patch
default.nix
+7
-19
pkgs/tools/networking/ntopng/0001-Undo-weird-modification-of-data_dir.patch
···
1
-
From d0c56a14e0432faca1e9438b84e5e4090d293bb9 Mon Sep 17 00:00:00 2001
2
-
From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= <bjorn.forsman@gmail.com>
3
-
Date: Tue, 3 Dec 2013 20:42:24 +0000
4
-
Subject: [PATCH 1/2] Undo weird modification of data_dir
5
-
6
-
---
7
-
Prefs.cpp | 1 -
8
-
1 file changed, 1 deletion(-)
9
-
10
-
diff --git a/Prefs.cpp b/Prefs.cpp
11
-
index b4fde5f..ca04ca1 100644
12
-
--- a/Prefs.cpp
13
-
+++ b/Prefs.cpp
14
-
@@ -408,7 +408,6 @@ int Prefs::checkOptions() {
15
-
ntop->getTrace()->traceEvent(TRACE_ERROR, "Unable to create log %s", path);
16
-
}
17
18
- free(data_dir); data_dir = strdup(ntop->get_install_dir());
19
docs_dir = ntop->getValidPath(docs_dir);
20
scripts_dir = ntop->getValidPath(scripts_dir);
21
callbacks_dir = ntop->getValidPath(callbacks_dir);
22
-
--
23
-
1.8.4.3
24
-
···
1
+
diff --git a/src/Prefs.cpp b/src/Prefs.cpp
2
+
index 76385c4..db8d20d 100755
3
+
--- a/src/Prefs.cpp
4
+
+++ b/src/Prefs.cpp
5
+
@@ -795,7 +795,6 @@ int Prefs::checkOptions() {
6
+
ntop->getTrace()->traceEvent(TRACE_ERROR, "Unable to create log %s", path);
7
+
}
0
0
0
0
0
0
0
0
0
8
9
- free(data_dir); data_dir = strdup(ntop->get_install_dir());
10
docs_dir = ntop->getValidPath(docs_dir);
11
scripts_dir = ntop->getValidPath(scripts_dir);
12
callbacks_dir = ntop->getValidPath(callbacks_dir);
0
0
0
+8
-23
pkgs/tools/networking/ntopng/0002-Remove-requirement-to-have-writeable-callback-dir.patch
···
1
-
From d77b42003d13e2775be3255a26f380d6ccda8042 Mon Sep 17 00:00:00 2001
2
-
From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= <bjorn.forsman@gmail.com>
3
-
Date: Tue, 3 Dec 2013 21:10:06 +0000
4
-
Subject: [PATCH 2/2] Remove requirement to have writeable callback dir
5
-
6
-
* ntopng doesn't write anything to the callback dir
7
-
* it seems to be a copy-paste leftover error from data_dir a couple of
8
-
lines above
9
-
---
10
-
Ntop.cpp | 3 +--
11
-
1 file changed, 1 insertion(+), 2 deletions(-)
12
-
13
-
diff --git a/Ntop.cpp b/Ntop.cpp
14
-
index 2fb027b..0b4881b 100644
15
-
--- a/Ntop.cpp
16
-
+++ b/Ntop.cpp
17
-
@@ -114,8 +114,7 @@ void Ntop::registerPrefs(Prefs *_prefs) {
18
}
19
20
if(stat(prefs->get_callbacks_dir(), &statbuf)
21
-
- || (!(statbuf.st_mode & S_IFDIR)) /* It's not a directory */
22
- || (!(statbuf.st_mode & S_IWRITE)) /* It's not writable */) {
23
-
+ || (!(statbuf.st_mode & S_IFDIR))) { /* It's not a directory */
24
ntop->getTrace()->traceEvent(TRACE_ERROR, "Invalid directory %s specified",
25
prefs->get_callbacks_dir());
26
-
exit(-1);
27
-
--
28
-
1.8.4.3
29
-
···
1
+
diff --git a/src/Ntop.cpp b/src/Ntop.cpp
2
+
index 8de92a9..510418f 100644
3
+
--- a/src/Ntop.cpp
4
+
+++ b/src/Ntop.cpp
5
+
@@ -197,8 +197,7 @@ void Ntop::registerPrefs(Prefs *_prefs) {
0
0
0
0
0
0
0
0
0
0
0
0
6
}
7
8
if(stat(prefs->get_callbacks_dir(), &statbuf)
9
+
- || (!(statbuf.st_mode & S_IFDIR)) /* It's not a directory */
10
- || (!(statbuf.st_mode & S_IWRITE)) /* It's not writable */) {
11
+
+ || (!(statbuf.st_mode & S_IFDIR)) /* It's not a directory */) {
12
ntop->getTrace()->traceEvent(TRACE_ERROR, "Invalid directory %s specified",
13
prefs->get_callbacks_dir());
14
+
_exit(-1);
0
0
0
+20
-14
pkgs/tools/networking/ntopng/default.nix
···
1
-
{ stdenv, fetchurl, libpcap, gnutls, libgcrypt, libxml2, glib
2
-
, geoip, geolite-legacy, sqlite, which, autoreconfHook, subversion
3
-
, pkgconfig, groff
4
}:
5
6
# ntopng includes LuaJIT, mongoose, rrdtool and zeromq in its third-party/
7
# directory.
8
9
stdenv.mkDerivation rec {
10
-
name = "ntopng-1.2.1";
11
12
src = fetchurl {
13
urls = [
14
-
"mirror://sourceforge/project/ntop/ntopng/old/${name}.tgz"
15
-
"mirror://sourceforge/project/ntop/ntopng/${name}.tgz"
16
];
17
-
sha256 = "1db83cd1v4ivl8hxzzdvvdcgk22ji7mwrfnd5nnwll6kb11i364v";
18
};
19
20
patches = [
···
22
./0002-Remove-requirement-to-have-writeable-callback-dir.patch
23
];
24
25
-
buildInputs = [ libpcap gnutls libgcrypt libxml2 glib geoip geolite-legacy
26
-
sqlite which autoreconfHook subversion pkgconfig groff ];
0
0
0
0
0
0
0
27
28
preConfigure = ''
29
-
find . -name Makefile.in | xargs sed -i "s|/bin/rm|rm|"
30
'';
31
32
preBuild = ''
33
-
sed -e "s|/usr/local|$out|g" \
34
-
-i Ntop.cpp
35
36
sed -e "s|\(#define CONST_DEFAULT_DATA_DIR\).*|\1 \"/var/lib/ntopng\"|g" \
37
-e "s|\(#define CONST_DEFAULT_DOCS_DIR\).*|\1 \"$out/share/ntopng/httpdocs\"|g" \
38
-e "s|\(#define CONST_DEFAULT_SCRIPTS_DIR\).*|\1 \"$out/share/ntopng/scripts\"|g" \
39
-e "s|\(#define CONST_DEFAULT_CALLBACKS_DIR\).*|\1 \"$out/share/ntopng/scripts/callbacks\"|g" \
40
-e "s|\(#define CONST_DEFAULT_INSTALL_DIR\).*|\1 \"$out/share/ntopng\"|g" \
41
-
-i ntop_defines.h
42
43
-
rmdir httpdocs/geoip
44
ln -s ${geolite-legacy}/share/GeoIP httpdocs/geoip
45
'';
46
···
1
+
{ stdenv, fetchurl, libpcap,/* gnutls, libgcrypt,*/ libxml2, glib
2
+
, geoip, geolite-legacy, sqlite, which, autoreconfHook, git
3
+
, pkgconfig, groff, curl, json_c
4
}:
5
6
# ntopng includes LuaJIT, mongoose, rrdtool and zeromq in its third-party/
7
# directory.
8
9
stdenv.mkDerivation rec {
10
+
name = "ntopng-2.0";
11
12
src = fetchurl {
13
urls = [
14
+
"mirror://sourceforge/project/ntop/ntopng/old/${name}.tar.gz"
15
+
"mirror://sourceforge/project/ntop/ntopng/${name}.tar.gz"
16
];
17
+
sha256 = "0l82ivh05cmmqcvs26r6y69z849d28njipphqzvnakf43ggddgrw";
18
};
19
20
patches = [
···
22
./0002-Remove-requirement-to-have-writeable-callback-dir.patch
23
];
24
25
+
buildInputs = [ libpcap/* gnutls libgcrypt*/ libxml2 glib geoip geolite-legacy
26
+
sqlite which autoreconfHook git pkgconfig groff curl json_c ];
27
+
28
+
29
+
autoreconfPhase = ''
30
+
substituteInPlace autogen.sh --replace "/bin/rm" "rm"
31
+
substituteInPlace nDPI/autogen.sh --replace "/bin/rm" "rm"
32
+
$shell autogen.sh
33
+
'';
34
35
preConfigure = ''
36
+
substituteInPlace Makefile.in --replace "/bin/rm" "rm"
37
'';
38
39
preBuild = ''
40
+
substituteInPlace src/Ntop.cpp --replace "/usr/local" "$out"
0
41
42
sed -e "s|\(#define CONST_DEFAULT_DATA_DIR\).*|\1 \"/var/lib/ntopng\"|g" \
43
-e "s|\(#define CONST_DEFAULT_DOCS_DIR\).*|\1 \"$out/share/ntopng/httpdocs\"|g" \
44
-e "s|\(#define CONST_DEFAULT_SCRIPTS_DIR\).*|\1 \"$out/share/ntopng/scripts\"|g" \
45
-e "s|\(#define CONST_DEFAULT_CALLBACKS_DIR\).*|\1 \"$out/share/ntopng/scripts/callbacks\"|g" \
46
-e "s|\(#define CONST_DEFAULT_INSTALL_DIR\).*|\1 \"$out/share/ntopng\"|g" \
47
+
-i include/ntop_defines.h
48
49
+
rm -rf httpdocs/geoip
50
ln -s ${geolite-legacy}/share/GeoIP httpdocs/geoip
51
'';
52