From 96985db73a4238f2ab3a21d90f87b9a546c99822 Mon Sep 17 00:00:00 2001
From: Maximilien Bersoult <mbersoult@merethis.com>
Date: Fri, 24 Aug 2012 14:08:08 +0000
Subject: [PATCH] * refs #3505 : New macro for Centreon Connectors

git-svn-id: http://svn.centreon.com/trunk/centreon@13413 6bcd3966-0018-0410-8128-fd23d134de7e
---
 libinstall/CentWeb.sh        |  1 +
 libinstall/functions         | 16 ++++++++++++++++
 tmpl/vardistrib/cengine.tmpl |  2 ++
 tmpl/vardistrib/centos       |  2 ++
 tmpl/vardistrib/debian-etch  |  2 ++
 tmpl/vardistrib/debian-lenny |  2 ++
 tmpl/vardistrib/fedora-core  |  2 ++
 tmpl/vardistrib/opensuse     |  2 ++
 tmpl/vardistrib/redhat-4     |  2 ++
 tmpl/vardistrib/sample.tmpl  |  2 ++
 tmpl/vardistrib/sles11       |  2 ++
 tmpl/vardistrib/ubuntu-hardy |  2 ++
 varinstall/vars              |  1 +
 13 files changed, 38 insertions(+)

diff --git a/libinstall/CentWeb.sh b/libinstall/CentWeb.sh
index b93808a165..ee689acd02 100755
--- a/libinstall/CentWeb.sh
+++ b/libinstall/CentWeb.sh
@@ -165,6 +165,7 @@ ${SED} -e 's|@NAGIOS_VAR@|'"$NAGIOS_VAR"'|g' \
 	-e 's|@CENTREON_ETC@|'"$CENTREON_ETC"'|g' \
 	-e 's|@CENTREON_LOG@|'"$CENTREON_LOG"'|g' \
 	-e 's|@CENTREON_VARLIB@|'"$CENTREON_VARLIB"'|g' \
+	-e 's|@CENTREON_ENGINE_CONNECTORS@|'"$CENTREON_ENGINE_CONNECTORS"'|g' \
 	$TMP_DIR/src/www/install/insertBaseConf.sql > \
 	$TMP_DIR/work/www/install/insertBaseConf.sql
 check_result $? "$(gettext "Change macros for insertBaseConf.sql")"
diff --git a/libinstall/functions b/libinstall/functions
index b8bdcf6711..5cd59df08c 100755
--- a/libinstall/functions
+++ b/libinstall/functions
@@ -508,6 +508,22 @@ function locate_nagios_plugindir() {
 	log "INFO" "NAGIOS_PLUGIN: $NAGIOS_PLUGIN"
 }
 
+#----
+## Define where is centreon connector directory
+## in last version of this script, you have been a possibility to create if not exist. now is not possible. You will create manualy.
+## @Globals	CENTREON_ENGINE_CONNECTORS, DEFAULT_CENTREON_ENGINE_CONNECTORS
+#----
+function locate_centreon_connector_dir() {
+	testdir_clean "$CENTREON_ENGINE_CONNECTORS" "CENTREON_ENGINE_CONNECTORS"
+	if [ -z "$CENTREON_ENGINE_CONNECTORS" ] ; then
+		answer_with_testoptionaldir "$(gettext "Where is your Centreon Connectors directory ?")" "$DEFAULT_CENTREON_ENGINE_CONNECTORS"
+		echo_success "$(gettext "Path ) $CENTREON_ENGINE_CONNECTORS" "$ok"
+	fi
+	CENTREON_ENGINE_CONNECTORS=`trim ${CENTREON_ENGINE_CONNECTORS%}`
+	export CENTREON_ENGINE_CONNECTORS
+	log "INFO" "CENTREON_ENGINE_CONNECTORS: $CENTREON_ENGINE_CONNECTORS"
+}
+
 #----
 ## Define where is your nagios binary
 ## By default, use nagios,nagios2 or nagios3 name and find in PATH
diff --git a/tmpl/vardistrib/cengine.tmpl b/tmpl/vardistrib/cengine.tmpl
index 563c9e6659..1a112bf2ee 100644
--- a/tmpl/vardistrib/cengine.tmpl
+++ b/tmpl/vardistrib/cengine.tmpl
@@ -40,6 +40,8 @@ NDOMOD_BINARY="/usr/local/centreon-broker/bin/cbd"
 NDO2DB_BINARY="/usr/local/centreon-broker/bin/cbd"
 ## Nagios init script (optional)
 NAGIOS_INIT_SCRIPT="/etc/init.d/centengine.sh"
+## Centreon Connector PATH
+CENTREON_ENGINE_CONNECTORS="/usr/lib/centreon-connector"
 #####################################################################
 ## End: Nagios preferences
 #####################################################################
\ No newline at end of file
diff --git a/tmpl/vardistrib/centos b/tmpl/vardistrib/centos
index 901e6e8109..9f9c38b911 100644
--- a/tmpl/vardistrib/centos
+++ b/tmpl/vardistrib/centos
@@ -111,6 +111,8 @@ NAGIOS_VAR="/var/log/nagios/"
 NAGIOS_USER="nagios"
 ## Nagios group (optional)
 NAGIOS_GROUP="nagios"
+## Centreon Connector PATH
+CENTREON_ENGINE_CONNECTORS="/usr/lib/centreon-connector"
 #####################################################################
 ## End: Nagios preferences
 #####################################################################
diff --git a/tmpl/vardistrib/debian-etch b/tmpl/vardistrib/debian-etch
index d62918055e..a9db51b874 100755
--- a/tmpl/vardistrib/debian-etch
+++ b/tmpl/vardistrib/debian-etch
@@ -122,6 +122,8 @@ NAGIOS_P1_FILE="/usr/lib/nagios2/p1.pl"
 #NDOMOD_BINARY=
 ## Nagios init script (optional)
 NAGIOS_INIT_SCRIPT="/etc/init.d/nagios2"
+## Centreon Connector PATH
+CENTREON_ENGINE_CONNECTORS="/usr/lib/centreon-connector"
 #####################################################################
 ## End: Nagios preferences
 #####################################################################
diff --git a/tmpl/vardistrib/debian-lenny b/tmpl/vardistrib/debian-lenny
index 12e2d62b4e..c2d942bbe9 100755
--- a/tmpl/vardistrib/debian-lenny
+++ b/tmpl/vardistrib/debian-lenny
@@ -122,6 +122,8 @@ NAGIOS_P1_FILE="/usr/lib/nagios3/p1.pl"
 #NDOMOD_BINARY=
 ## Nagios init script (optional)
 NAGIOS_INIT_SCRIPT="/etc/init.d/nagios3"
+## Centreon Connector PATH
+CENTREON_ENGINE_CONNECTORS="/usr/lib/centreon-connector"
 #####################################################################
 ## End: Nagios preferences
 #####################################################################
diff --git a/tmpl/vardistrib/fedora-core b/tmpl/vardistrib/fedora-core
index c48f6d61a1..ee0130134d 100755
--- a/tmpl/vardistrib/fedora-core
+++ b/tmpl/vardistrib/fedora-core
@@ -111,6 +111,8 @@ NAGIOS_VAR="/var/log/nagios/"
 NAGIOS_USER="nagios"
 ## Nagios group (optional)
 NAGIOS_GROUP="nagios"
+## Centreon Connector PATH
+CENTREON_ENGINE_CONNECTORS="/usr/lib/centreon-connector"
 #####################################################################
 ## End: Nagios preferences
 #####################################################################
diff --git a/tmpl/vardistrib/opensuse b/tmpl/vardistrib/opensuse
index caafb97d8a..532c10d56e 100755
--- a/tmpl/vardistrib/opensuse
+++ b/tmpl/vardistrib/opensuse
@@ -101,6 +101,8 @@ NAGIOS_VAR=""
 #NAGIOS_USER=""
 ## Nagios group (optional)
 #NAGIOS_GROUP=""
+## Centreon Connector PATH
+#CENTREON_ENGINE_CONNECTORS=""
 #####################################################################
 ## End: Nagios preferences
 #####################################################################
diff --git a/tmpl/vardistrib/redhat-4 b/tmpl/vardistrib/redhat-4
index 8060175d9e..330c01622d 100755
--- a/tmpl/vardistrib/redhat-4
+++ b/tmpl/vardistrib/redhat-4
@@ -111,6 +111,8 @@ NAGIOS_VAR="/opt/nagios/var"
 #NDOMOD_BINARY=
 ## Nagios init script (optional)
 #NAGIOS_INIT_SCRIPT="/etc/init.d/nagios"
+## Centreon Connector PATH
+#CENTREON_ENGINE_CONNECTORS="/usr/lib/centreon-connector"
 #####################################################################
 ## End: Nagios preferences
 #####################################################################
diff --git a/tmpl/vardistrib/sample.tmpl b/tmpl/vardistrib/sample.tmpl
index b2d61392c9..d07aba983f 100755
--- a/tmpl/vardistrib/sample.tmpl
+++ b/tmpl/vardistrib/sample.tmpl
@@ -127,6 +127,8 @@ NAGIOS_VAR="/var/log/nagios"
 #NDOMOD_BINARY=
 ## Nagios init script (optional)
 #NAGIOS_INIT_SCRIPT="/etc/init.d/nagios"
+## Centreon Connector PATH
+#CENTREON_ENGINE_CONNECTORS="/usr/lib/centreon-connector"
 #####################################################################
 ## End: Nagios preferences
 #####################################################################
diff --git a/tmpl/vardistrib/sles11 b/tmpl/vardistrib/sles11
index 32a1e11b62..3182d37dea 100755
--- a/tmpl/vardistrib/sles11
+++ b/tmpl/vardistrib/sles11
@@ -123,6 +123,8 @@ NAGIOS_P1_FILE="/usr/lib/nagios/p1.pl"
 #NDOMOD_BINARY=""
 ## Nagios init script (optional)
 NAGIOS_INIT_SCRIPT="/etc/init.d/nagios"
+## Centreon Connector PATH
+CENTREON_ENGINE_CONNECTORS="/usr/lib/centreon-connector"
 #####################################################################
 ## End: Nagios preferences
 #####################################################################
diff --git a/tmpl/vardistrib/ubuntu-hardy b/tmpl/vardistrib/ubuntu-hardy
index 559028b966..49ab84320f 100755
--- a/tmpl/vardistrib/ubuntu-hardy
+++ b/tmpl/vardistrib/ubuntu-hardy
@@ -122,6 +122,8 @@ NAGIOS_P1_FILE="/usr/lib/nagios2/p1.pl"
 #NDOMOD_BINARY=
 ## Nagios init script (optional)
 NAGIOS_INIT_SCRIPT="/etc/init.d/nagios2"
+## Centreon Connector PATH
+CENTREON_ENGINE_CONNECTORS="/usr/lib/centreon-connector"
 #####################################################################
 ## End: Nagios preferences
 #####################################################################
diff --git a/varinstall/vars b/varinstall/vars
index 1112114cbc..bb087ea562 100644
--- a/varinstall/vars
+++ b/varinstall/vars
@@ -48,3 +48,4 @@ DEFAULT_CENTCORE_BINDIR="bin"
 DEFAULT_SNMP_ETC="/etc/snmp"
 DEFAULT_SNMPTT_BINDIR="/usr/local/centreon/bin/"
 DEFAULT_CENTPLUGINSTRAPS_BINDIR="/usr/local/centreon/bin"
+DEFAULT_NAGIOS_PLUGIN="/usr/lib/centreon-connector"
\ No newline at end of file
-- 
GitLab