root/tags/centreon-1.4.2.6/install.sh

Revision 5093, 29.5 kB (checked in by jmathis, 8 months ago)

prepare 1.4.2.6

Line 
1#!/bin/sh
2###################################################################
3# Centreon is developped with GPL Licence 2.0
4#
5# GPL License: http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
6#
7# Developped by : Julien Mathis - Romain Le Merlus
8#                 Christophe Coraboeuf - Mathieu Chateau
9# Modified by   : Sugumaran Mat
10#
11###################################################################
12# This program is free software; you can redistribute it and/or
13# modify it under the terms of the GNU General Public License
14# as published by the Free Software Foundation; either version 2
15# of the License, or (at your option) any later version.
16#
17# This program is distributed in the hope that it will be useful,
18# but WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20# GNU General Public License for more details.
21#
22#    For information : infos@oreon-project.org
23####################################################################
24
25USERID=`id -u`
26if [ $USERID != 0 ]; then
27    echo "You must exec with root user"
28    exit 1
29fi
30
31cat <<EOF
32###############################################################################
33#                            Centreon (www.centreon.com)                      #
34#                            Thanks for using Centreon                        #
35#                                                                             #
36#                                   v 1.4.2.6                                 #
37#                                                                             #
38#                             infos@oreon-project.org                         #
39#                                                                             #
40#                     Make sure you have installed and configured             #
41#                                   sudo - sed                                #
42#                          php - apache - rrdtool - mysql                     #
43#                                                                             #
44#                                                                             #
45###############################################################################
46#                                 The Team Centreon                           #
47###############################################################################
48EOF
49
50#Load install script functions
51if [ -z "$BASH" ]; then # Test if BASH is in path
52    if ! which bash > /dev/null 2>&1; then
53        echo "Install bash and try `bash install.sh`."
54    fi # Exit if we are not in BASH
55    echo "Error: The script must be run with BASH shell. Try:"
56    echo "# bash install.sh"
57    exit 1
58fi
59. functions
60
61##
62## VARIABLES
63##
64## Make sure you know what you do if you modify it !!
65
66SRC_OREON="oreon_src"
67
68PLUGINS_DIR="Plugins/"
69
70PWD=`pwd`
71
72LOG_FILE="$PWD/install_oreon.log"
73
74date > $LOG_FILE
75
76TRUETYPE="/usr/X11R6/lib/X11/fonts/truetype"
77
78test_yes_or_not(){
79    if [ $1 != "y" ] && [ $1 != "n" ] && [ ! -z $1 ] ;then
80        res=$1
81        while [ $res != "y" ] && [ $res != "n" ] && [ ! -z $res ]
82          do
83          echo $2
84          echo -n $3
85          read res
86        done
87        eval $1=$res
88    fi
89}
90
91
92echo ""
93$SETCOLOR_WARNING
94echo ""
95echo " WARNING : Setup will delete all previous informations in your Centreon DATABASE. "
96$SETCOLOR_NORMAL
97echo ""
98echo "Are you sure to continue ?"
99echo -n "[y/n], default to [n]:"
100read temp
101if [ "$temp" != "y" ] && [ "$temp" != "n" ] && [ ! -z "$temp" ] ;then
102    while [ "$temp" != "y" ] && [ "$temp" != "n" ] && [ ! -z "$temp" ]
103      do
104      echo "Are you sure to continue ?"
105      echo -n "[y/n], default to [n]:"
106      read temp
107    done
108fi
109if [ -z $temp ];then
110    temp="n"
111fi
112if [ $temp = "n" ];then
113    echo "Setup aborted..."
114    exit
115fi
116
117test_answer(){
118    #$1 variable to fill
119    #$2 text typed by user
120    if [ ! -z $2 ];then
121        if [ $2 != "" ];then
122                eval $1=$2
123        fi
124    fi
125}
126
127##
128## CONFIGURATION
129##
130if test -a $OREON_CONF ; then
131        echo ""
132        echo "------------------------------------------------------------------------"
133        echo "                   Detecting old Installation"
134        echo "------------------------------------------------------------------------"
135        echo ""
136        echo ""
137        echo_success "Finding Centreon configuration file '$OREON_CONF' :" "OK"
138        echo "You already seem to have to install Centreon."
139        echo ""
140    echo "Do you want use last Centreon install parameters ?"
141        echo -n "[y/n], default to [y]:"
142        read temp
143        if [ "$temp" != "y" ] && [ "$temp" != "n" ] && [ ! -z $temp ] ;then
144            while [ "$temp" != "y" ] && [ "$temp" != "n" ] && [ ! -z $temp ]
145              do
146              echo "Do you want to use last Centreon install parameters ?"
147              echo -n "[y/n], default to [y]:"
148              read temp
149            done
150        fi
151        if [ -z $temp ];then
152            temp=y
153        fi
154       
155        if [ $temp = "y" ];then
156            echo ""
157                echo_passed "Using '$OREON_CONF' :" "PASSED"
158            . $OREON_CONF
159            echo ""
160        else
161                echo "------------------------------------------------------------------------"
162                echo "                     First, let's talk about you !"
163                echo "------------------------------------------------------------------------"
164                echo ""
165                echo ""
166        fi
167fi
168        if [ -z $INSTALL_DIR_NAGIOS ];then
169            INSTALL_DIR_NAGIOS="/usr/local/nagios"
170                echo "Where is installed Nagios ?"
171                echo -n "default to [$INSTALL_DIR_NAGIOS]:"
172                read temp
173                if [ -z "$temp" ]; then
174                    temp="$INSTALL_DIR_NAGIOS"
175                fi
176                valueok=0
177                while [ ! -d "$temp/" ]; do
178                    echo_passed "$temp is not a directory." "CRITICAL"
179                    echo "Where is installed Nagios ?"
180                    echo -n "default to [$INSTALL_DIR_NAGIOS]:"
181                    read temp
182                    if [ -z "$temp" ]; then
183                        temp="$INSTALL_DIR_NAGIOS"
184                    fi
185                    echo
186                done
187                INSTALL_DIR_NAGIOS="$temp"
188                #INSTALL_DIR_NAGIOS=${INSTALL_DIR_NAGIOS%/}
189                echo ""
190        fi
191
192        if [ -z $NAGIOS_ETC ];then
193                #nagios etc directory for oreon
194                NAGIOS_ETC="$INSTALL_DIR_NAGIOS/etc"
195                echo "Where is your nagios etc directory ?"
196                echo -n "default to [$NAGIOS_ETC]:"
197                read temp
198                if [ -z "$temp" ]; then
199                    temp="$NAGIOS_ETC"
200                fi
201                while [ ! -f "${temp}/nagios.cfg" ]; do
202                    echo_passed "${NAGIOS_ETC}/nagios.cfg not found" "CRITICAL"
203                    echo "Where is your nagios etc directory ?"
204                    echo -n "default to [$NAGIOS_ETC]:"
205                    read temp
206                    if [ -z "$temp" ]; then
207                        temp="$NAGIOS_ETC"
208                    fi
209                done
210                NAGIOS_ETC="$temp"
211                echo_success "Path $NAGIOS_ETC" "OK"
212                echo ""
213        fi
214
215        if [ -z $NAGIOS_VAR ];then
216                #nagios var  directory for oreon
217                NAGIOS_VAR="$INSTALL_DIR_NAGIOS/var"
218                echo "Where is your nagios var directory ?"
219                echo -n "default to [$NAGIOS_VAR]:"
220                read temp
221                if [ -z "$temp" ]; then
222                    temp="$NAGIOS_VAR"
223                fi
224                while [ ! -d "${temp}/" ]; do
225                    echo_passed "${temp} is not a directory" "CRITICAL"
226                    echo "Where is your nagios var directory ?"
227                    echo -n "default to [$NAGIOS_VAR]:"
228                    read temp
229                    if [ -z "$temp" ]; then
230                        temp="$NAGIOS_VAR"
231                    fi
232                done
233                NAGIOS_VAR="$temp"
234                echo_success "Path $NAGIOS_VAR" "OK"
235                echo ""
236        fi
237
238        if [ -z $NAGIOS_PLUGIN ];then
239                #nagios plugins directory for oreon
240            NAGIOS_PLUGIN="$INSTALL_DIR_NAGIOS/libexec"
241            echo "Where is your nagios plugins (libexec) directory ?"
242            echo -n "default to [$NAGIOS_PLUGIN]:"
243            read temp
244            if [ -z "$temp" ]; then
245                temp="$NAGIOS_PLUGIN"
246            fi
247            while [ ! -d "$temp" ] ; do
248                create_libexec="null"
249                valid_directory=`echo $temp | grep "^/"`
250                if [ "$valid_directory" != "" ]; then
251                    echo_passed "Directory $temp does not exits." "CRITICAL"
252                    while [ "$create_libexec" != "y" ] && [ "$create_libexec" != "Y" ] && [ "$create_libexec" != "n" ] && [ "$create_libexec" != "N" ]; do
253                        echo ""
254                        echo -n "Do you want me to create libexec directory [$temp]?[Y/n]"
255                        read create_libexec
256                        if [ -z "$create_libexec" ]; then
257                            create_libexec="y"
258                        fi
259                    done
260                else
261                    echo_passed "$temp is not a valid directory." "CRITICAL"
262                fi
263                if [ $create_libexec = "y" ] || [ $create_libexec = "Y" ]; then
264                    mkdir -p $temp
265                    if [ $? = 1 ]; then
266                        echo_passed "Could not create directory" "CRITICAL"
267                        echo ""
268                        echo "Where is your nagios plugins (libexec) directory ?"
269                        echo -n "default to [$NAGIOS_PLUGIN]:"
270                        read temp
271                        if [ -z "$temp" ]; then
272                            temp="$NAGIOS_PLUGIN"
273                        fi
274                    fi
275                else
276                    echo "Where is your nagios plugins (libexec) directory ?"
277                    echo -n "default to [$NAGIOS_PLUGIN]:"
278                    read temp
279                    if [ -z "$temp" ]; then
280                        temp="$NAGIOS_PLUGIN"
281                    fi
282                fi
283            done
284            NAGIOS_PLUGIN="$temp"
285            echo_success "Path $NAGIOS_PLUGIN" "OK"
286            echo ""
287        fi
288       
289        if [ -z $NAGIOS_BIN ];then
290                #nagios plugins directory for oreon
291            NAGIOS_BIN="$INSTALL_DIR_NAGIOS/bin"
292            echo "Where is your nagios bin directory?"
293            echo -n "default to [$NAGIOS_BIN]:"
294            read temp
295            if [ -z "$temp" ]; then
296                temp="$NAGIOS_BIN"     
297            fi
298            while [ ! -x "${temp}/nagios" ]; do
299                echo_passed "Cannot find ${temp}/nagios" "CRITICAL"
300                echo "Where is your nagios bin directory?"
301                echo -n "default to [$NAGIOS_BIN]:"
302                read temp
303                if [ -z "$temp" ]; then
304                    temp="$NAGIOS_BIN"
305                fi
306            done
307            NAGIOS_BIN="$temp"
308            echo_success "Path $NAGIOS_BIN" "OK"
309            echo ""
310        fi
311       
312        if [ -z $NAGIOS_IMG ];then
313          #nagios plugins directory for oreon
314            NAGIOS_IMG="$INSTALL_DIR_NAGIOS/share/images"
315            echo "Where is your nagios image directory ?"
316            echo -n "default to [$NAGIOS_IMG]:"
317            read temp
318            if [ -z "$temp" ]; then
319                temp="$NAGIOS_IMG"
320            fi
321            while [ ! -d "$temp" ]; do
322                echo_passed "$temp is not a directory." "CRITICAL"
323                echo "Where is your nagios image directory ?"
324                echo -n "default to [$NAGIOS_IMG]:"
325                read temp
326                if [ -z "$temp" ]; then
327                    temp="$NAGIOS_IMG"
328                fi
329            done
330            NAGIOS_IMG="$temp"
331            echo_success "Path $NAGIOS_IMG" "OK"
332            echo ""
333        fi
334
335        if [ -z $INSTALL_DIR_OREON ];then
336                #setup directory for oreon
337                INSTALL_DIR_OREON="/usr/local/centreon"
338                echo "Where do I install centreon ?"
339                echo -n "default to [$INSTALL_DIR_OREON]:"
340                read temp
341                if [ -z "$temp" ]; then
342                    temp="$INSTALL_DIR_OREON"
343                fi
344                while [ ! -d "$temp" ] ; do
345                    create_oreon="null"
346                    valid_directory=`echo $temp | grep "^/"`
347                    if [ "$valid_directory" != "" ]; then
348                        echo_passed "Directory $temp does not exits." "CRITICAL"
349                        while [ "$create_oreon" != "y" ] && [ "$create_oreon" != "Y" ] && [ "$create_oreon" != "n" ] && [ "$create_oreon" != "N" ]; do
350                            echo ""
351                            echo -n "Do you want me to create this directory [$temp]?[Y/n]"
352                            read create_oreon
353                            if [ -z "$create_oreon" ]; then
354                                create_oreon="y"
355                            fi
356                        done
357                    else
358                        echo_passed "$temp is not a valid directory." "CRITICAL"
359                    fi
360                    if [ $create_oreon = "y" ] || [ $create_oreon = "Y" ]; then
361                        mkdir -p $temp
362                        if [ $? = 1 ]; then
363                            echo_passed "Could not create directory" "CRITICAL"
364                            echo ""
365                            echo "Where do I install Centreon ?"
366                            echo -n "default to [$INSTALL_OREON_DIR]:"
367                            read temp
368                            if [ -z "$temp" ]; then
369                                temp="$INSTALL_DIR_OREON"
370                            fi
371                    fi
372                    else
373                        echo "Where do I install Centreon ?"
374                        echo -n "default to [$INSTALL_DIR_OREON]:"
375                        read temp
376                        if [ -z "$temp" ]; then
377                            temp="$INSTALL_DIR_OREON"
378                        fi
379                    fi
380                done
381                INSTALL_DIR_OREON="$temp"
382                echo_success "Path $INSTALL_DIR_OREON" "OK"
383                echo ""
384        fi
385       
386        if [ -z $SUDO_FILE ];then
387                #Configuration file for sudo
388            SUDO_FILE="/etc/sudoers"
389            echo "Where is sudo configuration file?"
390            echo -n "default to [$SUDO_FILE]:"
391            read temp
392            if [ -z "$temp" ]; then
393                temp="$SUDO_FILE"
394            fi
395            while [ ! -f "$temp" ]; do
396                echo_passed "$temp if not a file." "CRITICAL"
397                echo "Where is sudo configuration file?"
398                echo -n "default to [$SUDO_FILE]:"
399                read temp
400                if [ -z "$temp" ]; then
401                    temp="$SUDO_FILE"
402                fi
403            done
404            SUDO_FILE="$temp"
405            echo_success "File $SUDO_FILE" "OK"
406            echo ""
407        fi
408#       "/usr/share/pear"
409        if [ -z $RRD_PERL ];then
410                #RRDTOOL perl module directory
411            RRD_PERL="/usr/local/rrdtool/lib/perl"
412            echo "Where is installed RRD perl modules [RRDs.pm] ?"
413            echo "Just put directory, not full path."
414            echo -n "default to [$RRD_PERL]:"
415            read temp
416            if [ -z "$temp" ]; then
417                temp="$RRD_PERL"
418            fi
419            while [ ! -f "$temp/RRDs.pm" ]; do
420                echo_passed "Cannot find ${temp}/RRDs.pm." "CRITICAL"
421                echo "Where is installed RRD perl modules [RRDs.pm] ?"
422                echo "Just put directory, not full path."
423                echo -n "default to [$RRD_PERL]:"
424                read temp
425                if [ -z "$temp" ]; then
426                    temp="$RRD_PERL"
427                fi
428            done
429            RRD_PERL="$temp"
430            echo_success "File $RRD_PERL" "OK"
431            echo ""
432        fi
433
434        if [ -z $BIN_RRDTOOL ];then
435                #RRDTOOL binary path
436            BIN_RRDTOOL="/usr/bin/rrdtool"
437            echo "Where is rrdtool binary ?"
438                echo -n "default to [$BIN_RRDTOOL]:"
439                read temp
440                if [ -z "$temp" ]; then
441                    temp="$BIN_RRDTOOL"
442                fi
443                while [ ! -x "$temp" ]; do
444                    echo_passed "$temp is not found or is not runnable" "CRITICAL"
445                    echo "Where is rrdtool binary ?"
446                    echo -n "default to [$BIN_RRDTOOL]:"
447                    read temp
448                    if [ -z "$temp" ]; then
449                        temp="$BIN_RRDTOOL"
450                    fi
451                done
452                BIN_RRDTOOL="$temp"
453                echo_success "$BIN_RRDTOOL" "OK"
454                echo ""
455        fi
456       
457
458        if [ -z $BIN_MAIL ];then
459                #MAIL binary path
460                BIN_MAIL="/usr/bin/mail"
461                echo "Where is mail binary ?"
462                echo -n "default to [$BIN_MAIL]:"
463                read temp
464                if [ -z "$temp" ]; then
465                    temp="$BIN_MAIL"
466                fi
467                while [ ! -x "$temp" ]; do
468                    echo_passed "$temp not found or not runnable" "CRITICAL"
469                    echo "Where is mail binary ?"
470                    echo -n " default to [$BIN_MAIL]:"
471                    read temp
472                    if [ -z "$temp" ]; then
473                        temp="$BIN_MAIL"
474                    fi
475                done
476                BIN_MAIL="$temp"
477                echo_success "$BIN_MAIL" "OK"
478                echo ""
479        fi
480       
481        if [ -z $PEAR_PATH ];then
482            PEAR_PATH="/usr/share/pear"
483            echo "Where is PEAR Path ?"
484            echo -n "default to [$PEAR_PATH]:"
485            read temp
486            test_answer PEAR_PATH $temp
487            PEAR_PATH=${PEAR_PATH%/}
488            while [ ! -f "${PEAR_PATH}/PEAR.php" ]
489              do
490              echo_passed "${PEAR_PATH}/PEAR.php not found" "CRITICAL"
491              echo "Where is PEAR Path ?"
492              PEAR_PATH="/usr/share/pear"
493              echo -n "default to [$PEAR_PATH]:"
494              read temp
495              test_answer PEAR_PATH $temp
496              PEAR_PATH=${PEAR_PATH%/}
497            done
498            echo_success "PEAR Path $PEAR_PATH" "OK" 
499            echo ""
500        fi
501
502
503##
504## Functions
505##
506
507# When exit on error
508
509function error()
510{
511    echo "ERROR"
512    exit 2
513}
514
515# Check apache version, and configure it. Ask to restart apache server
516# Make a copy of the original file as httpd.conf.initial
517
518function configure_apache()
519{
520    echo ""
521    echo "------------------------------------------------------------------------"
522    echo "                        Configure Apache server"
523    echo "------------------------------------------------------------------------"
524    echo ""
525    echo ""
526   
527    # configure httpd.conf
528    if test -e $DIR_APACHE_CONF/oreon.conf ; then
529        echo "Finding Apache Centreon configuration file"
530                echo_success "'$DIR_APACHE_CONF/oreon.conf' :" "OK"
531                echo "Do you want to replace configuration file ?"
532                echo -n "[y/n], default to [y]:"
533                read temp
534                if [ "$temp" != "y" ] && [ "$temp" != "n" ] && [ ! -z $temp ] ;then
535                    while [ "$temp" != "y" ] && [ "$temp" != "n" ] && [ ! -z $temp ]
536                      do
537                      echo "Do you want rewrite Apache configuration file ?"
538                      echo -n "[y/n], default to [y]:"
539                      read temp
540                    done
541                fi
542                if [ -z $temp ];then
543                    temp=y
544                fi
545    else
546        temp=y
547        fi
548
549        if [ $temp = "y" ];then
550             echo "" > $DIR_APACHE_CONF/oreon.conf
551             cat << EOF >> $DIR_APACHE_CONF/oreon.conf
552##
553## Section add by Centreon Install Setup
554##
555
556AddType application/x-java-jnlp-file .jnlp
557Alias /oreon/ $INSTALL_DIR_OREON/www/
558Alias /centreon/ $INSTALL_DIR_OREON/www/
559<Directory "$INSTALL_DIR_OREON/www">
560    Options None
561    AllowOverride AuthConfig Options
562    Order allow,deny
563    Allow from all
564</Directory>
565
566EOF
567            echo_success "Create '$DIR_APACHE_CONF/oreon.conf'" "OK"
568            echo_success "Configuring Apache" "OK"
569    else
570            echo_passed "Apache is already configurated" "PASSED"
571    fi
572
573    # add apache user to nagios group
574    usermod_result=`usermod -G $NAGIOS_GROUP,$WEB_GROUP $WEB_USER >> $LOG_FILE 2>> $LOG_FILE; echo $?`
575    if [ $usermod_result = "0" ]; then
576        echo_success "User $WEB_USER added to nagios group" "OK"
577        echo ""
578    else
579        echo_warning "Couldn't add $WEB_USER to nagios group" "WARNING"
580    fi
581#    fi
582#restart apache !
583    if test -x /etc/init.d/apache ; then
584        /etc/init.d/apache restart >> $LOG_FILE 2>> $LOG_FILE
585    else if test -x /etc/init.d/httpd ; then
586        /etc/init.d/httpd restart
587    else if test -e /etc/init.d/apache2 ; then
588        /etc/init.d/apache2 restart >> $LOG_FILE 2>> $LOG_FILE
589    else
590        echo_warning "Unable to restart apache server" "WARNING"
591    fi
592    fi
593    fi
594
595}
596
597# install Centreon interface
598
599function confirm_oreon()
600{
601    if test -f $INSTALL_DIR_OREON/www/oreon.conf.php ; then
602          echo ""
603          echo "Centreon is already install on your server !"
604
605          echo -n "Are you sure you want to install Centreon ?"
606          echo -n "[y/n], default to [n]:"
607          read answer
608          if [ "$answer" != "y" ] && [ "$answer" != "n" ] && [ ! -z $answer ] ;then
609              while [ "$answer" != "y" ] && [ "$answer" != "n" ] && [ ! -z $answer ]
610                do
611                echo "Are you sure you want to install Centreon ?"
612                echo -n "[y/n], default to [n]:"
613                read answer
614              done
615          fi
616          if [ -z $answer ];then
617                answer=n
618          fi
619          if [ $answer == 'n' ]; then
620              echo "Ok, bye bye !! "
621              exit
622          else if [ $answer == 'y' ]; then
623              install_oreon
624              install_ods
625              config_cron
626              config_sudo
627              #restart_mysql
628          else
629              echo "Please answer y or n ! "
630              confirm_oreon
631          fi
632          fi
633    else
634            install_oreon
635            install_ods
636            config_cron
637            config_sudo
638            #restart_mysql
639    fi
640}
641
642## old install_oreon
643
644
645function restart_mysql()
646{
647  # restart mysql to be sure that mysqld is running !
648    echo ""
649    echo "------------------------------------------------------------------------"
650    echo "                         Restart Mysql server"
651    echo "------------------------------------------------------------------------"
652        echo ""
653        echo ""
654        if test -x /etc/init.d/mysqld ; then
655      /etc/init.d/mysqld restart
656        else if test -x /etc/init.d/mysql ; then
657      /etc/init.d/mysql restart
658        else
659      echo_failure "We didn't find Mysql server. Centreon will not run." "FAILURE"
660      exit
661        fi
662        fi
663}
664
665function config_sudo(){
666    echo ""
667    echo "------------------------------------------------------------------------"
668    echo "                            Configure Sudo"
669    echo "------------------------------------------------------------------------"
670    echo ""
671    echo ""
672        # Find Nagios Init Script
673    check_nagios_init_script
674   
675    sudo=`cat $SUDO_FILE | grep OREON > /dev/null; echo $?`
676   
677    if [ $sudo == '1' ]; then
678      echo "#Add by Centreon installation script" >> $SUDO_FILE
679      echo "User_Alias      CENTREON= $WEB_USER" >> $SUDO_FILE
680      echo "## Nagios Restart" >> $SUDO_FILE
681      echo "CENTREON   ALL = NOPASSWD: $NAGIOS_INIT_SCRIPT restart" >> $SUDO_FILE
682      echo "## Nagios reload" >> $SUDO_FILE
683      echo "CENTREON   ALL = NOPASSWD: $NAGIOS_INIT_SCRIPT reload" >> $SUDO_FILE
684      echo "## Snmptrapd Restart" >> $SUDO_FILE
685      echo "CENTREON   ALL = NOPASSWD: /etc/init.d/snmptrapd restart" >> $SUDO_FILE
686      echo "" >> $SUDO_FILE
687      echo_success "Configuring Sudo" "OK"
688    else
689      echo_passed "Sudo is already configurated" "PASSED"
690  fi
691}
692
693function oreon_post_install()
694{
695        echo ""
696        echo "------------------------------------------------------------------------"
697        echo "                          Centreon Post Install"
698        echo "------------------------------------------------------------------------"
699        echo ""
700        echo ""
701      #BIN_MAIL=`whereis -b mail | cut -d : -f2`
702      #BIN_MAIL=${BIN_MAIL# }
703        echo_success "Finding mail binary : $BIN_MAIL " "OK"
704       
705          #BIN_RRDTOOL=`whereis -b rrdtool | cut -d : -f2 | cut -d " " -f2`
706      #BIN_RRDTOOL=${BIN_RRDTOOL# }
707        echo_success "Finding rrdtool binary : $BIN_RRDTOOL " "OK"
708       
709       
710        INSTALL_DIR_OREON_CONF="$INSTALL_DIR_OREON/www/install/installoreon.conf.php"
711      echo "<?" > $INSTALL_DIR_OREON_CONF
712      echo "/**" >> $INSTALL_DIR_OREON_CONF
713      echo "Oreon is developped with GPL Licence 2.0 :" >> $INSTALL_DIR_OREON_CONF
714      echo "http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt" >> $INSTALL_DIR_OREON_CONF
715      echo "Developped by : Julien Mathis - Romain Le Merlus - Christophe Coraboeuf" >> $INSTALL_DIR_OREON_CONF
716      echo "" >> $INSTALL_DIR_OREON_CONF
717      echo "The Software is provided to you AS IS and WITH ALL FAULTS." >> $INSTALL_DIR_OREON_CONF
718      echo "OREON makes no representation and gives no warranty whatsoever," >> $INSTALL_DIR_OREON_CONF
719      echo "whether express or implied, and without limitation, with regard to the quality," >> $INSTALL_DIR_OREON_CONF
720      echo "safety, contents, performance, merchantability, non-infringement or suitability for" >> $INSTALL_DIR_OREON_CONF
721      echo "any particular or intended purpose of the Software found on the OREON web site." >> $INSTALL_DIR_OREON_CONF
722      echo "In no event will OREON be liable for any direct, indirect, punitive, special," >> $INSTALL_DIR_OREON_CONF
723      echo "incidental or consequential damages however they may arise and even if OREON has" >> $INSTALL_DIR_OREON_CONF
724      echo "been previously advised of the possibility of such damages." >> $INSTALL_DIR_OREON_CONF
725      echo "" >> $INSTALL_DIR_OREON_CONF
726      echo "For information : contact@oreon-project.org" >> $INSTALL_DIR_OREON_CONF
727      echo "    */" >> $INSTALL_DIR_OREON_CONF
728      echo "" >> $INSTALL_DIR_OREON_CONF
729      echo "\$conf_installoreon['oreon_dir'] = \"$INSTALL_DIR_OREON/\";" >> $INSTALL_DIR_OREON_CONF
730      echo "\$conf_installoreon['oreon_dir_www'] = \"$INSTALL_DIR_OREON/www/\";" >> $INSTALL_DIR_OREON_CONF
731      echo "\$conf_installoreon['oreon_dir_rrd'] = \"$INSTALL_DIR_OREON/rrd/\";" >> $INSTALL_DIR_OREON_CONF
732      echo "\$conf_installoreon['nagios_conf'] = \"$NAGIOS_ETC/\";" >> $INSTALL_DIR_OREON_CONF
733      echo "\$conf_installoreon['nagios'] = \"$INSTALL_DIR_NAGIOS/\";" >> $INSTALL_DIR_OREON_CONF
734      echo "\$conf_installoreon['nagios_var'] = \"$NAGIOS_VAR/\";" >> $INSTALL_DIR_OREON_CONF
735      echo "\$conf_installoreon['nagios_plugins'] = \"$NAGIOS_PLUGIN/\";" >> $INSTALL_DIR_OREON_CONF
736      echo "\$conf_installoreon['nagios_bin'] = \"$NAGIOS_BIN/\";" >> $INSTALL_DIR_OREON_CONF
737      echo "\$conf_installoreon['nagios_init_script'] = \"$NAGIOS_INIT_SCRIPT\";" >> $INSTALL_DIR_OREON_CONF
738      echo "\$conf_installoreon['rrdtool_dir'] = \"$BIN_RRDTOOL\";" >> $INSTALL_DIR_OREON_CONF
739      echo "\$conf_installoreon['apache_user'] = \"$WEB_USER\";" >> $INSTALL_DIR_OREON_CONF
740      echo "\$conf_installoreon['apache_group'] = \"$WEB_GROUP\";" >> $INSTALL_DIR_OREON_CONF
741      echo "\$conf_installoreon['nagios_user'] = \"$NAGIOS_USER\";" >> $INSTALL_DIR_OREON_CONF
742      echo "\$conf_installoreon['nagios_group'] = \"$NAGIOS_GROUP\";" >> $INSTALL_DIR_OREON_CONF
743      echo "\$conf_installoreon['mail'] = \"$BIN_MAIL\";" >> $INSTALL_DIR_OREON_CONF
744      #echo "\$conf_installoreon['rrdtool_dir'] = \"$BIN_RRDTOOL\";" >> $INSTALL_DIR_OREON_CONF
745      echo "\$conf_installoreon['pear_dir'] = \"$PEAR_PATH\";" >> $INSTALL_DIR_OREON_CONF
746
747      for fichier