1 | # |
---|
2 | # surfex install script and documentation |
---|
3 | # --------------------------------------- |
---|
4 | # |
---|
5 | # Short Version of the Installation Intructions: |
---|
6 | # ---------------------------------------------- |
---|
7 | # (For longer installation instructions, see further down.) |
---|
8 | # |
---|
9 | # Run this script by typing the following into a shell: |
---|
10 | # ./INSTALL_LINUX |
---|
11 | # This writes a script called "surfex" to a directory contained in your bash path. |
---|
12 | # You can then start surfex by typing: |
---|
13 | # surfex |
---|
14 | # |
---|
15 | |
---|
16 | # |
---|
17 | # surfex: |
---|
18 | # ------- |
---|
19 | # |
---|
20 | # visualizing real algebraic surfaces using several visualization tools: |
---|
21 | # - raytracing: surf |
---|
22 | # - triangulation: (display: JavaView) |
---|
23 | # |
---|
24 | # main features: |
---|
25 | # - high quality output for printed publications and for the internet |
---|
26 | # - interactivity, in particular: intuitive rotation/scaling |
---|
27 | # |
---|
28 | # @version 0.89.07, 2006 / 11 / 23 |
---|
29 | # |
---|
30 | # @author Stephan Holzer, Oliver Labs |
---|
31 | # idea: Oliver Labs (2001) during the Dagstuhl workshop Algebra, Geometry, and Software Systems |
---|
32 | # this version is based on some older code by Richard Morris and Oliver Labs |
---|
33 | # |
---|
34 | # @address previous versions: |
---|
35 | # - (until Oct. 2005): department of mathematics, University of Mainz, Germany |
---|
36 | # - (until March 2006): RICAM at Linz, Austria |
---|
37 | # - since then: University of the Saarland (Saarbruecken, Germany) |
---|
38 | # |
---|
39 | # @web www.surfex.algebraicsurface.net |
---|
40 | # |
---|
41 | |
---|
42 | |
---|
43 | # |
---|
44 | # install surfex on Linux/Unix/Mac OS X |
---|
45 | # ------------------------------------- |
---|
46 | # |
---|
47 | # - Requisites to be able to run "surfex" (all are freely available): |
---|
48 | # - required: Java, version >= 1.4.2 (www.java.sun.com) |
---|
49 | # - required: surf (www.surf.sourceforge.net) |
---|
50 | # - optional (for movies): convert (www.imagemagick.org) |
---|
51 | # |
---|
52 | # - Download surfex_<version>.tar.gz to a directory of your choice. |
---|
53 | # In the sequel, we will call this directory install_dir. |
---|
54 | # The current version of surfex should always be available from: |
---|
55 | # www.surfex.algebraicsurface.net |
---|
56 | # |
---|
57 | # - Uncompress the file, e.g. by typing the following into a shell: |
---|
58 | # tar -xzf surfex_<version>.tar.gz |
---|
59 | # |
---|
60 | # - This should have created a sub-directory called surfex_<version>. |
---|
61 | # Change to this directory, e.g. by typing the following into the shell: |
---|
62 | # cd surfex_<version> |
---|
63 | # |
---|
64 | # - Run the INSTALL_LINUX script, e.g. by typing the following into the shell: |
---|
65 | # ./INSTALL_LINUX |
---|
66 | # |
---|
67 | # - This produces a script, called "surfex" and copies it to a directory contained in your bash path. |
---|
68 | # |
---|
69 | |
---|
70 | # |
---|
71 | # The installation program: |
---|
72 | # ------------------------- |
---|
73 | |
---|
74 | echo |
---|
75 | |
---|
76 | mytmp=/tmp/tmp.txt |
---|
77 | failmsg="" |
---|
78 | |
---|
79 | my_java_prg=java |
---|
80 | my_surf_prg=surf |
---|
81 | my_convert_prg=convert |
---|
82 | |
---|
83 | # |
---|
84 | # try to locate the helper tools we need: |
---|
85 | # |
---|
86 | |
---|
87 | function findbinpath() { |
---|
88 | mybinpath="" |
---|
89 | |
---|
90 | # first, try to use the user's private bin directory for surfex: |
---|
91 | tstbinpath=~/bin |
---|
92 | echo $PATH | grep "$tstbinpath" >$mytmp |
---|
93 | if [ -s $mytmp ] && [ -a $tstbinpath ]; then return 0; fi |
---|
94 | |
---|
95 | echo |
---|
96 | echo |
---|
97 | echo ">>> $tstbinpath is not contained in your bash path." |
---|
98 | echo |
---|
99 | echo "This is the standard location for surfex." |
---|
100 | echo "Should INSTALL_LINUX add this directory to the bash path for you now?" |
---|
101 | echo "(Please, type 'yes' or 'no' and then press ENTER.)" |
---|
102 | read |
---|
103 | answer="$REPLY" |
---|
104 | echo |
---|
105 | echo "REPLY:$answer." |
---|
106 | echo |
---|
107 | if [ "$answer" == "yes" ] && ! [ -d $tstbinpath ]; then mkdir $tstbinpath; fi |
---|
108 | failmsg="$tstbinpath could not be created. |
---|
109 | Please solve this problem (probably you have to login as superuser (root), and then rerun INSTALL_LINUX." |
---|
110 | if [ "$answer" == "yes" ] && ! [ -d $tstbinpath ]; then failexit; fi |
---|
111 | if [ "$answer" == "yes" ] && [ -d $tstbinpath ]; then echo "export PATH=$tstbinpath:\$PATH" >>~/.bashrc ; fi |
---|
112 | if [ "$answer" == "yes" ] && [ -d $tstbinpath ]; then echo "export PATH=$tstbinpath:\$PATH" >>~/.profile ; fi |
---|
113 | if [ "$answer" == "yes" ] && [ -d $tstbinpath ]; then export PATH=$tstbinpath:$PATH; fi |
---|
114 | if [ "$answer" == "yes" ] && [ -d $tstbinpath ]; then return 0; fi |
---|
115 | |
---|
116 | # |
---|
117 | # if the user did not want to use the user's private bin directory: |
---|
118 | # |
---|
119 | tstbinpath=/usr/local/bin |
---|
120 | echo $PATH | grep "$tstbinpath" >$mytmp |
---|
121 | if [ -s $mytmp ]; then return 0; fi |
---|
122 | |
---|
123 | tstbinpath="" |
---|
124 | failmsg="We could not find a nice path in your bash path. |
---|
125 | You chose not to create ~/bin. |
---|
126 | So, please, solve the problem on your own." |
---|
127 | failexit |
---|
128 | } |
---|
129 | |
---|
130 | function copytopath() { |
---|
131 | # echo "copytopath()" |
---|
132 | echo "searching for $tstprg (this may take some time)..." |
---|
133 | find / -name $tstprg | sed 1q >$mytmp |
---|
134 | failmsg="" |
---|
135 | if [ -s $mytmp ]; then echo "$tstprg found"; else failexit; fi |
---|
136 | srcpath=`cat $mytmp` |
---|
137 | # just in case the x-bit is not set yet: |
---|
138 | chmod + $srcpath |
---|
139 | rm $mytmp |
---|
140 | echo "at: $srcpath." |
---|
141 | # echo "look for a directory which is contained in your path:" |
---|
142 | # search for a nice path in the $PATH: |
---|
143 | findbinpath |
---|
144 | # if we found a writable one, then copy the program to that path: |
---|
145 | if [ -w $tstbinpath ]; then cp $srcpath $tstbinpath/; fi |
---|
146 | if [ -w $tstbinpath ]; then return 0; fi |
---|
147 | |
---|
148 | failmsg=">>> The directory '$tstbinpath' to which INSTALL_LINUX wants to copy $tstprg is not writable! |
---|
149 | Maybe you have to login as a superuser (root) to have the right to write to this directory. |
---|
150 | In that case, type 'su', enter the superuser password and rerun INSTALL_LINUX. |
---|
151 | " |
---|
152 | failexit |
---|
153 | } |
---|
154 | |
---|
155 | function maybecopytopath() { |
---|
156 | echo "How do you want to proceed? Type '1' or '2', followed by ENTER."; |
---|
157 | REPLY="" |
---|
158 | read |
---|
159 | answer="$REPLY" |
---|
160 | echo |
---|
161 | failmsg="Okay, you chose to exit INSTALL_LINUX, solve the problem on your own, and rerun INSTALL_LINUX then again." |
---|
162 | if [ "$answer" == "3" ]; then return 0; fi |
---|
163 | if [ "$answer" == "2" ]; then copytopath; else failexit; fi |
---|
164 | } |
---|
165 | |
---|
166 | function failexit() { |
---|
167 | echo |
---|
168 | # if a message was specified, then display it and exit: |
---|
169 | if [ -n "$failmsg" ]; then echo $failmsg; fi |
---|
170 | if [ -n "$failmsg" ]; then exit; fi |
---|
171 | |
---|
172 | # else display the standard message: |
---|
173 | echo ">>> surfex needs to find $tstprg to be able to work." |
---|
174 | echo ">>> Please install $tstprg and copy it to a directory" |
---|
175 | echo ">>> which is contained in your bash path." |
---|
176 | echo ">>> Your current path is: |
---|
177 | $PATH |
---|
178 | " |
---|
179 | echo ">>> Then run INSTALL_LINUX again." |
---|
180 | # rm $mytmp |
---|
181 | exit |
---|
182 | } |
---|
183 | |
---|
184 | # |
---|
185 | # test if java is usable: |
---|
186 | # |
---|
187 | |
---|
188 | tstprg=$my_java_prg |
---|
189 | |
---|
190 | which $tstprg >$mytmp 2>/dev/null |
---|
191 | if [ -s $mytmp ]; then echo "$tstprg found."; else echo " |
---|
192 | |
---|
193 | >>> $tstprg not found! |
---|
194 | |
---|
195 | This problem might be caused by two reasons: |
---|
196 | |
---|
197 | (1) Either you have not installed java (e.g. from www.java.sun.com) yet. |
---|
198 | In that case, quit INSTALL_LINUX, install java, and rerun INSTALL_LINUX. |
---|
199 | |
---|
200 | (2) Or $tstprg is not contained in your path yet. |
---|
201 | In that case, INSTALL_LINUX can try to solve this problem for you by copying $tstprg to a directory |
---|
202 | which is contained in your path. |
---|
203 | "; fi |
---|
204 | if ! [ -s $mytmp ]; then maybecopytopath; fi |
---|
205 | |
---|
206 | |
---|
207 | # |
---|
208 | # test if surf is usable: |
---|
209 | # |
---|
210 | |
---|
211 | tstprg=$my_surf_prg |
---|
212 | |
---|
213 | which $tstprg >$mytmp 2>/dev/null |
---|
214 | if [ -s $mytmp ]; then echo "$tstprg found."; else echo " |
---|
215 | |
---|
216 | >>> $tstprg not found! |
---|
217 | |
---|
218 | If you have already installed surf then this problem might be caused by two reasons: |
---|
219 | |
---|
220 | (1) Either the surf program has a different name (e.g. surf-1.0.5). |
---|
221 | In that case, quit INSTALL_LINUX, rename the surf program to $tstprg, and rerun INSTALL_LINUX. |
---|
222 | |
---|
223 | (2) Or $tstprg is the correct filename, but $tstprg is not contained in your bash path. |
---|
224 | In that case, INSTALL_LINUX can try to solve the problem for you. |
---|
225 | "; fi |
---|
226 | |
---|
227 | if ! [ -s $mytmp ]; then maybecopytopath; fi |
---|
228 | |
---|
229 | |
---|
230 | # |
---|
231 | # test if convert is usable: |
---|
232 | # |
---|
233 | |
---|
234 | tstprg=$my_convert_prg |
---|
235 | |
---|
236 | which $tstprg >$mytmp 2>/dev/null |
---|
237 | if [ -s $mytmp ]; then echo "convert found."; else echo " |
---|
238 | |
---|
239 | >>> $tstprg not found! |
---|
240 | |
---|
241 | If you want to produce movies using surfex, |
---|
242 | then $tstprg has to be contained in your bash path. |
---|
243 | One of the following options should apply: |
---|
244 | |
---|
245 | (1) I have not installed convert yet and I want to do that now. |
---|
246 | In that case, quit INSTALL_LINUX, install convert, and rerun INSTALL_LINUX. |
---|
247 | |
---|
248 | (2) convert is installed, but $tstprg is not contained in the bash path yet. |
---|
249 | In that case, INSTALL_LINUX can try to solve this problem for you by copying $tstprg to a directory |
---|
250 | which is contained in your path. |
---|
251 | |
---|
252 | (3) I do not want to produce movies using surfex. |
---|
253 | So, continue with the INSTALL_LINUX process without finding $tstprg. |
---|
254 | |
---|
255 | "; fi |
---|
256 | if ! [ -s $mytmp ]; then maybecopytopath; fi |
---|
257 | |
---|
258 | |
---|
259 | # |
---|
260 | # build the start script: |
---|
261 | # |
---|
262 | |
---|
263 | cat surfex_start_part1 >surfex |
---|
264 | echo "surfex_dir=\"$PWD\"" >>surfex |
---|
265 | cat surfex_start_part2 >>surfex |
---|
266 | chmod +x surfex |
---|
267 | |
---|
268 | # copy surfex to a directory which is contained in the user's $PATH: |
---|
269 | findbinpath |
---|
270 | # if we found a writable one, then copy the program to that path: |
---|
271 | if [ -w $tstbinpath ]; then cp ./surfex $tstbinpath; fi |
---|
272 | failmsg="surfex could not be copied to $tstbinpath. |
---|
273 | Maybe you have to login as a superuser (root) to have the right to write to this directory. |
---|
274 | In that case, type 'su', enter the superuser password and then rerun INSTALL_LINUX. |
---|
275 | " |
---|
276 | if ! [ -w $tstbinpath ]; then failexit; fi |
---|
277 | |
---|
278 | echo " |
---|
279 | ------------------------------------------------------------------------------- |
---|
280 | This INSTALL_LINUX script has written the script \"surfex\" the directory $tstbinpath. |
---|
281 | This directory is contained in your bash path. |
---|
282 | |
---|
283 | To start surfex, you can now type: |
---|
284 | surfex |
---|
285 | or something like |
---|
286 | surfex -e \"x^3+(y-z)*(y+z)\" |
---|
287 | if you want to envoke surfex with a particular equation. |
---|
288 | Once you have done that, three windows should open up. |
---|
289 | To rotate the surface which you see in one of them, drag your mouse pointer |
---|
290 | over the green sphere. |
---|
291 | |
---|
292 | If this does not work, you might have to edit the file \"surfex\". |
---|
293 | Please, contact us if you do not manage to get surfex run on your system. |
---|
294 | " |
---|
295 | |
---|
296 | echo "We are happy to receive any kind of feedback, |
---|
297 | |
---|
298 | Stephan Holzer and Oliver Labs |
---|
299 | |
---|
300 | |
---|
301 | surfex comes without any warranty. For download, documentation, examples, etc., see: |
---|
302 | www.surfex.AlgebraicSurface.net |
---|
303 | ------------------------------------------------------------------------------- |
---|
304 | " |
---|
305 | # |
---|
306 | # Disclaimer: |
---|
307 | # ----------- |
---|
308 | # |
---|
309 | # surfex comes without any warranty. |
---|
310 | # Feel free to use and distribute surfex. |
---|
311 | # |
---|
312 | |
---|
313 | rm $mytmp |
---|
314 | |
---|
315 | bash |
---|