source: trunk/src/ircaam_profile.sh @ 7

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

improvment for manuals production; add manuals

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