From: jean-pierre roux Date: Tue, 18 Jan 2011 15:20:43 +0000 (+0000) Subject: Some more checking, to protect against unaware user. X-Git-Tag: Creatools2-0-3.creaToolsTools2-0-3.17Feb2011~34 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=7b0db0dbe32c0a17297f497ca34bc4a6aa550061;p=creaToolsTools.git Some more checking, to protect against unaware user. --- diff --git a/Linux/menu.sh b/Linux/menu.sh index 814f980..42ed409 100644 --- a/Linux/menu.sh +++ b/Linux/menu.sh @@ -25,13 +25,14 @@ do echo echo " Choose what you want to do :" echo - echo " Configure : 0" - echo " Install Third Party Libraries : 1" - echo " Compile the CreaTools : 2" - echo " Install the CreaTools : 3" - echo " Uninstall the CreaTools : 4" + echo " Configure : 0" + echo " Install Third Party Libraries : 1" + echo " Get the 'CreaTools' source files : 2" + echo " Compile the CreaTools : 3" + echo " Install the CreaTools : 4" + echo " Uninstall the CreaTools : 5" echo - echo " Exit : 9" + echo " Exit : 9" echo echo echo @@ -42,7 +43,7 @@ do case $i in 0) suitable=XXX - ls -l scripts/CreaTools-configure.sh + #ls -l scripts/CreaTools-configure.sh if [ -f scripts/CreaTools-configure.sh ] then while [[ "$suitable" != "YES" && \ @@ -56,11 +57,11 @@ do read suitable if [ "$suitable" = "" ] then - $suitable="YES" + suitable="YES" fi done else - $suitable="NO" + suitable="NO" fi if [ "$suitable" = "NO" ] @@ -90,7 +91,7 @@ do then generationdir="/tmp/myGenerationDir" fi - echo "you said : [" $generationdir "]"su + echo "you said : [" $generationdir "]" echo echo @@ -158,7 +159,7 @@ do while [ "$linuxUserName" == "" ] do echo "Have a look at the following line to know 'Login User Name'/'Login Group Name'" - ls -l ~/.bashrc + ls -l menu.sh echo "Login User Name (mandatory!)" read linuxUserName echo "you said : [" $linuxUserName "]" @@ -171,6 +172,7 @@ do do #echo "Have a look at the following line to know 'Login User Name'/'Login Group Name'" #echo "Login Group Name (mandatory!)" + echo "Login Group Name (mandatory!)" read linuxGroupName echo "you said : [" $linuxGroupName "]" done @@ -298,26 +300,34 @@ do echo "------------------------------------" exit 0 ;; - + 2) - echo "========================== 2" + echo "========================== 3" + sh scripts/CreaTools-load.sh + + ;; + + + + 3) + echo "========================== 3" sh scripts/CreaTools-compile.sh # To allow (*very* aware) user to patch code, later - chown -R $generationdir/creatools_source $linuxUserName - chgrp -R $generationdir/creatools_source $linuxGroupName + chown -R $linuxUserName $generationdir/creatools_source + chgrp -R $linuxGroupName $generationdir/creatools_source # Too much time consuming - #chown -R $generationdir/creatools_source $linuxUserName - #chgrp -R $generationdir/creatools_source $linuxGroupName + #chown -R $linuxUserName $generationdir/creatools_source + #chgrp -R $linuxGroupName $generationdir/creatools_source ;; - 3) - echo "========================= 3" + 4) + echo "========================= 4" sh scripts/CreaTools-install.sh ;; - 4) - echo "========================= 4" + 5) + echo "========================= 5" sh scripts/CreaTools-uninstall.sh ;; @@ -326,7 +336,7 @@ do ;; *) - echo "Your answer must be in {0, 1, 2, 3, 4, 9} (was $i)" + echo "Your answer must be in {0, 1, 2, 3, 4, 5, 9} (was $i)" ;; esac diff --git a/Linux/scripts/CreaTools-compile.sh b/Linux/scripts/CreaTools-compile.sh index 74727cf..2a0efdd 100644 --- a/Linux/scripts/CreaTools-compile.sh +++ b/Linux/scripts/CreaTools-compile.sh @@ -1,125 +1,59 @@ #!/bin/sh -# Set all local variables - - -source $PWD/scripts/CreaTools-configure.sh -source $PWD/scripts/CreaTools-names.sh - -echo "------" -echo $PWD/scripts/CreaTools-configure.sh -echo --generationdir-- -echo $generationdir -echo --docgeneration-- -echo $docgeneration -echo --installPrefix-- -echo $installPrefix -echo --buildType-- -echo $buildType -echo --gdcmVersion-- -echo $gdcmVersion -echo --sourcesFrom-- -echo $sourcesFrom -echo --scriptDir-- -echo $scriptDir -echo --start_point-- -echo $start_point -echo "------" - - - - - - - -# Remove! JPRx -# start_point=2 - - - - - - +if [ ! -f $PWD/scripts/CreaTools-configure.sh ] +then + echo + echo "..ERROR.." + echo "===================================================" + echo "REMEMBER !" + echo "" + echo "YOU NEED TO RUN 'Configure' (0) FIRST !" + echo "===================================================" + echo + echo + exit 0 +fi -mkdir $generationdir -mkdir $generationdir/creatools_source -mkdir $generationdir/creatools_bin +# Set all local variables -cd $generationdir - - -# -------------------------------- -# start_point = 0 : remove everything that was created before -#--------------------------------- -if [ $start_point -le 0 ] -then -# the following stupid test is used at debug time; Please don't remove! -#if [ true = false ] -if [ true = true ] -then - rm -rf creatools_bin - mkdir $generationdir/creatools_bin - rm -rf creatools_source - mkdir $generationdir/creatools_source + source $PWD/scripts/CreaTools-configure.sh + source $PWD/scripts/CreaTools-names.sh + + echo "------" + echo $PWD/scripts/CreaTools-configure.sh + echo --generationdir-- + echo $generationdir + echo --docgeneration-- + echo $docgeneration + echo --installPrefix-- + echo $installPrefix + echo --buildType-- + echo $buildType + echo --gdcmVersion-- + echo $gdcmVersion + echo --sourcesFrom-- + echo $sourcesFrom + echo --scriptDir-- + echo $scriptDir + echo --start_point-- + echo $start_point + echo "------" + + if [ ! -e $generationdir/creatools_source ] + then + echo missing $generationdir/creatools_source + echo + echo "..ERROR.." + echo "===================================================" + echo "REMEMBER !" + echo "" + echo "YOU NEED TO RUN 'Load' (2) FIRST !" + echo "===================================================" + echo + echo + exit 0 fi -fi - -# ---------------------------------- -# start_point = 1 : Load all sources -#----------------------------------- - - -if [ $start_point -le 1 ] -then - if [ true = true ] - #if [ true = false ] - then -# - if [ $sourcesFrom = CVS ] - then - sh $scriptDir/cvscheckout.sh $creasource $generationdir $cvsUserName - sh $scriptDir/cvscheckout.sh $bbtksource $generationdir $cvsUserName - sh $scriptDir/cvscheckout.sh $creamaracassource $generationdir $cvsUserName - sh $scriptDir/cvscheckout.sh $creaenvironmentsource $generationdir $cvsUserName - sh $scriptDir/cvscheckout.sh $creabrukersource $generationdir $cvsUserName - sh $scriptDir/cvscheckout.sh $creaimagesource $generationdir $cvsUserName - sh $scriptDir/cvscheckout.sh $creacontourssource $generationdir $cvsUserName - sh $scriptDir/cvscheckout.sh $crearigidregistrationssource $generationdir $cvsUserName - sh $scriptDir/cvscheckout.sh $bbtkgeditorsource $generationdir $cvsUserName - sh $scriptDir/cvscheckout.sh $creatoolssource $generationdir $cvsUserName - fi - - if [ $sourcesFrom = HTML ] - then - cd $generationdir/creatools_source - wwwtargz=http://www.creatis.insa-lyon.fr/software/public/creatools/creaTools/nightly/ - wget $wwwtargz/crea.tgz - wget $wwwtargz/bbtk.tgz - wget $wwwtargz/creaMaracasVisu.tgz - wget $wwwtargz/creaEnvironment.tgz - wget $wwwtargz/creaBruker.tgz - wget $wwwtargz/creaImageIO.tgz - wget $wwwtargz/creaContours.tgz - wget $wwwtargz/creaRigidRegistration.tgz - wget $wwwtargz/bbtkGEditor.tgz - wget $wwwtargz/creaTools.tgz - - tar xvzf crea.tgz - tar xvzf bbtk.tgz - tar xvzf creaMaracasVisu.tgz - tar xvzf creaEnvironment.tgz - tar xvzf creaBruker.tgz - tar xvzf creaImageIO.tgz - tar xvzf creaContours.tgz - tar xvzf creaRigidRegistration.tgz - tar xvzf bbtkGEditor.tgz - tar xvzf creaTools.tgz - - rm -f *.tgz - fi - fi -fi cd $scriptDir @@ -142,6 +76,7 @@ fi creadll=$generationdir/creatools_bin/creaBin LD_LIBRARY_PATH=$creadll:LD_LIBRARY_$PATH +exit 0 # ------------------------- # start_point = 3 : BBTK diff --git a/Linux/scripts/ThirdParty-install.sh b/Linux/scripts/ThirdParty-install.sh index 5412105..a64cb5f 100644 --- a/Linux/scripts/ThirdParty-install.sh +++ b/Linux/scripts/ThirdParty-install.sh @@ -1,26 +1,40 @@ #!/bin/sh + if [ ! -f $PWD/scripts/CreaTools-configure.sh ] + then + echo + echo "..ERROR.." + echo "===================================================" + echo "REMEMBER !" + echo "" + echo "YOU NEED TO RUN 'Configure' (0) First !" + echo "===================================================" + echo + echo + exit 0 +fi source $PWD/scripts/CreaTools-configure.sh -echo "------" -echo $PWD/scripts/CreaTools-configure.sh -echo generationdir -echo $generationdir -echo docgeneration -echo $docgeneration -echo installPrefix -echo $installPrefix -echo buildType -echo $buildType -echo gdcmVersion -echo $gdcmVersion -echo sourcesFrom -echo $sourcesFrom -echo scriptDir -echo $scriptDir -echo start_point -echo $start_point -echo "------" + echo "------" + echo $PWD/scripts/CreaTools-configure.sh + echo --generationdir-- + echo $generationdir + echo --docgeneration-- + echo $docgeneration + echo --installPrefix-- + echo $installPrefix + echo --buildType-- + echo $buildType + echo --gdcmVersion-- + echo $gdcmVersion + echo --sourcesFrom-- + echo $sourcesFrom + echo --scriptDir-- + echo $scriptDir + echo --start_point-- + echo $start_point + echo "------" + scriptDir=$PWD sourcesDir=$generationdir/thirdparty_sources @@ -30,7 +44,10 @@ mkdir $generationdir mkdir $sourcesDir mkdir $binDir -rm $installPrefix/share/creatools_third_party_library_config.sh +if [ -f $installPrefix/share/creatools_third_party_library_config.sh ] +then + rm $installPrefix/share/creatools_third_party_library_config.sh +fi # the following stupid test is used at debug time; Please don't remove! if [ true = true ] @@ -119,9 +136,9 @@ fi if [ $buildType = "Debug" ] then -debug="ON" + debug="ON" else -debug="OFF" + debug="OFF" fi