modifs 21/03/2007

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@206 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
legrand 2007-03-21 14:43:04 +00:00
commit 3b4066398f

View file

@ -15,6 +15,37 @@ TAR_MSG=" "
DIE=0 DIE=0
PROG=ParadisEO PROG=ParadisEO
# install types to select in the main menu
P_FULL_INSTALL=1
P_BASIC_INSTALL=2
P_PARALLEL_INSTALL=3
P_EXIT_INSTALL=4
# install steps
S_INTRODUCTION=1000
S_UNPACK_EO=1001
S_UNPACK_LIBXML=1002
S_UNPACK_MPICH=1003
S_INSTALL_EO=1004
S_INSTALL_MO=1005
S_INSTALL_MOEO=1006
S_INSTALL_LIBXML=1007
S_INSTALL_MPICH=1008
S_INSTALL_PEO=1009
S_REMOVE_TEMP_LIBXML=1010
S_REMOVE_TEMP_MPICH=1011
S_CONFIGURE_ENV=1012
S_CONFIGURE_MPD=1013
S_PEO_CHECK=1014
S_END=1015
# define what are the possible install and their content
FULL_INSTALL="$S_INTRODUCTION $S_UNPACK_EO $S_UNPACK_LIBXML $S_INSTALL_EO $S_INSTALL_MO $S_INSTALL_MOEO $S_INSTALL_LIBXML $S_REMOVE_TEMP_LIBXML $S_INSTALL_MPICH $S_REMOVE_TEMP_MPICH $S_INSTALL_PEO $S_CONFIGURE_ENV $S_CONFIGURE_MPD $S_END"
BASIC_INSTALL="$S_INTRODUCTION $S_UNPACK_EO $S_INSTALL_EO $S_INSTALL_MO $S_INSTALL_MOEO $S_END"
PARALLEL_INSTALL="$S_PEO_CHECK $S_INTRODUCTION $S_UNPACK_LIBXML $S_INSTALL_LIBXML $S_REMOVE_TEMP_LIBXML $S_UNPACK_MPICH $S_INSTALL_MPICH $S_REMOVE_TEMP_MPICH $S_INSTALL_PEO $S_CONFIGURE_ENV $S_CONFIGURE_MPD $S_END"
#others #others
PARADISEO_EO_ARCHIVE=paradiseo-eo.tar.gz PARADISEO_EO_ARCHIVE=paradiseo-eo.tar.gz
LIBS_PATH=lib LIBS_PATH=lib
@ -22,7 +53,7 @@ LIBXML2_ARCHIVE=libxml2-2.6.0.tar.bz2
MPICH2_ARCHIVE=mpich2-1.0.3.tar.gz MPICH2_ARCHIVE=mpich2-1.0.3.tar.gz
# errors # errors
SUCCESSFUL_PARADISEO_INSTALL=0 SUCCESSFUL_STEP=0
EO_UNPACKING_ERROR=100 EO_UNPACKING_ERROR=100
LIBXML_UNPACKING_ERROR=104 LIBXML_UNPACKING_ERROR=104
MPICH_UNPACKING_ERROR=105 MPICH_UNPACKING_ERROR=105
@ -35,6 +66,9 @@ MPICH_INSTALL_ERROR=112
REMOVE_TEMP_DIRECTORY_ERROR=113 REMOVE_TEMP_DIRECTORY_ERROR=113
VAR_CONFIG_ERROR=114 VAR_CONFIG_ERROR=114
MPD_COPY_ERROR=115 MPD_COPY_ERROR=115
LIBXML_INSTALL_ERROR=116
MPICH_INSTALL_ERROR=117
PEO_CHECK_ERROR=118
#Date #Date
DATE=`/bin/date '+%Y%m%d%H%M%S'` DATE=`/bin/date '+%Y%m%d%H%M%S'`
@ -98,313 +132,367 @@ function execute_cmd
} }
#------------------------------------------------------# #------------------------------------------------------#
#-- FUNCTION : run_install ---# #-- FUNCTION : run_install_step ---#
#------------------------------------------------------# #------------------------------------------------------#
#-- PARAMETERS : ---# #-- PARAMETERS : ---#
#-- install path ---# #-- install path ---#
#-- step to launch (0,1 ...) ---#
#-- counter for loop ---#
#-- Major function for install ---# #-- Major function for install ---#
#------------------------------------------------------# #------------------------------------------------------#
#-- RETURN: 0 if install OK ---# #-- RETURN: 0 if install OK ---#
#------------------------------------------------------# #------------------------------------------------------#
function run_install() function run_install_step()
{ {
installKitPath=$1 installKitPath=$1
stepToRun=$2
currentStepCounter=$3
RETURN=0 RETURN=0
########## STEP 0 : introduction ########## case "$stepToRun" in
clear $S_INTRODUCTION)
echo "" ########## Introduction #########
echo -e ' \033[40m\033[1;33m### ParadisEO install starting .... ### \033[0m ' clear
#sleep 4 echo ""
echo echo -e ' \033[40m\033[1;33m### ParadisEO install starting .... ### \033[0m '
echo "Installing the environment for Paradiseo... this may take about 15 minutes to complete. Note that the librairies \"libxml2\" ans \"mpich2\" required for ParadisEO are provided with this package."
sleep 3
echo
echo
########## STEP 1: unpacking paradiseo-eo ##########
echo -e ' \033[40m\033[1;34m# STEP 1 \033[0m '
echo ' --> Unpacking Paradiseo-EO (Evolving Objects) ...'
execute_cmd "tar xvzf $resourceKitPath/$LIBS_PATH/$PARADISEO_EO_ARCHIVE --directory $installKitPath" "[1] Unpack Paradiseo-EO" $SPY
if [ ! "$?" = "0" ]
then
echo ''
echo " --> Error when unpacking Paradiseo-EO"
echo -e ' \033[40m\033[1;33m### END ### \033[0m '
return $EO_UNPACKING_ERROR
else
echo -e ' \033[40m\033[1;34m# STEP 1 OK \033[0m'
echo echo
fi echo "Installing the environment for Paradiseo...Note that the librairies \"libxml2\" ans \"mpich2\" required for ParadisEO are provided with this package."
sleep 3
########## STEP 2: unpacking libxml2 ##########
echo -e ' \033[40m\033[1;34m# STEP 2 \033[0m '
echo ' --> Unpacking libxml2 (required for ParadisEO) ...'
execute_cmd "tar xvjf $resourceKitPath/$LIBS_PATH/$LIBXML2_ARCHIVE --directory $installKitPath" "[2] Unpack Libxml2" $SPY
if [ ! "$?" = "0" ]
then
echo ''
echo " --> Error when unpacking libxml2"
echo -e ' \033[40m\033[1;33m### END ### \033[0m '
return $LIBXML_UNPACKING_ERROR
else
echo -e ' \033[40m\033[1;34m# STEP 2 OK \033[0m'
echo echo
fi
########## STEP 3: unpacking mpich2 ##########
echo -e ' \033[40m\033[1;34m# STEP 3 \033[0m '
echo ' --> Unpacking mpich2 (required for ParadisEO) ...'
execute_cmd "tar xzvf $resourceKitPath/$LIBS_PATH/$MPICH2_ARCHIVE --directory $installKitPath" "[3] Unpack Mpich2" $SPY
if [ ! "$?" = "0" ]
then
echo ''
echo " --> Error when unpacking mpich2"
echo -e ' \033[40m\033[1;33m### END ### \033[0m '
return $MPICH_UNPACKING_ERROR
else
echo -e ' \033[40m\033[1;34m# STEP 3 OK \033[0m'
echo echo
fi return $SUCCESSFUL_STEP
;;
########## STEP 4: installing paradiseo-eo ########## $S_UNPACK_EO)
echo -e ' \033[40m\033[1;34m# STEP 4 \033[0m ' ########## unpacking paradiseo-eo ##########
echo ' --> Installing Paradiseo-EO. Please wait ...' echo -e " \033[40m\033[1;34m# STEP $currentStepCounter \033[0m "
echo ' --> Unpacking Paradiseo-EO (Evolving Objects) ...'
execute_cmd "cd $installKitPath/paradiseo-eo" "[4-1] Go in Paradiseo-EO dir" $SPY execute_cmd "tar xvzf $resourceKitPath/$LIBS_PATH/$PARADISEO_EO_ARCHIVE --directory $installKitPath" "[$currentStepCounter] Unpack Paradiseo-EO" $SPY
RETURN=`expr $RETURN + $?` if [ ! "$?" = "0" ]
execute_cmd "./autogen.sh" "[4-2] Run autogen" $SPY then
RETURN=`expr $RETURN + $?` echo ''
execute_cmd "./configure" "[4-3] Run configure" $SPY echo " --> Error when unpacking Paradiseo-EO"
RETURN=`expr $RETURN + $?` echo -e ' \033[40m\033[1;33m### END ### \033[0m '
execute_cmd "make" "[4-4] Compile ParadisEO-EO" $SPY return $EO_UNPACKING_ERROR
RETURN=`expr $RETURN + $?` else
if [ ! $(($RETURN)) = 0 ] echo -e " \033[40m\033[1;34m# STEP $currentStepCounter OK \033[0m"
then echo
echo '' return $SUCCESSFUL_STEP
echo " --> Error when installing Paradiseo-EO" fi
echo -e ' \033[40m\033[1;33m### END ### \033[0m ' ;;
return $EO_INSTALL_ERROR
else
echo -e ' \033[40m\033[1;34m# STEP 4 OK \033[0m'
echo
fi
########## STEP 5: installing paradiseo-mo ########## $S_UNPACK_LIBXML)
echo -e ' \033[40m\033[1;34m# STEP 5 \033[0m ' ########## unpacking libxml2 ##########
echo ' --> Installing Paradiseo-MO. Please wait ...' echo -e " \033[40m\033[1;34m# STEP $currentStepCounter \033[0m "
echo ' --> Unpacking libxml2 (required for ParadisEO) ...'
execute_cmd "tar xvjf $resourceKitPath/$LIBS_PATH/$LIBXML2_ARCHIVE --directory $installKitPath" "[$currentStepCounter] Unpack Libxml2" $SPY
if [ ! "$?" = "0" ]
then
echo ''
echo " --> Error when unpacking libxml2"
echo -e ' \033[40m\033[1;33m### END ### \033[0m '
return $LIBXML_UNPACKING_ERROR
else
echo -e " \033[40m\033[1;34m# STEP $currentStepCounter OK \033[0m"
echo
return $SUCCESSFUL_STEP
fi
;;
execute_cmd "cd $installKitPath/paradiseo-mo" "[5-1] Go in Paradiseo-MO dir" $SPY $S_UNPACK_MPICH)
RETURN=$? ########## unpacking mpich2 ##########
execute_cmd "./autogen.sh --with-EOdir=$installKitPath/paradiseo-eo" "[5-2] Run autogen" $SPY echo -e " \033[40m\033[1;34m# STEP $currentStepCounter \033[0m "
RETURN=`expr $RETURN + $?` echo ' --> Unpacking mpich2 (required for ParadisEO) ...'
execute_cmd "make" "[5-3] Compile ParadisEO-MO" $SPY
RETURN=`expr $RETURN + $?` execute_cmd "tar xzvf $resourceKitPath/$LIBS_PATH/$MPICH2_ARCHIVE --directory $installKitPath" "[3] Unpack Mpich2" $SPY
if [ ! $(($RETURN)) = 0 ] if [ ! "$?" = "0" ]
then then
echo '' echo ''
echo " --> Error when installing Paradiseo-MO" echo " --> Error when unpacking mpich2"
echo -e ' \033[40m\033[1;33m### END ### \033[0m ' echo -e ' \033[40m\033[1;33m### END ### \033[0m '
return $MO_INSTALL_ERROR return $MPICH_UNPACKING_ERROR
else else
echo -e ' \033[40m\033[1;34m# STEP 5 OK \033[0m' echo -e " \033[40m\033[1;34m# STEP $currentStepCounter OK \033[0m"
echo echo
fi return $SUCCESSFUL_STEP
fi
;;
########## STEP 6: installing MOEO ########## $S_INSTALL_EO)
echo -e ' \033[40m\033[1;34m# STEP 6 \033[0m ' ########## installing paradiseo-eo ##########
echo ' --> Installing Paradiseo-MOEO. Please wait ...' echo -e " \033[40m\033[1;34m# STEP $currentStepCounter \033[0m "
echo ' --> Installing Paradiseo-EO. Please wait ...'
execute_cmd "cd $installKitPath/paradiseo-eo" "[$currentStepCounter-1] Go in Paradiseo-EO dir" $SPY
RETURN=`expr $RETURN + $?`
execute_cmd "./autogen.sh" "[$currentStepCounter-2] Run autogen" $SPY
RETURN=`expr $RETURN + $?`
execute_cmd "./configure" "[$currentStepCounter-3] Run configure" $SPY
RETURN=`expr $RETURN + $?`
execute_cmd "make" "[$currentStepCounter-4] Compile ParadisEO-EO" $SPY
RETURN=`expr $RETURN + $?`
if [ ! $(($RETURN)) = 0 ]
then
echo ''
echo " --> Error when installing Paradiseo-EO"
echo -e ' \033[40m\033[1;33m### END ### \033[0m '
return $EO_INSTALL_ERROR
else
echo -e " \033[40m\033[1;34m# STEP $currentStepCounter OK \033[0m"
echo
return $SUCCESSFUL_STEP
fi
;;
$S_INSTALL_MO)
########## installing paradiseo-mo ##########
echo -e " \033[40m\033[1;34m# STEP $currentStepCounter \033[0m "
echo ' --> Installing Paradiseo-MO. Please wait ...'
execute_cmd "cd $installKitPath/paradiseo-moeo" "[6-1] Go in Paradiseo-MOEO dir" $SPY execute_cmd "cd $installKitPath/paradiseo-mo" "[$currentStepCounter-1] Go in Paradiseo-MO dir" $SPY
RETURN=$?
execute_cmd "./autogen.sh --with-EOdir=$installKitPath/paradiseo-eo" "[6-2] Run autogen" $SPY
RETURN=`expr $RETURN + $?`
execute_cmd "make" "[6-3] Compile ParadisEO-MOEO" $SPY
RETURN=`expr $RETURN + $?`
if [ ! $(($RETURN)) = 0 ]
then
echo ''
echo " --> Error when installing Paradiseo-MOEO"
echo -e ' \033[40m\033[1;33m### END ### \033[0m '
return $MOEO_INSTALL_ERROR
else
echo -e ' \033[40m\033[1;34m# STEP 6 OK \033[0m'
echo
fi
########## STEP 7: installing LIBXML2 ##########
echo -e ' \033[40m\033[1;34m# STEP 7 \033[0m '
echo ' --> Installing LIBXML2. Please wait ...'
execute_cmd "mkdir $installKitPath/libxml2" "[7-1] Create libxml2 dir" $SPY
RETURN=$?
execute_cmd "cd $installKitPath/libxml2-2.6.0/" "[7-2] Go in libxml2-2.6.0 dir" $SPY
RETURN=`expr $RETURN + $?`
execute_cmd "./configure --prefix=$installKitPath/libxml2/ --exec-prefix=$installKitPath/libxml2/" "[7-3] Run configure for libxml2" $SPY
RETURN=`expr $RETURN + $?`
execute_cmd "make" "[7-4] Compile libxml2" $SPY
RETURN=`expr $RETURN + $?`
execute_cmd "make install" "[7-5] Run install libxml2 " $SPY
RETURN=`expr $RETURN + $?`
if [ ! $(($RETURN)) = 0 ]
then
echo ''
echo " --> Error when installing LIBXML2"
echo -e ' \033[40m\033[1;33m### END ### \033[0m '
return $LIBXML_INSTALL_ERROR
else
echo -e ' \033[40m\033[1;34m# STEP 7 OK \033[0m'
echo
fi
########## STEP 8: installing MPICH2 ##########
echo -e ' \033[40m\033[1;34m# STEP 8 \033[0m '
echo ' --> Installing MPICH2. Please wait ...'
execute_cmd "mkdir $installKitPath/mpich2" "[8-1] Create mpich2 dir" $SPY
RETURN=$?
execute_cmd "cd $installKitPath/mpich2-1.0.3/" "[8-2] Go in mpich2-1.0.3 dir" $SPY
RETURN=`expr $RETURN + $?`
execute_cmd "./configure --prefix=$installKitPath/mpich2/" "[8-3] Run configure for mpich2" $SPY
RETURN=`expr $RETURN + $?`
execute_cmd "make" "[8-4] Compile mpich2" $SPY
RETURN=`expr $RETURN + $?`
execute_cmd "make install" "[8-5] Run install mpich2 " $SPY
RETURN=`expr $RETURN + $?`
if [ ! $(($RETURN)) = 0 ]
then
echo ''
echo " --> Error when installing MPICH2"
echo -e ' \033[40m\033[1;33m### END ### \033[0m '
return $MPICH_INSTALL_ERROR
else
echo -e ' \033[40m\033[1;34m# STEP 8 OK \033[0m'
echo
fi
########## STEP 9: removing temp directory for libxml ##########
echo -e ' \033[40m\033[1;34m# STEP 9 \033[0m '
echo ' --> Removing libxml2 temp install directory ...'
execute_cmd "rm -fr $installKitPath/libxml2-2.6.0" "[9] Remove Libxml2 temporary directory" $SPY
if [ ! "$?" = "0" ]
then
echo ''
echo " --> Error when removing $installKitPath/libxml2-2.6.0"
echo -e ' \033[40m\033[1;33m### END ### \033[0m '
return $REMOVE_TEMP_DIRECTORY_ERROR
else
echo -e ' \033[40m\033[1;34m# STEP 9 OK \033[0m'
echo
fi
########## STEP 10: removing temp directory for mpich ##########
echo -e ' \033[40m\033[1;34m# STEP 10 \033[0m '
echo ' --> Removing mpich2 temp install directory ...'
execute_cmd "rm -fr $installKitPath/mpich2-1.0.3" "[10] Remove Mpich2 temporary directory" $SPY
if [ ! "$?" = "0" ]
then
echo ''
echo " --> Error when removing $installKitPath/mpich2-1.0.3"
echo -e ' \033[40m\033[1;33m### END ### \033[0m '
return $REMOVE_TEMP_DIRECTORY_ERROR
else
echo -e ' \033[40m\033[1;34m# STEP 10 OK \033[0m'
echo
fi
########## STEP 11: Configuring environment variables ##########
echo -e ' \033[40m\033[1;34m# STEP 11 \033[0m '
echo ' --> Configuring environment variables for libxml2 and mpich2 ...'
execute_cmd "export LD_LIBRARY_PATH=$installKitPath/libxml2/lib:$LD_LIBRARY_PATH" "[11-1] Export LD_LIBRARY_PATH variable" $SPY
idx=$?
execute_cmd "export PATH=$installKitPath/libxml2/bin:$installKitPath/mpich2/bin:$PATH" "[11-2] Export PATH variable" $SPY
execute_cmd "echo export LD_LIBRARY_PATH=$installKitPath/libxml2/lib:$LD_LIBRARY_PATH" "[11-3] Export LD_LIBRARY_PATH variable into env" $SPY $homePath/.bashrc
idx=$?
execute_cmd "echo export PATH=$installKitPath/libxml2/bin:$installKitPath/mpich2/bin:$PATH" "[11-4] Export PATH variable into env" $SPY $homePath/.bashrc
idx=`expr $idx + $?`
execute_cmd "source $homePath/.bashrc" "[11-3] Export variables" $SPY
idx=`expr $idx + $?`
if [ ! $(($idx)) = 0 ]
then
echo ''
echo " --> Error when configuring environment variables for libxml2 and mpich2"
echo -e ' \033[40m\033[1;33m### END ### \033[0m '
return $VAR_CONFIG_ERROR
else
echo -e ' \033[40m\033[1;34m# STEP 11 OK \033[0m'
echo
fi
######## STEP 12: installing paradiseo-peo ##########
echo -e ' \033[40m\033[1;34m# STEP 12 \033[0m '
echo ' --> Installing Paradiseo-PEO. Please wait ...'
execute_cmd "cd $installKitPath/paradiseo-peo" "[12-1] Go in Paradiseo-PEO dir" $SPY
RETURN=$?
execute_cmd " ./autogen.sh --with-EOdir=$installKitPath/paradiseo-eo/ --with-MOdir=$installKitPath/paradiseo-mo/ --with-MOEOdir=$installKitPath/paradiseo-moeo" "[12-2] Run autogen for ParadisEO-PEO" $SPY
RETURN=`expr $RETURN + $?`
execute_cmd "make" "[12-3] Compile ParadisEO-PEO " $SPY
RETURN=`expr $RETURN + $?`
if [ ! $(($RETURN)) = 0 ]
then
echo ''
echo " --> Error when installing Paradiseo-PEO"
echo -e ' \033[40m\033[1;33m### END ### \033[0m '
return $PARADISEO_INSTALL_ERROR
else
echo -e ' \033[40m\033[1;34m# STEP 12 OK \033[0m'
echo
fi
######## STEP 13: copy .mpd.conf file in your HOME directory or in /etc if you are root (required for mpich2)
echo -e ' \033[40m\033[1;34m# STEP 13 \033[0m '
echo ' --> Copy .mpd.conf file in your HOME directory or in /etc if you are root (required for mpich2) ...'
if [ "$UID" = "0" ]
then
execute_cmd "cp $resourceKitPath/.mpd.conf /etc" "[13-1] Copy mpd.conf file in /etc (root)" $SPY
RETURN=$? RETURN=$?
execute_cmd "mv /etc/.mpd.conf /etc/mpd.conf" "[13-2] Move .mpd.conf to mpd.conf" $SPY execute_cmd "./autogen.sh --with-EOdir=$installKitPath/paradiseo-eo" "[$currentStepCounter-2] Run autogen" $SPY
RETURN=`expr $RETURN + $?` RETURN=`expr $RETURN + $?`
execute_cmd "chmod 600 /etc/mpd.conf" "[13-3] Change .mpd.conf rights" $SPY execute_cmd "make" "[$currentStepCounter-3] Compile ParadisEO-MO" $SPY
RETURN=`expr $RETURN + $?` RETURN=`expr $RETURN + $?`
else if [ ! $(($RETURN)) = 0 ]
execute_cmd "cp $resourceKitPath/.mpd.conf $HOME" "[13-1] Copy mpd.conf file in in your HOME directory" $SPY then
echo ''
echo " --> Error when installing Paradiseo-MO"
echo -e ' \033[40m\033[1;33m### END ### \033[0m '
return $MO_INSTALL_ERROR
else
echo -e " \033[40m\033[1;34m# STEP $currentStepCounter OK \033[0m"
echo
return $SUCCESSFUL_STEP
fi
;;
$S_INSTALL_MOEO)
########## installing MOEO ##########
echo -e " \033[40m\033[1;34m# STEP $currentStepCounter \033[0m "
echo ' --> Installing Paradiseo-MOEO. Please wait ...'
execute_cmd "cd $installKitPath/paradiseo-moeo" "[$currentStepCounter-1] Go in Paradiseo-MOEO dir" $SPY
RETURN=$? RETURN=$?
execute_cmd "chmod 600 $HOME/.mpd.conf" "[13-2] Change .mpd.conf rights" $SPY execute_cmd "./autogen.sh --with-EOdir=$installKitPath/paradiseo-eo" "[$currentStepCounter-2] Run autogen" $SPY
RETURN=`expr $RETURN + $?` RETURN=`expr $RETURN + $?`
fi execute_cmd "make" "[$currentStepCounter-3] Compile ParadisEO-MOEO" $SPY
if [ ! $(($RETURN)) = 0 ] RETURN=`expr $RETURN + $?`
then if [ ! $(($RETURN)) = 0 ]
echo '' then
echo " --> Error when copying .mpd.conf file " echo ''
echo -e ' \033[40m\033[1;33m### END ### \033[0m ' echo " --> Error when installing Paradiseo-MOEO"
return $MPD_COPY_ERROR echo -e ' \033[40m\033[1;33m### END ### \033[0m '
else return $MOEO_INSTALL_ERROR
echo -e ' \033[40m\033[1;34m# STEP 13 OK \033[0m' else
echo echo -e " \033[40m\033[1;34m# STEP $currentStepCounter OK \033[0m"
fi echo
return $SUCCESSFUL_STEP
fi
;;
$S_INSTALL_LIBXML)
########## installing LIBXML2 ##########
echo -e " \033[40m\033[1;34m# STEP $currentStepCounter \033[0m "
echo ' --> Installing libxml2. Please wait ...'
execute_cmd "mkdir $installKitPath/libxml2" "[$currentStepCounter-1] Create libxml2 dir" $SPY
RETURN=$?
execute_cmd "cd $installKitPath/libxml2-2.6.0/" "[$currentStepCounter-2] Go in libxml2-2.6.0 dir" $SPY
RETURN=`expr $RETURN + $?`
execute_cmd "./configure --prefix=$installKitPath/libxml2/ --exec-prefix=$installKitPath/libxml2/" "[$currentStepCounter-3] Run configure for libxml2" $SPY
RETURN=`expr $RETURN + $?`
execute_cmd "make" "[$currentStepCounter-4] Compile libxml2" $SPY
RETURN=`expr $RETURN + $?`
execute_cmd "make install" "[$currentStepCounter-5] Run install libxml2 " $SPY
RETURN=`expr $RETURN + $?`
if [ ! $(($RETURN)) = 0 ]
then
echo ''
echo " --> Error when installing libxml2"
echo -e ' \033[40m\033[1;33m### END ### \033[0m '
return $LIBXML_INSTALL_ERROR
else
echo -e " \033[40m\033[1;34m# STEP $currentStepCounter OK \033[0m"
echo
return $SUCCESSFUL_STEP
fi
;;
$S_INSTALL_MPICH)
########## installing MPICH2 ##########
echo -e " \033[40m\033[1;34m# STEP $currentStepCounter \033[0m "
echo ' --> Installing mpich2. Please wait ...'
execute_cmd "mkdir $installKitPath/mpich2" "[$currentStepCounter-1] Create mpich2 dir" $SPY
RETURN=$?
execute_cmd "cd $installKitPath/mpich2-1.0.3/" "[$currentStepCounter-2] Go in mpich2-1.0.3 dir" $SPY
RETURN=`expr $RETURN + $?`
execute_cmd "./configure --prefix=$installKitPath/mpich2/" "[$currentStepCounter-3] Run configure for mpich2" $SPY
RETURN=`expr $RETURN + $?`
execute_cmd "make" "[$currentStepCounter-4] Compile mpich2" $SPY
RETURN=`expr $RETURN + $?`
execute_cmd "make install" "[$currentStepCounter-5] Run install mpich2 " $SPY
RETURN=`expr $RETURN + $?`
if [ ! $(($RETURN)) = 0 ]
then
echo ''
echo " --> Error when installing MPICH2"
echo -e ' \033[40m\033[1;33m### END ### \033[0m '
return $MPICH_INSTALL_ERROR
else
echo -e " \033[40m\033[1;34m# STEP $currentStepCounter OK \033[0m"
echo
return $SUCCESSFUL_STEP
fi
;;
$S_REMOVE_TEMP_LIBXML)
########## removing temp directory for libxml ##########
echo -e " \033[40m\033[1;34m# STEP $currentStepCounter \033[0m "
echo ' --> Removing libxml2 temp install directory ...'
execute_cmd "rm -fr $installKitPath/libxml2-2.6.0" "[$currentStepCounter] Remove Libxml2 temporary directory" $SPY
if [ ! "$?" = "0" ]
then
echo ''
echo " --> Error when removing $installKitPath/libxml2-2.6.0"
echo -e ' \033[40m\033[1;33m### END ### \033[0m '
return $REMOVE_TEMP_DIRECTORY_ERROR
else
echo -e " \033[40m\033[1;34m# STEP $currentStepCounter OK \033[0m"
echo
return $SUCCESSFUL_STEP
fi
;;
$S_REMOVE_TEMP_MPICH)
########## removing temp directory for mpich ##########
echo -e " \033[40m\033[1;34m# STEP $currentStepCounter \033[0m "
echo ' --> Removing mpich2 temp install directory ...'
execute_cmd "rm -fr $installKitPath/mpich2-1.0.3" "[$currentStepCounter] Remove Mpich2 temporary directory" $SPY
if [ ! "$?" = "0" ]
then
echo ''
echo " --> Error when removing $installKitPath/mpich2-1.0.3"
echo -e ' \033[40m\033[1;33m### END ### \033[0m '
return $REMOVE_TEMP_DIRECTORY_ERROR
else
echo -e " \033[40m\033[1;34m# STEP $currentStepCounter OK \033[0m"
echo
return $SUCCESSFUL_STEP
fi
;;
$S_CONFIGURE_ENV)
########## Configuring environment variables ##########
echo -e " \033[40m\033[1;34m# STEP $currentStepCounter \033[0m "
echo ' --> Configuring environment variables for libxml2 and mpich2 ...'
execute_cmd "export LD_LIBRARY_PATH=$installKitPath/libxml2/lib:$LD_LIBRARY_PATH" "[$currentStepCounter-1] Export LD_LIBRARY_PATH variable" $SPY
idx=$?
execute_cmd "export PATH=$installKitPath/libxml2/bin:$installKitPath/mpich2/bin:$PATH" "[$currentStepCounter-2] Export PATH variable" $SPY
execute_cmd "echo export LD_LIBRARY_PATH=$installKitPath/libxml2/lib:$LD_LIBRARY_PATH" "[$currentStepCounter-3] Export LD_LIBRARY_PATH variable into env" $SPY $homePath/.bashrc
idx=$?
execute_cmd "echo export PATH=$installKitPath/libxml2/bin:$installKitPath/mpich2/bin:$PATH" "[$currentStepCounter-4] Export PATH variable into env" $SPY $homePath/.bashrc
idx=`expr $idx + $?`
execute_cmd "source $homePath/.bashrc" "[$currentStepCounter-5] Export variables" $SPY
idx=`expr $idx + $?`
if [ ! $(($idx)) = 0 ]
then
echo ''
echo " --> Error when configuring environment variables for libxml2 and mpich2"
echo -e ' \033[40m\033[1;33m### END ### \033[0m '
return $VAR_CONFIG_ERROR
else
echo -e " \033[40m\033[1;34m# STEP $currentStepCounter OK \033[0m"
echo
return $SUCCESSFUL_STEP
fi
;;
$S_INSTALL_PEO)
######## installing paradiseo-peo ##########
echo -e " \033[40m\033[1;34m# STEP $currentStepCounter \033[0m "
echo ' --> Installing Paradiseo-PEO. Please wait ...'
execute_cmd "cd $installKitPath/paradiseo-peo" "[$currentStepCounter-1] Go in Paradiseo-PEO dir" $SPY
RETURN=$?
execute_cmd " ./autogen.sh --with-EOdir=$installKitPath/paradiseo-eo/ --with-MOdir=$installKitPath/paradiseo-mo/ --with-MOEOdir=$installKitPath/paradiseo-moeo" "[$currentStepCounter-2] Run autogen for ParadisEO-PEO" $SPY
RETURN=`expr $RETURN + $?`
execute_cmd "make" "[$currentStepCounter-3] Compile ParadisEO-PEO " $SPY
RETURN=`expr $RETURN + $?`
if [ ! $(($RETURN)) = 0 ]
then
echo ''
echo " --> Error when installing Paradiseo-PEO"
echo -e ' \033[40m\033[1;33m### END ### \033[0m '
return $PARADISEO_INSTALL_ERROR
else
echo -e " \033[40m\033[1;34m# STEP $currentStepCounter OK \033[0m"
echo
return $SUCCESSFUL_STEP
fi
;;
$S_CONFIGURE_MPD)
######## copy .mpd.conf file in your HOME directory or in /etc if you are root (required for mpich2)
echo -e " \033[40m\033[1;34m# STEP $currentStepCounter \033[0m "
echo ' --> Copy .mpd.conf file in your HOME directory or in /etc if you are root (required for mpich2) ...'
if [ "$UID" = "0" ]
then
execute_cmd "cp $resourceKitPath/.mpd.conf /etc" "[$currentStepCounter-1] Copy mpd.conf file in /etc (root)" $SPY
RETURN=$?
execute_cmd "mv /etc/.mpd.conf /etc/mpd.conf" "[$currentStepCounter-2] Move .mpd.conf to mpd.conf" $SPY
RETURN=`expr $RETURN + $?`
execute_cmd "chmod 600 /etc/mpd.conf" "[$currentStepCounter-3] Change .mpd.conf rights" $SPY
RETURN=`expr $RETURN + $?`
else
execute_cmd "cp $resourceKitPath/.mpd.conf $HOME" "[$currentStepCounter-1] Copy mpd.conf file in in your HOME directory" $SPY
RETURN=$?
execute_cmd "chmod 600 $HOME/.mpd.conf" "[$currentStepCounter-2] Change .mpd.conf rights" $SPY
RETURN=`expr $RETURN + $?`
fi
if [ ! $(($RETURN)) = 0 ]
then
echo ''
echo " --> Error when copying .mpd.conf file "
echo -e ' \033[40m\033[1;33m### END ### \033[0m '
return $MPD_COPY_ERROR
else
echo -e " \033[40m\033[1;34m# STEP $currentStepCounter OK \033[0m"
echo
return $SUCCESSFUL_STEP
fi
;;
echo -e "\033[40m\033[1;33m### Now please run \"source $homePath/.bashrc\" to save the context ### \033[0m" $S_PEO_CHECK)
sleep 2 if ( [ -d "libxml2" ] || [ -d "mpich2" ] )
echo then
echo echo
echo '=> ParadisEO install successful.To report any problem or for help, please contact paradiseo-help@lists.gforge.inria.fr' echo "A previous installation of ParadisEO-PEO may exist because libxml2 or mpich2 directory have been detected in $installKitPath."
echo echo -e " \033[40m\033[1;33m => Do you want to remove these directories for a new installation ? If you choose NO, the installation will stop. (y/n) ? \033[0m "
return $SUCCESSFUL_PARADISEO_INSTALL read ANSWER
if [ "$ANSWER" = "y" ]
then
execute_cmd "rm -rf $installKitPath/libxml2 $installKitPath/mpich2" "[$currentStepCounter] Remove libxml2 ans mpich2 directories for a new install" $SPY "/dev/null" "/dev/null"
else
return $PEO_CHECK_ERROR
fi
fi
;;
$S_END)
echo -e "\033[40m\033[1;33m### Now please run \"source $homePath/.bashrc\" to save the context ### \033[0m"
sleep 2
echo
echo
echo '=> ParadisEO install successful.To report any problem or for help, please contact paradiseo-help@lists.gforge.inria.fr'
echo
return $SUCCESSFUL_STEP
;;
*)
;;
esac
} }
@ -425,7 +513,9 @@ function on_error()
echo " Make sure that eo archive exists in current directory " echo " Make sure that eo archive exists in current directory "
echo echo
echo " => To report any problem of for help, please contact paradiseo-help@lists.gforge.inria.fr and join $SPY" echo " => To report any problem of for help, please contact paradiseo-help@lists.gforge.inria.fr and join $SPY"
echo ;; echo
kill $$
;;
$LIBXML_UNPACKING_ERROR) $LIBXML_UNPACKING_ERROR)
echo echo
@ -433,7 +523,8 @@ function on_error()
echo " Make sure that libxml2 archive exists in current directory" echo " Make sure that libxml2 archive exists in current directory"
echo echo
echo " => To report any problem or for help, please contact paradiseo-help@lists.gforge.inria.fr and join $SPY" echo " => To report any problem or for help, please contact paradiseo-help@lists.gforge.inria.fr and join $SPY"
echo ;; echo
kill $$;;
$MPICH_UNPACKING_ERROR) $MPICH_UNPACKING_ERROR)
echo echo
@ -448,19 +539,22 @@ function on_error()
echo " An error has occured : impossible to install Paradiseo-EO.See $SPY for more details" echo " An error has occured : impossible to install Paradiseo-EO.See $SPY for more details"
echo "If you need help, please contact paradiseo-help@lists.gforge.inria.fr and join $SPY" echo "If you need help, please contact paradiseo-help@lists.gforge.inria.fr and join $SPY"
echo echo
echo ;; echo
kill $$;;
$MO_INSTALL_ERROR) $MO_INSTALL_ERROR)
echo echo
echo " An error has occured : impossible to install Paradiseo-MO.See $SPY for more details" echo " An error has occured : impossible to install Paradiseo-MO.See $SPY for more details"
echo " => To report any problem or for help, please contact paradiseo-help@lists.gforge.inria.fr and join $SPY" echo " => To report any problem or for help, please contact paradiseo-help@lists.gforge.inria.fr and join $SPY"
echo ;; echo
kill $$;;
$MOEO_INSTALL_ERROR) $MOEO_INSTALL_ERROR)
echo echo
echo " An error has occured : impossible to install Paradiseo-MOEO.See $SPY for more details" echo " An error has occured : impossible to install Paradiseo-MOEO.See $SPY for more details"
echo " => To report any problem or for help, please contact paradiseo-help@lists.gforge.inria.fr and join $SPY" echo " => To report any problem or for help, please contact paradiseo-help@lists.gforge.inria.fr and join $SPY"
echo ;; echo
kill $$;;
$PARADISEO_INSTALL_ERROR) $PARADISEO_INSTALL_ERROR)
echo echo
@ -470,12 +564,34 @@ function on_error()
echo ' -PATH=<libxml2 install path>/libxml2/bin:<mpich2 install path>/mpich2/bin:$PATH' echo ' -PATH=<libxml2 install path>/libxml2/bin:<mpich2 install path>/mpich2/bin:$PATH'
echo echo
echo " => To report any problem or for help, please contact paradiseo-help@lists.gforge.inria.fr and join $SPY" echo " => To report any problem or for help, please contact paradiseo-help@lists.gforge.inria.fr and join $SPY"
echo ;; echo
kill $$;;
*) $LIBXML_INSTALL_ERROR)
echo echo
echo " An error has occured : impossible to install libxml2. See $SPY for more details"
echo " => To report any problem or for help, please contact paradiseo-help@lists.gforge.inria.fr and join $SPY" echo " => To report any problem or for help, please contact paradiseo-help@lists.gforge.inria.fr and join $SPY"
echo ;; echo
kill $$;;
$MPICH_INSTALL_ERROR)
echo
echo " An error has occured : impossible to install libxml2. See $SPY for more details"
echo " => To report any problem or for help, please contact paradiseo-help@lists.gforge.inria.fr and join $SPY"
echo
kill $$;;
$PEO_CHECK_ERROR)
echo
echo " If you want to install ParadisEO-PEO, you should remove the old directories of libxml2 or mpich2 or choose another location."
echo
kill $$;;
$SUCCESSFUL_STEP)
;;
*)
echo
;;
esac esac
} }
@ -486,22 +602,24 @@ function on_error()
#check if we have all we need #check if we have all we need
(autoconf --version) < /dev/null > /dev/null 2>&1 || (autoconf --version) < /dev/null > /dev/null 2>&1 ||
{ {
echo echo "You must have autoconf installed to compile $PROG. Please update your system to get it before installing $PROG."
execute_cmd "echo \"You must have autoconf installed to compile $PROG. Please update your system to get it before installing $PROG.\"" "[0-1] Check autoconf" $SPY execute_cmd "echo \"You must have autoconf installed to compile $PROG. Please update your system to get it before installing $PROG.\"" "[0-1] Check autoconf" $SPY
DIE=1 DIE=1
} }
(automake --version) < /dev/null > /dev/null 2>&1 || (automake --version) < /dev/null > /dev/null 2>&1 ||
{ {
echo echo "You must have automake installed to compile $PROG. Please update your system to get it before installing $PROG."
execute_cmd "echo \"You must have automake installed to compile $PROG. Please update your system to get it before installing $PROG.\"" "[0-2] Check autoconf" $SPY execute_cmd "echo \"You must have automake installed to compile $PROG. Please update your system to get it before installing $PROG.\"" "[0-2] Check autoconf" $SPY
DIE=1 DIE=1
} }
if [ "$DIE" = "1" ]
if test "$DIE" -eq 1; then then
exit 1 exit 1
fi fi
# main
if [ "$1" = "--help" ] if [ "$1" = "--help" ]
then then
echo echo
@ -517,7 +635,7 @@ fi
if [ ! -d $HOME ] if [ ! -d $HOME ]
then then
if [ "$1" == "" ] if [ "$1" = "" ]
then then
echo " Please give a valid path for your home directory (use ./installParadiseo.sh --help for further information)" echo " Please give a valid path for your home directory (use ./installParadiseo.sh --help for further information)"
else else
@ -528,9 +646,63 @@ else
fi fi
# That's it ! # simple menu
run_install $PWD INSTALL_TREATENED=0
paradiseoInstall=$? INSTALL_PATH=$PWD
on_error $paradiseoInstall
while [ ! "$INSTALL_TREATENED" = "1" ]
do
case "$INSTALL_TYPE" in
$P_FULL_INSTALL)
counter=0
for step in $FULL_INSTALL
do
run_install_step $INSTALL_PATH $step $counter
on_error $?
counter=`expr $counter + 1`
done
INSTALL_TREATENED=1
;;
$P_BASIC_INSTALL)
counter=0
for step in $BASIC_INSTALL
do
run_install_step $INSTALL_PATH $step $counter
on_error $?
counter=`expr $counter + 1`
done
INSTALL_TREATENED=1
;;
$P_PARALLEL_INSTALL)
counter=0
for step in $PARALLEL_INSTALL
do
run_install_step $INSTALL_PATH $step $counter
on_error $?
counter=`expr $counter + 1`
done
INSTALL_TREATENED=1
;;
$P_EXIT_INSTALL)
INSTALL_TREATENED=1
;;
*)
echo
echo -e ' \033[40m\033[1;33m### Please select your install for ParadisEO : ### \033[0m '
echo
echo " 1 : Full install (all the components : EO,MO,MOEO and PEO)"
echo " 2 : Basic install: only EO,MO and MOEO components will be installed."
echo " 3 : ParadisEO-PEO install. I've already installed the basic version and I want to install ParadisEO-PEO"
echo " 4 : Exit install"
read INSTALL_TYPE
;;
esac
done