From 0c9a566a742e665ddfb856e6ac7b33596871525c Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Thu, 14 May 2015 09:13:59 -0300 Subject: Sanitize ntopng version, add depends, category and fix pbi detection for 2.3 --- config/ntopng/ntopng.xml | 32 +++++++++++++++++++++++--------- pkg_config.10.xml | 4 +++- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/config/ntopng/ntopng.xml b/config/ntopng/ntopng.xml index 9382912a..2bb957b4 100644 --- a/config/ntopng/ntopng.xml +++ b/config/ntopng/ntopng.xml @@ -153,9 +153,7 @@ $ntopng_config =& $config['installedpackages']['ntopng']['config'][0]; $if_final = ""; $ifaces_final = ""; - system("/bin/mkdir -p /var/db/ntopng"); - system("/bin/mkdir -p /var/db/ntopng/rrd"); - system("/bin/mkdir -p /var/db/ntopng/rrd/graphics"); + mkdir("/var/db/ntopng/rrd/graphics", 0755, true); system("/bin/chmod -R 755 /var/db/ntopng"); system("/usr/sbin/chown -R nobody:nobody /var/db/ntopng"); system("/bin/cp -Rp /usr/local/lib/X11/fonts/webfonts/ /usr/local/lib/X11/fonts/TTF/"); @@ -206,13 +204,18 @@ } $pf_version=substr(trim(file_get_contents("/etc/version")),0,3); - if ($pf_version >= 2.2) { + if ($pf_version == "2.2") { $redis_path = "/usr/pbi/ntopng-" . php_uname("m") . "/local/bin"; - } else { + } else if ($pf_version == "2.1") { $redis_path = "/usr/pbi/ntopng-" . php_uname("m") . "/bin"; + } else { + $redis_path = "/usr/local/bin"; } - $start = "ldconfig -m /usr/pbi/ntopng-" . php_uname("m") . "/lib\n"; + $start = ""; + if ($pf_version == "2.1" || $pf_version == "2.2") { + $start .= "ldconfig -m /usr/pbi/ntopng-" . php_uname("m") . "/lib\n"; + } $start .= "\t{$redis_path}/redis-server --dir /var/db/ntopng/ --dbfilename ntopng.rdb &\n"; // TODO: // Add support for --data-dir /somewhere, --httpdocs-dir /somewhereelse, @@ -243,13 +246,24 @@ config_unlock(); } function ntopng_update_geoip() { - mwexec("/usr/pbi/ntopng-" . php_uname("m") . "/bin/ntopng-geoipupdate.sh"); + $pf_version=substr(trim(file_get_contents("/etc/version")),0,3); + if ($pf_version == "2.1" || $pf_version == "2.2") { + mwexec("/usr/pbi/ntopng-" . php_uname("m") . "/bin/ntopng-geoipupdate.sh"); + } else { + mwexec("/usr/local/bin/ntopng-geoipupdate.sh"); + } ntopng_fixup_geoip(); restart_service("ntopng"); } function ntopng_fixup_geoip() { - $target_dir = "/usr/pbi/ntopng-" . php_uname("m") . "/local/share/ntopng/httpdocs/geoip"; - $source_dir = "/usr/pbi/ntopng-" . php_uname("m") . "/share/ntopng"; + $pf_version=substr(trim(file_get_contents("/etc/version")),0,3); + if ($pf_version == "2.1" || $pf_version == "2.2") { + $target_dir = "/usr/pbi/ntopng-" . php_uname("m") . "/local/share/ntopng/httpdocs/geoip"; + $source_dir = "/usr/pbi/ntopng-" . php_uname("m") . "/share/ntopng"; + } else { + $target_dir = "/usr/local/share/ntopng/httpdocs/geoip"; + $source_dir = "/usr/local/share/ntopng"; + } foreach(glob("{$source_dir}/Geo*.dat*") as $geofile) { /* Decompress if needed. */ diff --git a/pkg_config.10.xml b/pkg_config.10.xml index 69f7dae8..7aa1f403 100644 --- a/pkg_config.10.xml +++ b/pkg_config.10.xml @@ -289,12 +289,14 @@ http://www.ntop.org/ ntopng (replaces ntop) is a network probe that shows network usage in a way similar to what top does for processes. In interactive mode, it displays the network status on the user's terminal. In Web mode it acts as a Web server, creating an HTML dump of the network status. It sports a NetFlow/sFlow emitter/collector, an HTTP-based client interface for creating ntop-centric monitoring applications, and RRD for persistently storing traffic statistics. Network Management + net + bin/ntopng:net/ntopng bin/redis-cli:databases/redis bin/gdbmtool:databases/gdbm share/fonts/webfonts/arial.ttf:x11-fonts/webfonts bin/acyclic:graphics/graphviz ntopng-1.2.1-##ARCH##.pbi databases/redis databases/gdbm net/GeoIP x11-fonts/font-util x11-fonts/webfonts graphics/graphviz net/ntopng - 1.2.1 v0.5 + 0.5 ALPHA 2.2 https://packages.pfsense.org/packages/config/ntopng/ntopng.xml -- cgit v1.2.3