Changeset 5734
- Timestamp:
- 07/16/08 23:36:50 (5 months ago)
- Location:
- trunk/centreon/libinstall
- Files:
-
- 3 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/centreon/libinstall/Upgrade_1_4_to_2.sh
r5297 r5734 1 1 #!/bin/bash 2 #---- 3 ## @Synopsis Upgrade script version 1.4 to 2.0 for centreon 4 ##Â @Copyright Copyright 2008, Guillaume Watteeux 5 ## @licence GPL : http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt 6 ## TODO 7 ## * Backup CENTREON INSTALL DIR (www, cron, ...) 8 ## * Find cron (file or user) & backup 9 ## * Quid RRD base 10 ##Â * SQL changes 11 ##Â * Clean unused files ... 12 ## * Remove ODS 13 ##Â * ... 14 15 #---- 2 16 # Centreon Upgrade script 3 17 ################################# … … 8 22 echo "$line" 9 23 10 ## TODO11 # * Backup CENTREON INSTALL DIR (www, cron, ...)12 # * Find cron (file or user) & backup13 # * Quid RRD base14 #Â * SQL changes15 #Â * Clean unused files ...16 # * Remove ODS17 #Â * ...18 19 24 20 25 # I'm writing all upgrade functon on this script. And when all people will stop use centreon1.4. We just delete or unuse this script. 21 26 22 ##Â Function locate_centreon_backupdir 23 # define directory where I move old centreon install. 27 #--- 28 ## Define directory where I move old centreon install. 29 ## @Globals CENTREON_BACKUPDIR, DEFAULT_CENTREON_BACKUPDIR 30 #--- 24 31 function locate_centreon_backupdir() { 25 32 if [ -z "$CENTREON_BACKUPDIR" ] ; then … … 35 42 } 36 43 37 ## Function find_cron 38 # search in system who cron was define. 39 # need to valid there are not a user crontab (nagios) 40 # if /etc/cron.d/oreon or centreon exist, move and add by new install. 44 #---- 45 ## search in system who cron was define. 46 ## @Globals CRON_FILE 47 ## need to valid there are not a user crontab (nagios) 48 ## if /etc/cron.d/oreon or centreon exist, move and add by new install. 49 #---- 41 50 function find_cron() { 51 local cron_type="" 52 local cron_type_choice="file user" 53 echo -e "$(gettext "Please select a type of cron method")" 54 select_in_array "cron_type" "${cron_type_choice[@]}" 55 if [ "$cron_type" = "user" ] ; then 56 is_cron_user 57 elif [ "$cron_type" = "file" ] ; then 58 is_cron_file 59 else 60 return 1 61 fi 42 62 63 return 0 43 64 } 44 65 45 66 ##Â find in nagios user if crontab centreon exist and WARNING 46 67 68 #---- 69 ## Find in cron file if centreon's cron exist 70 #---- 71 function is_cron_file() { 72 73 } 74 75 #---- 76 ##Â Find in cron user if centreon's cron exist 77 #---- 78 function is_cron_user() { 79 80 } -
trunk/centreon/libinstall/cinstall
r5687 r5734 121 121 function usage() { 122 122 local program=cinstall 123 cat<< __EOT__123 ${CAT} << __EOT__ 124 124 125 125 Usage: $program [OPTION]... SOURCE DEST -
trunk/centreon/libinstall/functions
r5724 r5734 1193 1193 1194 1194 #---- 1195 ## Find config problem on sudo 1196 ## If I found a problem, print a warning and need to press enter. 1197 ##Â @Globals LOG_FILE 1198 ##Â @return 0 no problem in sudo file 1199 ## @return 1 possible problem in sudo file 1200 #---- 1201 function is_suspect_conf_sudo() { 1202 local sudo_file="$1" 1203 ${GREP} -e "^Defaults.*requiretty$" $sudo_file >> $LOG_FILE 2>&1 1204 if [ "$?" -eq 0 ] ; then 1205 echo_warning "$(gettext "I think you'll have a problem with\n'Default requiretty' in sudo file")" 1206 echo -e "$(gettext "Press enter to continue.")" 1207 read 1208 return 1 1209 fi 1210 return 0 1211 } 1212 1213 #---- 1195 1214 ## Configure Sudo on system 1196 1215 ## Need a directory to store a config … … 1226 1245 fi 1227 1246 log "INFO" "$(gettext "Please configure your sudo with this example"): $dir_conf/centreon.sudo" 1247 #Â Add a simple test for Defaults Requiretty problem on CentOS, Fedora... 1248 is_suspect_conf_sudo $SUDO_FILE 1228 1249 return 0 1229 1250 } … … 2028 2049 ## file. After that, rewrite sudo file with clean file. 2029 2050 ## @param 0/1 to active a question to clean sudo (not by default) 2030 ## @Globals SUDO_FILE, TMPDIR, LOG_FILE 2051 ## @param sudo file 2052 ## @Globals TMPDIR, LOG_FILE 2031 2053 #---- 2032 2054 function clean_sudo() { 2033 2055 local validate=${1:-0} 2034 2056 local RC=1 2035 local sudo_old="$ SUDO_FILE"2036 local sudo_clean="$TMPDIR/$ SUDO_FILE.clean"2057 local sudo_old="$2" 2058 local sudo_clean="$TMPDIR/$sudo_old.clean" 2037 2059 2038 2060 ${CAT} $sudo_old | \
