Author:   Lars Michelsen <[email protected]>
Date:     Sun Dec 16 12:09:39 2012 +0100
Committer:   Lars Michelsen <[email protected]>
Commit-Date: Sun Dec 16 12:09:39 2012 +0100

omd_install: Made compatible to calls from local/

---

 omd_install.sh |   50 ++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 38 insertions(+), 12 deletions(-)

diff --git a/omd_install.sh b/omd_install.sh
index 0cc129a..9c66745 100755
--- a/omd_install.sh
+++ b/omd_install.sh
@@ -178,29 +178,55 @@ Alias /$OMD_SITE/nagvis 
"$OMD_ROOT/local/share/nagvis/htdocs"
 EOF
 
 patch -s $OMD_ROOT/local/share/nagvis/htdocs/server/core/defines/global.php 
<<EOF
---- nagvis-1.5.3/share/server/core/defines/global.php.orig      2010-10-02 
19:43:58.000000000 +0200
-+++ nagvis-1.5.3/share/server/core/defines/global.php   2010-10-02 
19:47:00.000000000 +0200
-@@ -64,7 +64,7 @@
+--- nagvis-1.7-nightly/share/server/core/defines/global.php.orig       
2012-12-16 11:56:58.912708241 +0100
++++ nagvis-1.7-nightly/share/server/core/defines/global.php    2012-12-16 
11:57:59.041006400 +0100
+@@ -38,14 +38,22 @@
+ else
+       error_reporting(E_ALL);
+ 
++\$_path_parts = explode('/', dirname(\$_SERVER["SCRIPT_FILENAME"]));
++if(\$_path_parts[count(\$_path_parts) - 6] == 'local') // handle OMD local/ 
hierarchy
++    \$_base_dir = join(array_slice(explode('/' 
,dirname(\$_SERVER["SCRIPT_FILENAME"])), 0, -6), '/');
++else
++    \$_base_dir = join(array_slice(explode('/' 
,dirname(\$_SERVER["SCRIPT_FILENAME"])), 0, -5), '/');
++
+ /**
+  * Set the search path for included files
+  */
+ set_include_path(
+       get_include_path()
+-      .PATH_SEPARATOR.'../../server/core/classes'
+-      .PATH_SEPARATOR.'../../server/core/classes/objects'
+-      .PATH_SEPARATOR.'../../server/core/ext/php-gettext-1.0.9'
++      
.PATH_SEPARATOR.\$_base_dir.'/local/share/nagvis/htdocs/server/core/classes'
++      
.PATH_SEPARATOR.\$_base_dir.'/local/share/nagvis/htdocs/server/core/classes/objects'
++      .PATH_SEPARATOR.\$_base_dir.'/share/nagvis/htdocs/server/core/classes'
++      
.PATH_SEPARATOR.\$_base_dir.'/share/nagvis/htdocs/server/core/classes/objects'
++      
.PATH_SEPARATOR.\$_base_dir.'/share/nagvis/htdocs/server/core/ext/php-gettext-1.0.9'
+ );
+ 
+ // Enable/Disable profiling of NagVis using xhprof.  To make use of this the
+@@ -64,7 +73,7 @@
  define('DEBUGLEVEL', 6);
-
+ 
  // Path to the debug file
 -define('DEBUGFILE', '../../../var/nagvis-debug.log');
-+define('DEBUGFILE', join(array_slice(explode('/' 
,dirname(\$_SERVER["SCRIPT_FILENAME"])), 0, -6), 
'/').'/tmp/nagvis/nagvis-debug.log');
-
- // It is possible to define a second main configuration file
- // to pre-define some options in a file the user may not be
-@@ -78,14 +78,14 @@
++define('DEBUGFILE', \$_base_dir.'/tmp/nagvis/nagvis-debug.log');
+ 
+ // It is possible to define a conf.d directory for splitting the main
+ // configuration in several files. Only the values defined in the 
CONST_MAINCFG
+@@ -78,14 +87,14 @@
  // The last value wins.
  //
  // Path to the main configuration file
 -define('CONST_MAINCFG', '../../../etc/nagvis.ini.php');
 -define('CONST_MAINCFG_CACHE', '../../../var/nagvis-conf');
-+define('CONST_MAINCFG', join(array_slice(explode('/' 
,dirname(\$_SERVER["SCRIPT_FILENAME"])), 0, -6), 
'/').'/etc/nagvis/nagvis.ini.php');
-+define('CONST_MAINCFG_CACHE', join(array_slice(explode('/' 
,dirname(\$_SERVER["SCRIPT_FILENAME"])), 0, -6), 
'/').'/tmp/nagvis/nagvis-conf');
++define('CONST_MAINCFG', \$_base_dir.'/etc/nagvis/nagvis.ini.php');
++define('CONST_MAINCFG_CACHE', \$_base_dir.'/tmp/nagvis/nagvis-conf');
  
  // Path to the main configuration conf.d directory
 -define('CONST_MAINCFG_DIR', '../../../etc/conf.d');
-+define('CONST_MAINCFG_DIR', join(array_slice(explode('/' 
,dirname(\$_SERVER["SCRIPT_FILENAME"])), 0, -6), '/').'/etc/nagvis/conf.d');
++define('CONST_MAINCFG_DIR', \$_base_dir.'/etc/nagvis/conf.d');
  
  // The directory below the NagVis root which is shared by the webserver
 -define('HTDOCS_DIR', 'share');


------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to