root/tags/plugins-1.2.1/install.sh

Revision 2799, 6.2 kB (checked in by jmathis, 18 months ago)

keep License GPL2

Line 
1#!/bin/sh
2###################################################################
3# Oreon 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 - Sugumaran Mathavarajan
9#
10###################################################################
11# This program is free software; you can redistribute it and/or
12# modify it under the terms of the GNU General Public License
13# as published by the Free Software Foundation; either version 2
14# of the License, or (at your option) any later version.
15#
16# This program is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19# GNU General Public License for more details.
20#
21#    For information : contact@merethis.com
22####################################################################
23
24#Load install script functions
25. ../functions
26
27##
28## VARIABLES
29##
30## Make sure you know what you do if you modify it !!
31
32PWD=`pwd`
33
34PLUGINS_DIR=""
35
36LOG_FILE="../log/install_oreon.log"
37
38date > $LOG_FILE
39
40echo
41echo "##########################################################################"
42echo "#                     OREON Project (www.oreon-project.org)              #"
43echo "#                         Thanks for using OREON                         #"
44echo "#                                                                        #"
45echo "#                                                                        #"
46echo "#                            infos@oreon-project.org                     #"
47echo "#                                                                        #"
48echo "#                  Make sure you have installed and configured           #"
49echo "#                             perl - sed                                 #"
50echo "#                                                                        #"
51echo "#                                                                        #"
52echo "##########################################################################"
53echo "#                              The Team OREON                            #"
54echo "##########################################################################"
55echo ""
56echo ""
57$SETCOLOR_WARNING
58echo "                     Make sure you have root permissions !"
59$SETCOLOR_NORMAL
60echo ""
61
62echo "Are you sure to continue?"
63echo -n "[y/n], default to [n]:"
64read temp
65if [ -z $temp ];then
66    temp=n
67fi
68
69if [ $temp = "n" ];then
70    echo "Bye bye !"
71    exit
72fi
73
74test_answer()
75{
76    #$1 variable to fill
77    #$2 text typed by user
78    if [ ! -z $2 ];then
79        if [ $2 != "" ];then
80      eval $1=$2
81        fi
82    fi
83}
84
85##
86## CONFIGURATION
87##
88if test -a $OREON_CONF ; then
89        echo ""
90        echo_success "Finding Oreon configuration file '$OREON_CONF' :" "OK"
91        echo "You already seem to have to install Oreon."
92    echo "Do you want use last Oreon install parameters ?"
93        echo -n "[y/n], default to [y]:"
94        read temp
95        if [ -z $temp ];then
96            temp=y
97        fi
98
99        if [ $temp = "y" ];then
100            echo ""
101                echo_passed "Using '$OREON_CONF' :" "PASSED"
102            . $OREON_CONF
103            echo ""
104        else
105                echo ""
106                echo "First, let's talk about you !"
107                echo "-----------------------------"
108                echo ""
109        fi
110fi
111        if [ -z $INSTALL_DIR_NAGIOS ];then
112                INSTALL_DIR_NAGIOS="/usr/local/nagios"
113                echo "Where is installed Nagios ?"
114                echo -n "default to [$INSTALL_DIR_NAGIOS]:"
115                read temp
116                test_answer INSTALL_DIR_NAGIOS $temp
117                echo ""
118        fi
119
120        if [ -z $NAGIOS_ETC ];then
121                #nagios etc directory for oreon
122                NAGIOS_ETC="$INSTALL_DIR_NAGIOS/etc"
123                echo "Where are your nagios etc directory ?"
124                echo -n "default to [$NAGIOS_ETC]:"
125                read temp
126                test_answer NAGIOS_ETC $temp
127                echo ""
128        fi
129
130        if [ -z $NAGIOS_PLUGIN ];then
131                #nagios plugins directory for oreon
132                NAGIOS_PLUGIN="$INSTALL_DIR_NAGIOS/libexec"
133                echo "Where are your nagios plugin / libexec  directory ?"
134                echo -n "default to [$NAGIOS_PLUGIN]:"
135                read temp
136                test_answer NAGIOS_PLUGIN $temp
137                echo ""
138        fi
139
140        if [ -z $INSTALL_DIR_OREON ];then
141                #setup directory for oreon
142                INSTALL_DIR_OREON="/usr/local/oreon"
143                echo "Where do I install Oreon ?"
144                echo -n "default to [$INSTALL_DIR_OREON]:"
145                read temp
146                test_answer INSTALL_DIR_OREON $temp
147                echo ""
148        fi
149
150        if [ -z $SUDO_FILE ];then
151                #Configuration file for sudo
152                SUDO_FILE="/etc/sudoers"
153                echo "Where is sudo ?"
154                echo -n "default to [$SUDO_FILE]:"
155                read temp
156                test_answer SUDO_FILE $temp
157                echo ""
158        fi
159
160        if [ -z $RRD_PERL ];then
161                #RRDTOOL perl module directory
162                RRD_PERL="/usr/local/rrdtool/lib/perl"
163                echo "Where is RRD perl modules RRDs.pm ?"
164                echo -n "default to [$RRD_PERL]:"
165                read temp
166                test_answer RRD_PERL $temp
167                echo ""
168        fi
169
170##
171## FUNCTION
172##
173
174# When exit on error
175
176function error()
177{
178    echo "ERROR"
179    exit 2
180}
181
182# install OREON PLUGIN
183
184function confirm_oreon()
185{
186        install_oreon_plugins
187}
188
189# installation script
190
191#check_group_nagios
192#check_user_nagios
193#check_group_nagiocmd
194#confirm_oreon
195
196##
197## INSTALL
198##
199echo "Users Management"
200echo "----------------"
201# check for httpd directory
202check_httpd_directory
203## group apache
204check_group_apache
205## user apache
206check_user_apache
207check_group_nagios
208check_user_nagios
209echo ""
210
211echo "Other Stuff"
212echo "------------"
213if test -d $NAGIOS_PLUGIN ; then
214    echo_success "Nagios libexec directory" "OK"
215else
216    mkdir -p $NAGIOS_PLUGIN > /dev/null
217    echo_success "Nagios libexec directory created" "OK"
218fi
219
220# installation script
221
222confirm_oreon
223#oreon_post_install
224
225echo ""
226echo "###############################################################################"
227echo "#                                                                             #"
228echo "#                    Report bugs at bugs@oreon-project.org                    #"
229echo "#                                                                             #"
230echo "#                             Thanks for using OREON.                         #"
231echo "#                             -----------------------                         #"
232echo "#                        Contact : infos@oreon-project.org                    #"
233echo "#                           http://www.oreon-project.org                      #"
234echo "###############################################################################"
Note: See TracBrowser for help on using the browser.