source: trunk/src/ircaam_profile.sh @ 71

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

add man troff output of manuals and some light modification in sources due to docutils upgrade (0.6); warning : new troubles with target

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