ntopng: 1.2.1 -> 2.0.0

This commit is contained in:
Mariusz `shd` Gliwiński 2015-10-28 13:35:09 +01:00
parent 51ca02f95f
commit 6783f8dd7b
3 changed files with 35 additions and 56 deletions

View File

@ -1,24 +1,12 @@
From d0c56a14e0432faca1e9438b84e5e4090d293bb9 Mon Sep 17 00:00:00 2001 diff --git a/src/Prefs.cpp b/src/Prefs.cpp
From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= <bjorn.forsman@gmail.com> index 76385c4..db8d20d 100755
Date: Tue, 3 Dec 2013 20:42:24 +0000 --- a/src/Prefs.cpp
Subject: [PATCH 1/2] Undo weird modification of data_dir +++ b/src/Prefs.cpp
@@ -795,7 +795,6 @@ int Prefs::checkOptions() {
--- ntop->getTrace()->traceEvent(TRACE_ERROR, "Unable to create log %s", path);
Prefs.cpp | 1 - }
1 file changed, 1 deletion(-)
diff --git a/Prefs.cpp b/Prefs.cpp
index b4fde5f..ca04ca1 100644
--- a/Prefs.cpp
+++ b/Prefs.cpp
@@ -408,7 +408,6 @@ int Prefs::checkOptions() {
ntop->getTrace()->traceEvent(TRACE_ERROR, "Unable to create log %s", path);
}
- free(data_dir); data_dir = strdup(ntop->get_install_dir()); - free(data_dir); data_dir = strdup(ntop->get_install_dir());
docs_dir = ntop->getValidPath(docs_dir); docs_dir = ntop->getValidPath(docs_dir);
scripts_dir = ntop->getValidPath(scripts_dir); scripts_dir = ntop->getValidPath(scripts_dir);
callbacks_dir = ntop->getValidPath(callbacks_dir); callbacks_dir = ntop->getValidPath(callbacks_dir);
--
1.8.4.3

View File

@ -1,29 +1,14 @@
From d77b42003d13e2775be3255a26f380d6ccda8042 Mon Sep 17 00:00:00 2001 diff --git a/src/Ntop.cpp b/src/Ntop.cpp
From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= <bjorn.forsman@gmail.com> index 8de92a9..510418f 100644
Date: Tue, 3 Dec 2013 21:10:06 +0000 --- a/src/Ntop.cpp
Subject: [PATCH 2/2] Remove requirement to have writeable callback dir +++ b/src/Ntop.cpp
@@ -197,8 +197,7 @@ void Ntop::registerPrefs(Prefs *_prefs) {
* ntopng doesn't write anything to the callback dir
* it seems to be a copy-paste leftover error from data_dir a couple of
lines above
---
Ntop.cpp | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/Ntop.cpp b/Ntop.cpp
index 2fb027b..0b4881b 100644
--- a/Ntop.cpp
+++ b/Ntop.cpp
@@ -114,8 +114,7 @@ void Ntop::registerPrefs(Prefs *_prefs) {
} }
if(stat(prefs->get_callbacks_dir(), &statbuf) if(stat(prefs->get_callbacks_dir(), &statbuf)
- || (!(statbuf.st_mode & S_IFDIR)) /* It's not a directory */ - || (!(statbuf.st_mode & S_IFDIR)) /* It's not a directory */
- || (!(statbuf.st_mode & S_IWRITE)) /* It's not writable */) { - || (!(statbuf.st_mode & S_IWRITE)) /* It's not writable */) {
+ || (!(statbuf.st_mode & S_IFDIR))) { /* It's not a directory */ + || (!(statbuf.st_mode & S_IFDIR)) /* It's not a directory */) {
ntop->getTrace()->traceEvent(TRACE_ERROR, "Invalid directory %s specified", ntop->getTrace()->traceEvent(TRACE_ERROR, "Invalid directory %s specified",
prefs->get_callbacks_dir()); prefs->get_callbacks_dir());
exit(-1); _exit(-1);
--
1.8.4.3

View File

@ -1,20 +1,20 @@
{ stdenv, fetchurl, libpcap, gnutls, libgcrypt, libxml2, glib { stdenv, fetchurl, libpcap,/* gnutls, libgcrypt,*/ libxml2, glib
, geoip, geolite-legacy, sqlite, which, autoreconfHook, subversion , geoip, geolite-legacy, sqlite, which, autoreconfHook, git
, pkgconfig, groff , pkgconfig, groff, curl, json_c
}: }:
# ntopng includes LuaJIT, mongoose, rrdtool and zeromq in its third-party/ # ntopng includes LuaJIT, mongoose, rrdtool and zeromq in its third-party/
# directory. # directory.
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "ntopng-1.2.1"; name = "ntopng-2.0";
src = fetchurl { src = fetchurl {
urls = [ urls = [
"mirror://sourceforge/project/ntop/ntopng/old/${name}.tgz" "mirror://sourceforge/project/ntop/ntopng/old/${name}.tar.gz"
"mirror://sourceforge/project/ntop/ntopng/${name}.tgz" "mirror://sourceforge/project/ntop/ntopng/${name}.tar.gz"
]; ];
sha256 = "1db83cd1v4ivl8hxzzdvvdcgk22ji7mwrfnd5nnwll6kb11i364v"; sha256 = "0l82ivh05cmmqcvs26r6y69z849d28njipphqzvnakf43ggddgrw";
}; };
patches = [ patches = [
@ -22,25 +22,31 @@ stdenv.mkDerivation rec {
./0002-Remove-requirement-to-have-writeable-callback-dir.patch ./0002-Remove-requirement-to-have-writeable-callback-dir.patch
]; ];
buildInputs = [ libpcap gnutls libgcrypt libxml2 glib geoip geolite-legacy buildInputs = [ libpcap/* gnutls libgcrypt*/ libxml2 glib geoip geolite-legacy
sqlite which autoreconfHook subversion pkgconfig groff ]; sqlite which autoreconfHook git pkgconfig groff curl json_c ];
autoreconfPhase = ''
substituteInPlace autogen.sh --replace "/bin/rm" "rm"
substituteInPlace nDPI/autogen.sh --replace "/bin/rm" "rm"
$shell autogen.sh
'';
preConfigure = '' preConfigure = ''
find . -name Makefile.in | xargs sed -i "s|/bin/rm|rm|" substituteInPlace Makefile.in --replace "/bin/rm" "rm"
''; '';
preBuild = '' preBuild = ''
sed -e "s|/usr/local|$out|g" \ substituteInPlace src/Ntop.cpp --replace "/usr/local" "$out"
-i Ntop.cpp
sed -e "s|\(#define CONST_DEFAULT_DATA_DIR\).*|\1 \"/var/lib/ntopng\"|g" \ sed -e "s|\(#define CONST_DEFAULT_DATA_DIR\).*|\1 \"/var/lib/ntopng\"|g" \
-e "s|\(#define CONST_DEFAULT_DOCS_DIR\).*|\1 \"$out/share/ntopng/httpdocs\"|g" \ -e "s|\(#define CONST_DEFAULT_DOCS_DIR\).*|\1 \"$out/share/ntopng/httpdocs\"|g" \
-e "s|\(#define CONST_DEFAULT_SCRIPTS_DIR\).*|\1 \"$out/share/ntopng/scripts\"|g" \ -e "s|\(#define CONST_DEFAULT_SCRIPTS_DIR\).*|\1 \"$out/share/ntopng/scripts\"|g" \
-e "s|\(#define CONST_DEFAULT_CALLBACKS_DIR\).*|\1 \"$out/share/ntopng/scripts/callbacks\"|g" \ -e "s|\(#define CONST_DEFAULT_CALLBACKS_DIR\).*|\1 \"$out/share/ntopng/scripts/callbacks\"|g" \
-e "s|\(#define CONST_DEFAULT_INSTALL_DIR\).*|\1 \"$out/share/ntopng\"|g" \ -e "s|\(#define CONST_DEFAULT_INSTALL_DIR\).*|\1 \"$out/share/ntopng\"|g" \
-i ntop_defines.h -i include/ntop_defines.h
rmdir httpdocs/geoip rm -rf httpdocs/geoip
ln -s ${geolite-legacy}/share/GeoIP httpdocs/geoip ln -s ${geolite-legacy}/share/GeoIP httpdocs/geoip
''; '';