source: trunk/src/ircaam_profile.sh @ 2

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

first commit with original work of Francoise Pinsard

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