-#!/bin/sh
-
-if [ $UID != 0 ]
-then
- echo
- echo "..ERROR.."
- echo "==================================================="
- echo "REMEMBER !"
- echo ""
- echo "YOU NEED TO RUN THIS ONE AS root"
- echo "==================================================="
- echo
- echo
- exit 0
-fi
+#!/bin/bash -e
+clear
i=999
while [ "$i" != 9 ]
echo
echo " Choose what you want to do :"
echo
- 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 " Configure : 0 "
+ echo " Install Third Party Libraries : 1 (as root)"
+ echo " Get the 'CreaTools' source files : 2 (CVS : as user!)"
+ echo " Compile the CreaTools : 3 "
+ echo " Install the CreaTools : 4 (as root)"
+ echo " Uninstall the CreaTools : 5 (as root)"
echo
echo " Exit : 9"
echo
"$OperatingSystem" != "Ubuntu" && \
"$OperatingSystem" != "MacOS" ]]
do
- echo "Operating System : Fedora/Ubuntu/MacOS (mandatory!)"
+ echo "Operating System : Fedora/Ubuntu/MacOS (default :Fedora!)"
read OperatingSystem
done
echo "you said : [" $OperatingSystem "]"
echo
echo
# ------------------
+ installPrefixThird="___"
+ echo "Install Prefix For Third Party Library : '$generationdir/thirdparty_install' / '/usr/local' (default is '$generationdir/thirdparty_install')"
+ read installPrefixThird
+ if [ "$installPrefixThird" = "" ]
+ then
+ installPrefixThird="$generationdir/thirdparty_install"
+ fi
+ echo "you said : [" $installPrefixThird "]"
+ echo
+ echo
+ # ------------------
+
- installPrefix="XXX"
- echo "Install Prefix : '$generationdir/creatools_install' / '/usr/local' (default is '$generationdir/creatools_install')"
+ installPrefix="___"
+ echo "Install Prefix for CreaTools : '$generationdir/creatools_install' / '/usr/local' (default is '$generationdir/creatools_install')"
read installPrefix
if [ "$installPrefix" = "" ]
then
echo
# ------------------
- docgeneration="XXX"
+ docgeneration="___"
while [[ "$docgeneration" != "YES" && "$docgeneration" != "NO" ]]
do
echo "Boolean For Doc Generation : YES/NO (default is NO)"
echo
# ------------------
- sourcesFrom="XXX"
+ sourcesFrom="___"
while [[ "$sourcesFrom" != "CVS" && "$sourcesFrom" != "HTML" ]]
do
echo "Where do you want to get source files from : CVS/HTML (default is HTML)"
echo
# ------------------
- buildType="XXX"
+ buildType="___"
while [[ "$buildType" != "Release" && "$Debug " != "HTML" ]]
do
echo "Build type : Release/Debug (default is Release)"
echo
# ------------------
- gdcmVersion="XXX"
+ gdcmVersion="___"
while [[ "$gdcmVersion" != "GDCM1" && "$gdcmVersion " != "GDCM2" ]]
do
echo "Gdcm version : GDCM1/GDCM2 (default is GDCM1)"
echo "You said :"
echo " Operating System : $OperatingSystem"
echo " Name of the Generation Directory : $generationdir"
- echo " Install Prefix : $installPrefix"
+ echo " Install Prefix for Third Party Libraries : $installPrefixThird"
+ echo " Install Prefix for CreaTools : $installPrefix"
echo " Boolean for Doc Generation : $docgeneration"
echo " Where do you want to get source files from : $sourcesFrom"
if [ $sourcesFrom = CVS ]
configureFile="scripts/CreaTools-configure.sh"
touch $configureFile
- echo "#!/bin/sh" > $configureFile
- echo >> $configureFile
- echo "#File generated by 'menu.sh'" >> $configureFile
- echo "#DO NOT edit !" >> $configureFile
- echo "#(except if you *know* what you do)">> $configureFile
- echo >> $configureFile
- echo "OperatingSystem=$OperatingSystem" >> $configureFile
- echo "generationdir=$generationdir" >> $configureFile
- echo "installPrefix=$installPrefix" >> $configureFile
- echo "docgeneration=$docgeneration" >> $configureFile
- echo "sourcesFrom=$sourcesFrom" >> $configureFile
- echo "cvsUserName=$cvsUserName" >> $configureFile
- echo "loginUserName=$loginUserName" >> $configureFile
- echo "loginGroupName=$loginGroupName" >> $configureFile
- echo "buildType=$buildType" >> $configureFile
- echo "gdcmVersion=$gdcmVersion" >> $configureFile
+ echo "#!/bin/sh" > $configureFile
+ echo >> $configureFile
+ echo "#File generated by 'menu.sh'" >> $configureFile
+ echo "#DO NOT edit !" >> $configureFile
+ echo "#(except if you *know* what you do)" >> $configureFile
+ echo >> $configureFile
+ echo "OperatingSystem=$OperatingSystem" >> $configureFile
+ echo "generationdir=$generationdir" >> $configureFile
+ echo "installPrefix=$installPrefix" >> $configureFile
+ echo "installPrefixThird=$installPrefixThird" >> $configureFile
+ echo "docgeneration=$docgeneration" >> $configureFile
+ echo "sourcesFrom=$sourcesFrom" >> $configureFile
+ echo "cvsUserName=$cvsUserName" >> $configureFile
+ echo "loginUserName=$loginUserName" >> $configureFile
+ echo "loginGroupName=$loginGroupName" >> $configureFile
+ echo "buildType=$buildType" >> $configureFile
+ echo "gdcmVersion=$gdcmVersion" >> $configureFile
# ------------------
# endif 'suitable'
1)
echo "========================== 1 "
+ source scripts/Check-if-root.sh
+
sh scripts/ThirdParty-install.sh
vtkdirVariable=""
do
echo
echo " --------------------------------"
+
+ X
echo " Set VTK_DIR environment variable"
echo " --------------------------------"
echo
sed -i -e '/.*LATEX_COMPILER*/ d' /etc/bashrc
echo "export VTK_DIR=$vtkdirVariable" >> /etc/bashrc
echo "export LATEX_COMPILER=$latexCompilerVariable" >> /etc/bashrc
+
+ if [ $sourcesFrom = CVS ]
+ then
+ echo "----------------------------------------------------------------------"
+ echo OK
+ echo "To go on, run again 'sh menu.sh' as '$loginUserName', in a new window"
+ echo "---------------------------------------------------------------------"
+ exit 0
+ else
+ echo "----------------------------------------------------------------------"
+ echo OK
+ echo "To go on, run again 'sh menu.sh' in a new window"
+ echo "---------------------------------------------------------------------"
+ exit 0
+ fi
echo "---------------------------------------------------------"
echo OK
;;
2)
- echo "========================== 3"
+ echo "========================== 2"
sh scripts/CreaTools-load.sh
;;
;;
4)
+ if [ $UID != 0 ]
+ then
+ echo
+ echo "..ERROR.."
+ echo "==================================================="
+ echo "REMEMBER !"
+ echo ""
+ echo "YOU NEED TO RUN THIS ONE AS root"
+ echo "==================================================="
+ echo
+ echo
+ exit 0
+fi
echo "========================= 4"
sh scripts/CreaTools-install.sh
;;
echo $docgeneration
echo --installPrefix--
echo $installPrefix
+ echo --installPrefixThird--
+ echo $installPrefixThird
echo --buildType--
echo $buildType
echo --gdcmVersion--
libname=VTK
dirInstall=$binDir/$libname-Bin
dirInstallVTK=$dirInstall
- export VTK_DIR=$installPrefix/lib/vtk-5.6/
+ export VTK_DIR=$installPrefixThird/lib/vtk-5.6/
cd $dirInstall
cmake -G"Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
##cmake -G"CodeBlocks - Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
- cmake -D USE_DEBUG_LIB:BOOL=$buildType -D CMAKE_INSTALL_PREFIX:PATH=$installPrefix CMakeCache.txt
+ cmake -D USE_DEBUG_LIB:BOOL=$buildType -D CMAKE_INSTALL_PREFIX:PATH=$installPrefixThird CMakeCache.txt
cmake -D BUILD_EXAMPLES:BOOL=OFF -D BUILD_TESTING:BOOL=OFF -D BUILD_SHARED_LIBS:BOOL=ON -D VTK_USE_QT:BOOL=ON CMakeCache.txt
make -j 2
make install
then
libname=gdcm
dirInstall=$binDir/$libname-Bin
- export GDCM_DIR=$installPrefix/lib/gdcm/
+ export GDCM_DIR=$installPrefixThird/lib/gdcm/
mkdir $dirInstall
cd $dirInstall
cmake -G"Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
##cmake -G"CodeBlocks - Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
- cmake -D USE_DEBUG_LIB:BOOL=$buildType -D CMAKE_INSTALL_PREFIX:PATH=$installPrefix CMakeCache.txt
+ cmake -D USE_DEBUG_LIB:BOOL=$buildType -D CMAKE_INSTALL_PREFIX:PATH=$installPrefixThird CMakeCache.txt
cmake -D VTK_DIR:PATH=$dirInstallVTK CMakeCache.txt
cmake -D GDCM_VTK:BOOL=ON -D GDCM_NAME_SPACE:STRING=gdcm13 CMakeCache.txt
make -j 2
then
libname=InsightToolkit-3.20.0
dirInstall=$binDir/$libname-Bin
- export ITK_DIR=$installPrefix/lib/InsightToolkit/
+ export ITK_DIR=$installPrefixThird/lib/InsightToolkit/
mkdir $dirInstall
cd $dirInstall
cmake -G"Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
##cmake -G"CodeBlocks - Unix Makefiles" -H$sourcesDir/$libname -B$dirInstall/
- cmake -D USE_DEBUG_LIB:BOOL=$buildType -D CMAKE_INSTALL_PREFIX:PATH=$installPrefix CMakeCache.txt
+ cmake -D USE_DEBUG_LIB:BOOL=$buildType -D CMAKE_INSTALL_PREFIX:PATH=$installPrefixThird CMakeCache.txt
cmake -D BUILD_EXAMPLES:BOOL=OFF -D BUILD_TESTING:BOOL=OFF -D BUILD_SHARED_LIBS:BOOL=ON -D ITK_USE_REVIEW:BOOL=ON CMakeCache.txt
cmake CMakeCache.txt
make -j 2
if [ true = true ]
then
cd $sourcesDir
- cp tth $installPrefix/bin
+ cp tth $installPrefixThird/bin
fi
#deal with create creatools_third_party_libraries_config.sh
-if [ -f $installPrefix/share/creatools_third_party_library_config.sh ]
+if [ -f $installPrefixThird/share/creatools_third_party_library_config.sh ]
then
- rm $installPrefix/share/creatools_third_party_library_config.sh
+ rm $installPrefixThird/share/creatools_third_party_library_config.sh
fi
-if [ ! -e $installPrefix/share ]
+if [ ! -e $installPrefixThird/share ]
then
- mkdir $installPrefix/share
+ mkdir $installPrefixThird/share
fi
-touch $installPrefix/share/creatools_third_party_library_config.sh
-chmod 755 $installPrefix/share/creatools_third_party_library_config.sh
-
-echo export PATH='$'PATH:$installPrefix/bin >> $installPrefix/share/creatools_third_party_library_config.sh
-echo export VTK_DIR=$installPrefix/lib/vtk-5.6 >> $installPrefix/share/creatools_third_party_library_config.sh
-echo export ITK_DIR=$installPrefix/lib/InsightToolkit >> $installPrefix/share/creatools_third_party_library_config.sh
-echo export GDCM_DIR=$installPrefix/lib/gdcm >> $installPrefix/share/creatools_third_party_library_config.sh
-echo export TTH=$installPrefix/bin/tth >> $installPrefix/share/creatools_third_party_library_config.sh
-echo export LD_LIBRARY_PATH='$'LD_LIBRARY_PATH:$GDCM_DIR >> $installPrefix/share/creatools_third_party_library_config.sh
-echo export LD_LIBRARY_PATH='$'LD_LIBRARY_PATH:$ITK_DIR >> $installPrefix/share/creatools_third_party_library_config.sh
-echo export LD_LIBRARY_PATH='$'LD_LIBRARY_PATH:$VTK_DIR >> $installPrefix/share/creatools_third_party_library_config.sh
+touch $installPrefixThird/share/creatools_third_party_library_config.sh
+chmod 755 $installPrefixThird/share/creatools_third_party_library_config.sh
+
+echo export PATH='$'PATH:$installPrefixThird/bin >> $installPrefixThird/share/creatools_third_party_library_config.sh
+echo export VTK_DIR=$installPrefixThird/lib/vtk-5.6 >> $installPrefixThird/share/creatools_third_party_library_config.sh
+echo export ITK_DIR=$installPrefixThird/lib/InsightToolkit >> $installPrefixThird/share/creatools_third_party_library_config.sh
+echo export GDCM_DIR=$installPrefixThird/lib/gdcm >> $installPrefixThird/share/creatools_third_party_library_config.sh
+echo export TTH=$installPrefixThird/bin/tth >> $installPrefixThird/share/creatools_third_party_library_config.sh
+echo export LD_LIBRARY_PATH='$'LD_LIBRARY_PATH:$GDCM_DIR >> $installPrefixThird/share/creatools_third_party_library_config.sh
+echo export LD_LIBRARY_PATH='$'LD_LIBRARY_PATH:$ITK_DIR >> $installPrefixThird/share/creatools_third_party_library_config.sh
+echo export LD_LIBRARY_PATH='$'LD_LIBRARY_PATH:$VTK_DIR >> $installPrefixThird/share/creatools_third_party_library_config.sh
# modify .bashrc
-# - remove line 'sh $installPrefix/share/creatools_third_party_library_config.sh' if any (with accurate value for ???)
+# - remove line 'sh $installPrefixThird/share/creatools_third_party_library_config.sh' if any (with accurate value for ???)
sed -i -e '/.*creatools_third_party_library_config.*/ d' /etc/bashrc
-# - add line 'sh $installPrefix/share/creatools_third_party_library_config.sh' (with accurate value for ???)
-echo source $installPrefix/share/creatools_third_party_library_config.sh >> /etc/bashrc
+# - add line 'sh $installPrefixThird/share/creatools_third_party_library_config.sh' (with accurate value for ???)
+echo source $installPrefixThird/share/creatools_third_party_library_config.sh >> /etc/bashrc
+
+
+
+
+
+
+
+# modify .bashrc
+# - remove line 'sh $installPrefix/creatools_install/share/creatools_base_party_libraries_config.sh' if any (with accurate value for ???)
+sed -i -e '/.*installPrefixCreaTools*/ d' ~/.bashrc
+sed -i -e '/.*creatools_base_library_config.*/ d' ~/.bashrc
+
+# - add line 'sh $installPrefix/creatools_install/share/creatools_base_libraries_config.sh' (with accurate value for ???)
+echo installPrefixCreaTools=$installPrefix >> ~/.bashrc
+
+echo '[ -f "$installPrefixCreaTools/share/creatools_base_library_config.sh" ] && source $installPrefixCreaTools/share/creatools_base_library_config.sh' >> ~/.bashrc