source: trunk/src/ircaam_profile.sh @ 67

Last change on this file since 67 was 67, checked in by pinsard, 14 years ago

project homogenization

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