From 6783f8dd7b197a4dc02de33a24f07d229063e339 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mariusz=20=60shd=60=20Gliwi=C5=84ski?= Date: Wed, 28 Oct 2015 13:35:09 +0100 Subject: [PATCH] ntopng: 1.2.1 -> 2.0.0 --- ...-Undo-weird-modification-of-data_dir.patch | 26 ++++---------- ...ement-to-have-writeable-callback-dir.patch | 31 +++++------------ pkgs/tools/networking/ntopng/default.nix | 34 +++++++++++-------- 3 files changed, 35 insertions(+), 56 deletions(-) diff --git a/pkgs/tools/networking/ntopng/0001-Undo-weird-modification-of-data_dir.patch b/pkgs/tools/networking/ntopng/0001-Undo-weird-modification-of-data_dir.patch index 8bec643c6e5..d794efeac08 100644 --- a/pkgs/tools/networking/ntopng/0001-Undo-weird-modification-of-data_dir.patch +++ b/pkgs/tools/networking/ntopng/0001-Undo-weird-modification-of-data_dir.patch @@ -1,24 +1,12 @@ -From d0c56a14e0432faca1e9438b84e5e4090d293bb9 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= -Date: Tue, 3 Dec 2013 20:42:24 +0000 -Subject: [PATCH 1/2] Undo weird modification of data_dir - ---- - 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); - } +diff --git a/src/Prefs.cpp b/src/Prefs.cpp +index 76385c4..db8d20d 100755 +--- a/src/Prefs.cpp ++++ b/src/Prefs.cpp +@@ -795,7 +795,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()); docs_dir = ntop->getValidPath(docs_dir); scripts_dir = ntop->getValidPath(scripts_dir); callbacks_dir = ntop->getValidPath(callbacks_dir); --- -1.8.4.3 - diff --git a/pkgs/tools/networking/ntopng/0002-Remove-requirement-to-have-writeable-callback-dir.patch b/pkgs/tools/networking/ntopng/0002-Remove-requirement-to-have-writeable-callback-dir.patch index 99467c37126..50ed1daebd4 100644 --- a/pkgs/tools/networking/ntopng/0002-Remove-requirement-to-have-writeable-callback-dir.patch +++ b/pkgs/tools/networking/ntopng/0002-Remove-requirement-to-have-writeable-callback-dir.patch @@ -1,29 +1,14 @@ -From d77b42003d13e2775be3255a26f380d6ccda8042 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= -Date: Tue, 3 Dec 2013 21:10:06 +0000 -Subject: [PATCH 2/2] Remove requirement to have writeable callback dir - -* 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) { +diff --git a/src/Ntop.cpp b/src/Ntop.cpp +index 8de92a9..510418f 100644 +--- a/src/Ntop.cpp ++++ b/src/Ntop.cpp +@@ -197,8 +197,7 @@ void Ntop::registerPrefs(Prefs *_prefs) { } 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_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", prefs->get_callbacks_dir()); - exit(-1); --- -1.8.4.3 - + _exit(-1); diff --git a/pkgs/tools/networking/ntopng/default.nix b/pkgs/tools/networking/ntopng/default.nix index ddb6a7bec36..c17c33af17e 100644 --- a/pkgs/tools/networking/ntopng/default.nix +++ b/pkgs/tools/networking/ntopng/default.nix @@ -1,20 +1,20 @@ -{ stdenv, fetchurl, libpcap, gnutls, libgcrypt, libxml2, glib -, geoip, geolite-legacy, sqlite, which, autoreconfHook, subversion -, pkgconfig, groff +{ stdenv, fetchurl, libpcap,/* gnutls, libgcrypt,*/ libxml2, glib +, geoip, geolite-legacy, sqlite, which, autoreconfHook, git +, pkgconfig, groff, curl, json_c }: # ntopng includes LuaJIT, mongoose, rrdtool and zeromq in its third-party/ # directory. stdenv.mkDerivation rec { - name = "ntopng-1.2.1"; + name = "ntopng-2.0"; src = fetchurl { urls = [ - "mirror://sourceforge/project/ntop/ntopng/old/${name}.tgz" - "mirror://sourceforge/project/ntop/ntopng/${name}.tgz" + "mirror://sourceforge/project/ntop/ntopng/old/${name}.tar.gz" + "mirror://sourceforge/project/ntop/ntopng/${name}.tar.gz" ]; - sha256 = "1db83cd1v4ivl8hxzzdvvdcgk22ji7mwrfnd5nnwll6kb11i364v"; + sha256 = "0l82ivh05cmmqcvs26r6y69z849d28njipphqzvnakf43ggddgrw"; }; patches = [ @@ -22,25 +22,31 @@ stdenv.mkDerivation rec { ./0002-Remove-requirement-to-have-writeable-callback-dir.patch ]; - buildInputs = [ libpcap gnutls libgcrypt libxml2 glib geoip geolite-legacy - sqlite which autoreconfHook subversion pkgconfig groff ]; + buildInputs = [ libpcap/* gnutls libgcrypt*/ libxml2 glib geoip geolite-legacy + 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 = '' - find . -name Makefile.in | xargs sed -i "s|/bin/rm|rm|" + substituteInPlace Makefile.in --replace "/bin/rm" "rm" ''; preBuild = '' - sed -e "s|/usr/local|$out|g" \ - -i Ntop.cpp + substituteInPlace src/Ntop.cpp --replace "/usr/local" "$out" 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_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_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 '';