source: trunk/superbib_profile.sh @ 87

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

add journals thanks to REGYNA project (redo)

  • Property svn:executable set to *
File size: 4.7 KB
Line 
1#! /bin/sh
2#+
3#
4# NAME
5# ====
6#
7# superbib_profile.sh - define SUPERBIB environnement
8#
9# SYNOPSYS
10# ========
11#
12# Online usage
13#
14# ::
15#
16# $ . ./superbib_profile.sh -d directory -i indir -o outdir -t tempdir
17#
18# In ${HOME}/.profile, add the following line
19#
20# ::
21#
22# . superbib_profile.sh -d directory  -i indir -o outdir -t tempdir
23#
24# DESCRIPTION
25# ===========
26#
27# define SUPERBIB environnement
28#
29# ${SUPERBIB} is the base directory of tools.
30#
31# ${SUPERBIB_LOG} is the directory where log files  will be written.
32#
33# ${SUPERBIB_ID} is the directory where input files must be.
34#
35# ${SUPERBIB_OD}  is the directory where output files will be written.
36#
37# MANPATH++
38#
39# EXAMPLES
40# ========
41#
42# For fplod, on aedon.locean-ipsl.upmc.fr:
43# ::
44#
45#  $ cd /usr/home/fplod/src/superbib/superbib_ws/src/
46#  $ . ./superbib_profile.sh \
47#    -d $(pwd) \
48#    -i /usr/temp/${LOGNAME}/superbib_d/ \
49#    -o /usr/temp/${LOGNAME}/superbib_d/ \
50#    -t /usr/temp/${LOGNAME}/log/
51#
52#
53# FILES
54# =====
55#
56# original location
57# ~~~~~~~~~~~~~~~~~
58#
59# /usr/home/fplod/src/superbib/superbib_ws/src/superbib_profile.sh sur aedon.locean-ipsl.upmc.fr
60#
61# EVOLUTIONS
62# ==========
63#
64#
65# ++ option bavarde
66#
67# ++ machine dependant
68#
69# ++ compilateur dependant
70#
71# ++ pas de MANPATH defini par défaut sur zeus
72#
73# $Id$
74#
75# - fplod 2008-10-31T11:17:24Z aedon.locean-ipsl.upmc.fr (Darwin)
76#
77#   * creation ++ pas encore en service
78#
79#-
80system=$(uname)
81case "${system}" in
82 AIX|IRIX64)
83  echo " www : no specific posix checking"
84 ;;
85 *)
86  set -o posix
87 ;;
88esac
89#
90# as this script might be launch in .profile, command is forced.
91command=superbib_profile.sh
92#
93usage=" Usage : ${command} -d directory -i indir -o outdir -t tempdir"
94#
95while [ ! -z "${1}" ] # ++ pb bash
96do
97 case ${1} in
98 -d) # directory for application choosen by user (see svn checkout command used)
99  directory=${2}
100  shift
101 ;;
102 -i) # directory for inputs choosen by user
103  indir=${2}
104  shift
105 ;;
106 -o) # directory for outputs choosen by user
107  outdir=${2}
108  shift
109 ;;
110 -t) # directory for temporary outputs choosen by user
111  tempdir=${2}
112  shift
113 ;;
114 *) # other choice
115  echo "${usage}"
116  # nb : no exit because this file should be launched by login process
117 ;;
118 esac
119 shift # next flag
120done
121#
122# check for ${directory}
123if [ ! -d ${directory} ]
124then
125 echo " eee : ${directory} not found"
126 # nb : no exit because this file should be launched by login process
127fi
128#
129# check for permission on directory
130if [ ! -x ${directory} ]
131then
132 echo " eee : ${directory} not reachable"
133 # nb : no exit because this file should be launched by login process
134fi
135#
136system=$(uname)
137#
138SUPERBIB=${directory}
139export SUPERBIB
140#
141# add SUPERBIB tools to PATH
142# if not already done
143echo ${PATH} | grep -q ${SUPERBIB}
144test_path=${?}
145if [ ${test_path} -ne 0 ]
146then
147   PATH=${SUPERBIB}/:${PATH}
148   export PATH
149else
150   # option bavarde oui/non pas encore implantée ++
151   echo "${command} : iii : ${SUPERBIB}/ already in \${PATH}"
152fi
153#
154# add SUPERBIB manuals to MANPATH
155# if not already done
156echo ${MANPATH} | grep -q ${SUPERBIB}
157test_manpath=${?}
158if [ ${test_manpath} -ne 0 ]
159then
160   MANPATH=${SUPERBIB}/man/:${MANPATH}
161   export MANPATH
162else
163   # option bavarde oui/non pas encore implantée ++
164   echo "${command} : iii : ${SUPERBIB}/man/ already in \${MANPATH}"
165fi
166#
167SUPERBIB_LOG=${tempdir}
168export SUPERBIB_LOG
169if [ ! -d ${SUPERBIB_LOG} ] 
170then
171  mkdir -p ${SUPERBIB_LOG}
172  echo "${command} : iii : creation of \${SUPERBIB_LOG}"
173fi 
174# check for permission on SUPERBIB_LOG
175if [ ! -x ${SUPERBIB_LOG} ]
176then
177 echo " eee : ${SUPERBIB_LOG} not reachable"
178 # nb : no exit because this file should be launched by login process
179fi
180#
181# check for permission on SUPERBIB_LOG
182if [ ! -w ${SUPERBIB_LOG} ]
183then
184 echo " eee : ${SUPERBIB_LOG} not writable"
185 # nb : no exit because this file shouldreachable be launched by login process
186fi
187#
188EDITOR=vi
189export EDITOR
190#
191# io directories
192SUPERBIB_ID=${indir}
193export SUPERBIB_ID
194if [ ! -d ${SUPERBIB_ID} ] 
195then
196  mkdir -p ${SUPERBIB_ID}
197  echo "${command} : iii : creation of \${SUPERBIB_ID}"
198fi 
199# check for permission on SUPERBIB_ID
200if [ ! -x ${SUPERBIB_ID} ]
201then
202 echo " eee : ${SUPERBIB_ID} not reachable"
203 # nb : no exit because this file should be launched by login process
204fi
205#
206SUPERBIB_OD=${outdir}
207export SUPERBIB_OD
208if [ ! -d ${SUPERBIB_OD} ]
209then
210  mkdir -p ${SUPERBIB_OD}
211  echo "${command} : iii : creation of \${SUPERBIB_OD}"
212fi
213# check for permission on SUPERBIB_OD
214if [ ! -x ${SUPERBIB_OD} ]
215then
216 echo " eee : ${SUPERBIB_OD} not reachable"
217 # nb : no exit because this file should be launched by login process
218fi
219if [ ! -w ${SUPERBIB_OD} ]
220then
221 echo " eee : ${SUPERBIB_OD} not writable"
222 # nb : no exit because this file should be launched by login process
223fi
224#
225# end
226# nb : no exit because this file should be launched by login process
Note: See TracBrowser for help on using the repository browser.