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