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