| 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 | |
|---|
| 32 | PWD=`pwd` |
|---|
| 33 | |
|---|
| 34 | PLUGINS_DIR="" |
|---|
| 35 | |
|---|
| 36 | LOG_FILE="../log/install_oreon.log" |
|---|
| 37 | |
|---|
| 38 | date > $LOG_FILE |
|---|
| 39 | |
|---|
| 40 | echo |
|---|
| 41 | echo "##########################################################################" |
|---|
| 42 | echo "# OREON Project (www.oreon-project.org) #" |
|---|
| 43 | echo "# Thanks for using OREON #" |
|---|
| 44 | echo "# #" |
|---|
| 45 | echo "# #" |
|---|
| 46 | echo "# infos@oreon-project.org #" |
|---|
| 47 | echo "# #" |
|---|
| 48 | echo "# Make sure you have installed and configured #" |
|---|
| 49 | echo "# perl - sed #" |
|---|
| 50 | echo "# #" |
|---|
| 51 | echo "# #" |
|---|
| 52 | echo "##########################################################################" |
|---|
| 53 | echo "# The Team OREON #" |
|---|
| 54 | echo "##########################################################################" |
|---|
| 55 | echo "" |
|---|
| 56 | echo "" |
|---|
| 57 | $SETCOLOR_WARNING |
|---|
| 58 | echo " Make sure you have root permissions !" |
|---|
| 59 | $SETCOLOR_NORMAL |
|---|
| 60 | echo "" |
|---|
| 61 | |
|---|
| 62 | echo "Are you sure to continue?" |
|---|
| 63 | echo -n "[y/n], default to [n]:" |
|---|
| 64 | read temp |
|---|
| 65 | if [ -z $temp ];then |
|---|
| 66 | temp=n |
|---|
| 67 | fi |
|---|
| 68 | |
|---|
| 69 | if [ $temp = "n" ];then |
|---|
| 70 | echo "Bye bye !" |
|---|
| 71 | exit |
|---|
| 72 | fi |
|---|
| 73 | |
|---|
| 74 | test_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 | ## |
|---|
| 88 | if 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 |
|---|
| 110 | fi |
|---|
| 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 | |
|---|
| 176 | function error() |
|---|
| 177 | { |
|---|
| 178 | echo "ERROR" |
|---|
| 179 | exit 2 |
|---|
| 180 | } |
|---|
| 181 | |
|---|
| 182 | # install OREON PLUGIN |
|---|
| 183 | |
|---|
| 184 | function 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 | ## |
|---|
| 199 | echo "Users Management" |
|---|
| 200 | echo "----------------" |
|---|
| 201 | # check for httpd directory |
|---|
| 202 | check_httpd_directory |
|---|
| 203 | ## group apache |
|---|
| 204 | check_group_apache |
|---|
| 205 | ## user apache |
|---|
| 206 | check_user_apache |
|---|
| 207 | check_group_nagios |
|---|
| 208 | check_user_nagios |
|---|
| 209 | echo "" |
|---|
| 210 | |
|---|
| 211 | echo "Other Stuff" |
|---|
| 212 | echo "------------" |
|---|
| 213 | if test -d $NAGIOS_PLUGIN ; then |
|---|
| 214 | echo_success "Nagios libexec directory" "OK" |
|---|
| 215 | else |
|---|
| 216 | mkdir -p $NAGIOS_PLUGIN > /dev/null |
|---|
| 217 | echo_success "Nagios libexec directory created" "OK" |
|---|
| 218 | fi |
|---|
| 219 | |
|---|
| 220 | # installation script |
|---|
| 221 | |
|---|
| 222 | confirm_oreon |
|---|
| 223 | #oreon_post_install |
|---|
| 224 | |
|---|
| 225 | echo "" |
|---|
| 226 | echo "###############################################################################" |
|---|
| 227 | echo "# #" |
|---|
| 228 | echo "# Report bugs at bugs@oreon-project.org #" |
|---|
| 229 | echo "# #" |
|---|
| 230 | echo "# Thanks for using OREON. #" |
|---|
| 231 | echo "# ----------------------- #" |
|---|
| 232 | echo "# Contact : infos@oreon-project.org #" |
|---|
| 233 | echo "# http://www.oreon-project.org #" |
|---|
| 234 | echo "###############################################################################" |
|---|