From 7cecd6bd703e51d8bbd59c036ff417fe6cb0bea0 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Mon, 3 Aug 2015 15:27:49 +0200 Subject: ntopng - attempt to reduce log spam (resubmit of #915) Symlink the scripts directory to /usr/local/share/ntopng to reduce logspam caused by PBI stupidity. (Declare $pf_version global on first use while at it, and clean up after itself on uninstall.) --- config/ntopng/ntopng.xml | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) (limited to 'config/ntopng') diff --git a/config/ntopng/ntopng.xml b/config/ntopng/ntopng.xml index dcb3f2b7..3d07b064 100644 --- a/config/ntopng/ntopng.xml +++ b/config/ntopng/ntopng.xml @@ -1,6 +1,6 @@ - - + + ntopng - 1.2 v0.5 + 0.7.2 Diagnostics: ntopng Settings Change pkg_edit.php?xml=ntopng.xml @@ -146,6 +146,8 @@ config_lock(); global $config; global $input_errors; + global $pf_version, $scripts_path, $fonts_path; + $pf_version=substr(trim(file_get_contents("/etc/version")),0,3); if ($_POST) { $config['installedpackages']['ntopng']['config'] = array(); $config['installedpackages']['ntopng']['config'][0] = $_POST; @@ -156,15 +158,26 @@ safe_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"); - $pf_version=substr(trim(file_get_contents("/etc/version")),0,3); + if ($pf_version == "2.2") { $fonts_path = "/usr/pbi/ntopng-" . php_uname("m") . "/local/lib/X11/fonts"; + $scripts_path = "/usr/pbi/ntopng-" . php_uname("m") . "/local/share/ntopng/scripts"; } else if ($pf_version == "2.1") { $fonts_path = "/usr/pbi/ntopng-" . php_uname("m") . "/lib/X11/fonts"; + $scripts_path = "/usr/pbi/ntopng-" . php_uname("m") . "/share/ntopng/scripts"; } else { $fonts_path = "/usr/local/lib/X11/fonts"; } + if ($pf_version == "2.1" || $pf_version == "2.2") { + $ntopng_share_path = "/usr/local/share/ntopng"; + $scripts_link_path = $ntopng_share_path . "/scripts"; + safe_mkdir("$ntopng_share_path", 0755, true); + if (!file_exists($scripts_link_path)) { + symlink($scripts_path, $scripts_link_path); + } + } system("/bin/cp -Rp {$fonts_path}/webfonts/ {$fonts_path}/TTF/"); + $first = 0; foreach($ntopng_config['interface_array'] as $iface) { $if = convert_friendly_interface_to_real_interface_name($iface); @@ -211,7 +224,6 @@ $disable_alerts = "-H"; } - $pf_version=substr(trim(file_get_contents("/etc/version")),0,3); if ($pf_version == "2.2") { $redis_path = "/usr/pbi/ntopng-" . php_uname("m") . "/local/bin"; } else if ($pf_version == "2.1") { @@ -318,6 +330,12 @@ exec("rm /usr/local/etc/rc.d/ntopng*"); + $pf_version=substr(trim(file_get_contents("/etc/version")),0,3); + if ($pf_version == "2.1" || $pf_version == "2.2") { + if (is_dir("/usr/local/share/ntopng/")) { + exec("rm -rf /usr/local/share/ntopng/"); + } + }