source: trunk/src/ircaam_profile.sh @ 12

Last change on this file since 12 was 12, checked in by pinsard, 15 years ago

add matlab startup

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