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