1 # ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 # This software is governed by the CeCILL-B license under French law and
8 # abiding by the rules of distribution of free software. You can use,
9 # modify and/ or redistribute the software under the terms of the CeCILL-B
10 # license as circulated by CEA, CNRS and INRIA at the following URL
11 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
12 # or in the file LICENSE.txt.
14 # As a counterpart to the access to the source code and rights to copy,
15 # modify and redistribute granted by the license, users are provided only
16 # with a limited warranty and the software's author, the holder of the
17 # economic rights, and the successive licensors have only limited
20 # The fact that you are presently reading this means that you have had
21 # knowledge of the CeCILL-B license and that you accept its terms.
22 # ------------------------------------------------------------------------
28 ##########################################
29 # check that $1 is one of $2, $3, ...
34 if [ "$val" == "$x" ] ; then
42 ###########################################
44 echo " ================================================================================================"
45 echo " ================================================================================================"
47 echo " ================================================================================================"
48 echo " ================================================================================================"
51 ###########################################
52 function checkDistrib {
54 if [ "`checkVal $OS MacOS Fedora Ubuntu Mandriva CentOS Debian`" == "false" ] ; then
55 echo "Operating System not supported: $OS"
56 echo "Currently supported system: Fedora Ubuntu MacOS"
61 ###########################################
65 if [ "$OS" == Darwin ] ; then
68 ## elif [ "$OS" == Linux ] ; then OS=$(lsb_release -i | awk '{print $3}')
69 elif [ ""$OS"" == Linux ] ; then
70 OS=`awk 'NR==1{print $1}' /etc/system-release`
71 if [ $OS == "" ] ; then
72 OS=$(lsb_release -i | awk '{print $3}')
81 ###########################################
82 function getDistribVersion {
83 local DISTRIB=`getDistrib`
85 if [ "$DISTRIB" == MacOS ] ; then OSVersion=`sw_vers | grep ProductVersion | awk '{ print $2 }' `;
86 elif [ "$DISTRIB" == Fedora ] ; then OSVersion=`awk 'NR==1{print $3}' /etc/system-release`
87 elif [ "$DISTRIB" == Ubuntu ] ; then OSVersion=`awk 'NR==1{print $2}' /etc/issue`
88 elif [ "$DISTRIB" == CentOS ] ; then OSVersion=`awk 'NR==1{print $3}' /etc/issue`
89 elif [ "$DISTRIB" == Debian ] ; then OSVersion=`awk 'NR==1{print $3}' /etc/issue`
90 else OSVersion="VOID_EED"
95 ###########################################
96 function getKernelVersion {
97 local DISTRIB=`getDistrib`
99 if [ "$DISTRIB" == MacOS ] ; then KernelVersion=VOID_Darwin_EED;
100 elif [ "$DISTRIB" == Fedora ] ; then KernelVersion=$(uname -a | awk '{print $3}')
101 elif [ "$DISTRIB" == Ubuntu ] ; then KernelVersion=$(uname -a | awk '{print $3}')
102 elif [ "$DISTRIB" == CentOS ] ; then KernelVersion=$(uname -a | awk '{print $3}')
103 elif [ "$DISTRIB" == Debian ] ; then KernelVersion=$(uname -a | awk '{print $3}')
104 else KernelVersion="VOID_EED"
112 ###########################################
113 function getDownloadCommand {
114 local DISTRIB=`getDistrib`
116 if [ "$DISTRIB" == MacOS ] ; then downloadCommand='curl -O '
117 elif [ "$DISTRIB" == Fedora ] ; then downloadCommand='aria2c -x 16'
118 elif [ "$DISTRIB" == CentOs ] ; then downloadCommand='aria2c -x 16'
119 elif [ "$DISTRIB" == Ubuntu ] ; then downloadCommand=wget
120 elif [ "$DISTRIB" == Debian ] ; then downloadCommand=wget
121 else downloadCommand="VOID_EED"
123 echo $downloadCommand
126 ###########################################
128 if [ `uname` == Darwin ] ; then # MacOS
130 # system_profiler | grep Processor | awk '$1=="Number" {print $4}'
131 sysctl hw.physicalcpu hw.logicalcpu | grep logicalcpu | awk '{print $2}'
133 cat /proc/cpuinfo | grep processor | wc -l
137 ###########################################
139 if [ ! -f $HOME/.bashrc ] ; then
145 # # Do it, while we are under user, not under root! # JPR
146 # if [ -f $HOME/.bashrc ] ; then
149 # if [ -f $HOME/.profile ] ; then
150 # echo $HOME/.profile
152 # echo "=============== BIG TROUBLE : neither $HOME/.bashrc nor $HOME/.profile file found" > /dev/stderr
153 # echo "=============== You'd better abort the program and (try to) fix the issue" > /dec/stderr
154 # read a # just to let the user time enough to read the message...
160 ###########################################
161 function printconfig {
163 echo "Current Configuration:"
164 echo " Operating System : $OperatingSystem"
165 echo " Number of Cores : $corenumber"
166 echo " Name of the Generation Directory : $generationdir"
167 echo " Install Prefix for Third Party Libraries : $installPrefixThird"
168 echo " Install Prefix for CreaTools : $installPrefix"
169 echo " Boolean for Doc Generation : $docgeneration"
170 echo " Where do you want to get source files from : $sourcesFrom"
171 echo " Login User Name : $loginUserName"
172 echo " Login Group Name : $loginGroupName"
173 echo " Build type : $buildType"
174 echo " Gdcm version : $gdcmVersion"
175 echo " ITK version : $ITKVersion"