]> Creatis software - creaToolsTools.git/blob - Linux/menu.sh
First step of 'all in one' install procedure
[creaToolsTools.git] / Linux / menu.sh
1 #!/bin/sh
2
3 if [ $UID != 0 ] 
4 then
5   echo
6   echo "..ERROR.."
7   echo "==================================================="
8   echo "REMEMBER !"
9   echo ""
10   echo "YOU NEED TO RUN THIS ONE AS root"
11   echo "==================================================="
12   echo
13   echo
14   exit 0
15
16 else
17  i=999
18 while [ $i != 9 ]
19 do
20
21 echo
22 echo
23 echo
24 echo "                   MENU"
25 echo
26 echo " Choose what you want to do :"
27 echo  
28 echo " Configure :                     0"
29 echo " Install Third Party Libraries : 1"
30 echo " Compile the CreaTools :         2"
31 echo " Install the CreaTools :         3"
32 echo
33 echo " Exit :                          9"
34 echo
35 echo
36 echo 
37
38 echo "Type in your choice :"
39 read i
40
41   case $i in
42   0)
43 echo
44 echo
45   confirm="NO"
46   while [ "$confirm" != "YES" ]
47   do
48   OperatingSystem="XXX"
49   while [[ "$OperatingSystem" != "Linux"  && \
50            "$OperatingSystem" != "Ubuntu" && \
51            "$OperatingSystem" != "MacOS" ]]
52   do
53   echo "Operating System : Linux/Ubuntu/MacOS (mandatory!)"
54   read OperatingSystem
55   done
56   echo "you said : [" $OperatingSystem "]"
57 echo
58 echo
59   # ------------------
60   
61   
62   # ------------------
63   echo "Name of the Generation Directory (default is /tmp/myGenerationDir)"
64   read generationdir
65   if [ "$generationdir" = "" ]
66   then
67      generationdir="/tmp/myGenerationDir"
68   fi
69   echo "you said : [" $generationdir "]"
70 echo
71 echo
72   # ------------------
73
74   installPrefix="XXX"
75      echo "Install Prefix : '$generationdir/creatools_install' / '/usr/local' (default is '$generationdir/creatools_install')"
76      read installPrefix
77   if [ "$installPrefix" = "" ]
78   then
79      installPrefix="/tmp/myGenerationDir/creatools_install"
80   fi
81   echo "you said : [" $installPrefix "]"
82 echo
83 echo 
84   # ------------------
85
86   docgeneration="XXX"
87   while [[ "$docgeneration" != "YES"  && "$docgeneration" != "NO" ]]
88   do
89   echo "Boolean For Doc Generation : YES/NO (default is NO)"
90   read docgeneration
91   if [ "$docgeneration" = "" ]
92   then
93      docgeneration="NO"
94   fi
95   echo "you said : [" $docgeneration "]"
96   done
97 echo
98 echo
99   # ------------------
100
101   sourcesFrom="XXX"
102   while [[ "$sourcesFrom" != "CVS"  && "$sourcesFrom" != "HTML" ]]
103   do
104   echo "Where do you want to get source files from : CVS/HTML (default is HTML)"
105   read sourcesFrom
106   if [ "$sourcesFrom" = "" ]
107   then
108      sourcesFrom="HTML"
109   fi
110   echo "you said : [" $sourcesFrom "]"
111   done
112 echo
113 echo
114   # ------------------
115   
116   cvsUserName=""
117   if [ "$sourcesFrom" = "CVS" ]
118   then
119   while [ "$cvsUserName" == "" ]
120   do
121      echo "CVS User Name (mandatory!)"
122      read cvsUserName
123   done
124   echo "you said : [" $cvsUserName "]"
125   else
126     cvsUserName="cvsUserNameCannotBeEmpty" 
127   fi
128 echo
129 echo
130   # ------------------
131
132   linuxUserName=""
133   while [ "$linuxUserName" == "" ]
134   do
135      echo "LINUX/MacOS User Name (mandatory!)"
136      read linuxUserName  
137      echo "you said : [" $linuxUserName "]"  
138   done
139 echo
140 echo
141   # ------------------
142   
143   buildType="XXX"
144   while [[ "$buildType" != "Release"  && "$Debug " != "HTML" ]]
145   do
146   echo "Build type : Release/Debug (default is Release)"
147   read buildType
148   if [ "$buildType" = "" ]
149   then
150      buildType="Release"
151   fi
152   echo "you said : [" $buildType "]"
153   done
154 echo
155 echo
156   # ------------------
157   
158   gdcmVersion="XXX"
159   while [[ "$gdcmVersion" != "GDCM1"  && "$gdcmVersion " != "GDCM2" ]]
160   do
161   echo "Gdcm version : GDCM1/GDCM2 (default is GDCM1)"
162   read gdcmVersion
163   if [ "$gdcmVersion" = "" ]
164   then
165      gdcmVersion="GDCM1"
166   fi
167   echo "you said : [" $gdcmVersion "]"
168   done
169 echo
170 echo
171 echo
172 echo
173 echo "You said :"
174 echo "           Operating System                           : $OperatingSystem"
175 echo "           Name of the Generation Directory           : $generationdir"
176 echo "           Install Prefix                             : $installPrefix"
177 echo "           Boolean For Doc Generation                 : $docgeneration"
178 echo "           Where do you want to get source files from : $sourcesFrom"
179 if [ $sourcesFrom = CVS ]
180 then
181 echo "           CVS User Name                              : $cvsUserName"
182 fi
183 echo "           LINUX/MacOS User Name                      : $linuxUserName"
184 echo "           Build type                                 : $buildType"          
185 echo "           Gdcm version                               : $gdcmVersion"
186 echo
187 echo
188 echo "Do you confirm your choices : YES/NO ? (default is NO)"
189 read confirm
190 done 
191
192 configureFile="configure.sh"
193 touch  $configureFile
194 echo "#!/bin/sh"                         >> $configureFile
195 echo "OperatingSystem=$OperatingSystem"  >> $configureFile
196 echo "generationdir=$generationdir"      >> $configureFile
197 echo "installPrefix= $installPrefix"     >> $configureFile
198 echo "docgeneration=$docgeneration"      >> $configureFile
199 echo "sourcesFrom=$sourcesFrom"          >> $configureFile
200 echo "cvsUserName=$cvsUserName"          >> $configureFile 
201 echo "linuxUserName=$linuxUserName"      >> $configureFile
202 echo "buildType=$buildType"              >> $configureFile
203 echo "gdcmVersion=$gdcmVersion"          >> $configureFile
204
205          
206   # ------------------
207          
208   ;;
209   
210   1)
211  echo "========================== $i Not Yet made"  
212   ;;
213   
214   2)
215  echo "========================== $i Not Yet made"
216   ;;
217   
218   3) 
219   echo "========================= $i Not Yet made"
220   ;;
221   
222   9) 
223   echo exit
224   ;;
225    
226   *)
227   echo "Your answer must be in {0, 1, 2, 3, 9} (was $i)"
228   ;;
229   esac
230
231 done
232 fi