1 | #! /bin/sh -x |
---|
2 | #+ |
---|
3 | # NAME |
---|
4 | # ==== |
---|
5 | # |
---|
6 | # ircaam_profile.sh - define IRCAAM environnement |
---|
7 | # |
---|
8 | # SYNOPSYS |
---|
9 | # ======== |
---|
10 | # |
---|
11 | # |
---|
12 | # Online usage |
---|
13 | # :: |
---|
14 | # |
---|
15 | # $ . ./ircaam_profile.sh -d directory -i indir -o outdir -t tempdir |
---|
16 | # |
---|
17 | # In ${HOME}/.profile, add the following line |
---|
18 | # :: |
---|
19 | # |
---|
20 | # . ircaam_profile.sh -d directory -i indir -o outdir -t tempdir |
---|
21 | # |
---|
22 | # DESCRIPTION |
---|
23 | # =========== |
---|
24 | # |
---|
25 | # define IRCAAM environnement |
---|
26 | # |
---|
27 | # ${IRCAAM} is the base directory of tools. |
---|
28 | # |
---|
29 | # ${IRCAAM_LOG} is the directory where log files will be written. |
---|
30 | # |
---|
31 | # ${IRCAAM_ID} is the directory where input files must be. |
---|
32 | # |
---|
33 | # ${IRCAAM_OD} is the directory where output files will be written. |
---|
34 | # |
---|
35 | # MANPATH++ |
---|
36 | # |
---|
37 | # SEE ALSO |
---|
38 | # ======== |
---|
39 | # |
---|
40 | # for matlab/octave environment : |
---|
41 | # |
---|
42 | # ircaam_startup.m_ |
---|
43 | # |
---|
44 | # .. _ircaam_startup.m : ircaam_startup.m.html |
---|
45 | # |
---|
46 | # EXAMPLES |
---|
47 | # ======== |
---|
48 | # |
---|
49 | # |
---|
50 | # For fplod, on aedon.locean-ipsl.upmc.fr: |
---|
51 | # |
---|
52 | # :: |
---|
53 | # |
---|
54 | # $ cd /usr/home/fplod/incas/ircaam/ircaam_ws/src/ |
---|
55 | # $ . ./ircaam_profile.sh \ |
---|
56 | # -d $(pwd) \ |
---|
57 | # -i /usr/temp/${LOGNAME}/ircaam_d/ \ |
---|
58 | # -o /usr/temp/${LOGNAME}/ircaam_d/ \ |
---|
59 | # -t /usr/temp/${LOGNAME}/log/ |
---|
60 | # |
---|
61 | # For fplod on zeus.locean-ipsl.umpc.fr: |
---|
62 | # |
---|
63 | # :: |
---|
64 | # |
---|
65 | # $ cd ${HOME}/incas/ircaam/ircaam_ws/src/ |
---|
66 | # $ . ./ircaam_profile.sh \ |
---|
67 | # -d $(pwd) \ |
---|
68 | # -i /usr/temp/${LOGNAME}/ircaam_d/ \ |
---|
69 | # -o /usr/temp/${LOGNAME}/ircaam_d/ \ |
---|
70 | # -t /usr/temp/${LOGNAME}/log/ |
---|
71 | # |
---|
72 | # FILES |
---|
73 | # ===== |
---|
74 | # |
---|
75 | # original location |
---|
76 | # ~~~~~~~~~~~~~~~~~ |
---|
77 | # |
---|
78 | # /usr/home/fplod/incas/ircaam/ircaam_ws/src/ircaam_profile.sh sur aedon.locean-ipsl.upmc.fr |
---|
79 | # |
---|
80 | # |
---|
81 | # TODO |
---|
82 | # ==== |
---|
83 | # |
---|
84 | # |
---|
85 | # EVOLUTIONS |
---|
86 | # ========== |
---|
87 | # |
---|
88 | # ++ option bavarde |
---|
89 | # |
---|
90 | # ++ machine dependant |
---|
91 | # |
---|
92 | # ++ besoin de posix |
---|
93 | # |
---|
94 | # ++ pas de MANPATH defini par défaut sur zeus |
---|
95 | # |
---|
96 | # ++ climserv |
---|
97 | # |
---|
98 | # $Id$ |
---|
99 | # |
---|
100 | # - fplod 2008-08-14T12:28:16Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
101 | # |
---|
102 | # * move all \*.sh and \*.pro files to src/ |
---|
103 | # |
---|
104 | # - fplod 2008-07-21T10:58:47Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
105 | # |
---|
106 | # * creation |
---|
107 | # |
---|
108 | #- |
---|
109 | system=$(uname) |
---|
110 | case "${system}" in |
---|
111 | AIX|IRIX64) |
---|
112 | echo " www : no specific posix checking" |
---|
113 | ;; |
---|
114 | *) |
---|
115 | set -o posix |
---|
116 | ;; |
---|
117 | esac |
---|
118 | # |
---|
119 | # as this script might be launch in .profile, command is forced. |
---|
120 | command=ircaam_profile.sh |
---|
121 | # |
---|
122 | usage=" Usage : ${command} -d directory -i indir -o outdir -t tempdir" |
---|
123 | # |
---|
124 | while [ ! -z "${1}" ] # ++ pb bash |
---|
125 | do |
---|
126 | case ${1} in |
---|
127 | -d) # directory for application choosen by user (see svn checkout command used) |
---|
128 | directory=${2} |
---|
129 | shift |
---|
130 | ;; |
---|
131 | -i) # directory for inputs choosen by user |
---|
132 | indir=${2} |
---|
133 | shift |
---|
134 | ;; |
---|
135 | -o) # directory for outputs choosen by user |
---|
136 | outdir=${2} |
---|
137 | shift |
---|
138 | ;; |
---|
139 | -t) # directory for temporary outputs choosen by user |
---|
140 | tempdir=${2} |
---|
141 | shift |
---|
142 | ;; |
---|
143 | *) # other choice |
---|
144 | echo "${usage}" |
---|
145 | # nb : no exit because this file should be launched by login process |
---|
146 | ;; |
---|
147 | esac |
---|
148 | shift # next flag |
---|
149 | done |
---|
150 | # |
---|
151 | # check for ${directory} |
---|
152 | if [ ! -d ${directory} ] |
---|
153 | then |
---|
154 | echo " eee : ${directory} not found" |
---|
155 | # nb : no exit because this file should be launched by login process |
---|
156 | fi |
---|
157 | # |
---|
158 | # check for permission on directory |
---|
159 | if [ ! -x ${directory} ] |
---|
160 | then |
---|
161 | echo " eee : ${directory} not reachable" |
---|
162 | # nb : no exit because this file should be launched by login process |
---|
163 | fi |
---|
164 | # |
---|
165 | set -u |
---|
166 | system=$(uname) |
---|
167 | case "${system}" in |
---|
168 | IRIX64) |
---|
169 | echo " www : no specific posix checking" |
---|
170 | ;; |
---|
171 | *) |
---|
172 | set -o posix |
---|
173 | ;; |
---|
174 | esac |
---|
175 | # |
---|
176 | IRCAAM=${directory} |
---|
177 | export IRCAAM |
---|
178 | # |
---|
179 | # add IRCAAM tools to PATH |
---|
180 | # if not already done |
---|
181 | echo ${PATH} | grep -q ${IRCAAM} |
---|
182 | test_path=${?} |
---|
183 | if [ ${test_path} -ne 0 ] |
---|
184 | then |
---|
185 | PATH=${IRCAAM}/:${PATH} |
---|
186 | export PATH |
---|
187 | else |
---|
188 | # option bavarde oui/non pas encore implantée ++ |
---|
189 | echo "${command} : iii : ${IRCAAM}/ already in \${PATH}" |
---|
190 | fi |
---|
191 | # |
---|
192 | # add IRCAAM manuals to MANPATH |
---|
193 | # if not already done |
---|
194 | echo ${MANPATH} | grep -q ${IRCAAM} |
---|
195 | test_manpath=${?} |
---|
196 | if [ ${test_manpath} -ne 0 ] |
---|
197 | then |
---|
198 | MANPATH=${IRCAAM}/man/:${MANPATH} |
---|
199 | export MANPATH |
---|
200 | else |
---|
201 | # option bavarde oui/non pas encore implantée ++ |
---|
202 | echo "${command} : iii : ${IRCAAM}/man/ already in \${MANPATH}" |
---|
203 | fi |
---|
204 | # |
---|
205 | IRCAAM_LOG=${tempdir} |
---|
206 | export IRCAAM_LOG |
---|
207 | if [ ! -d ${IRCAAM_LOG} ] |
---|
208 | then |
---|
209 | mkdir -p ${IRCAAM_LOG} |
---|
210 | echo "${command} : iii : creation of \${IRCAAM_LOG}" |
---|
211 | fi |
---|
212 | # check for permission on IRCAAM_LOG |
---|
213 | if [ ! -x ${IRCAAM_LOG} ] |
---|
214 | then |
---|
215 | echo " eee : ${IRCAAM_LOG} not reachable" |
---|
216 | # nb : no exit because this file should be launched by login process |
---|
217 | fi |
---|
218 | # |
---|
219 | # check for permission on IRCAAM_LOG |
---|
220 | if [ ! -w ${IRCAAM_LOG} ] |
---|
221 | then |
---|
222 | echo " eee : ${IRCAAM_LOG} not writable" |
---|
223 | # nb : no exit because this file shouldreachable be launched by login process |
---|
224 | fi |
---|
225 | # |
---|
226 | EDITOR=vi |
---|
227 | export EDITOR |
---|
228 | # |
---|
229 | # io directories |
---|
230 | IRCAAM_ID=${indir} |
---|
231 | export IRCAAM_ID |
---|
232 | if [ ! -d ${IRCAAM_ID} ] |
---|
233 | then |
---|
234 | mkdir -p ${IRCAAM_ID} |
---|
235 | echo "${command} : iii : creation of \${IRCAAM_ID}" |
---|
236 | fi |
---|
237 | # check for permission on IRCAAM_ID |
---|
238 | if [ ! -x ${IRCAAM_ID} ] |
---|
239 | then |
---|
240 | echo " eee : ${IRCAAM_ID} not reachable" |
---|
241 | # nb : no exit because this file should be launched by login process |
---|
242 | fi |
---|
243 | # |
---|
244 | IRCAAM_OD=${outdir} |
---|
245 | export IRCAAM_OD |
---|
246 | if [ ! -d ${IRCAAM_OD} ] |
---|
247 | then |
---|
248 | mkdir -p ${IRCAAM_OD} |
---|
249 | echo "${command} : iii : creation of \${IRCAAM_OD}" |
---|
250 | fi |
---|
251 | # check for permission on IRCAAM_OD |
---|
252 | if [ ! -x ${IRCAAM_OD} ] |
---|
253 | then |
---|
254 | echo " eee : ${IRCAAM_OD} not reachable" |
---|
255 | # nb : no exit because this file should be launched by login process |
---|
256 | fi |
---|
257 | if [ ! -w ${IRCAAM_OD} ] |
---|
258 | then |
---|
259 | echo " eee : ${IRCAAM_OD} not writable" |
---|
260 | # nb : no exit because this file should be launched by login process |
---|
261 | fi |
---|
262 | # |
---|
263 | # end |
---|
264 | # nb : no exit because this file should be launched by login process |
---|