source: trunk/superbib_profile.sh @ 82

Last change on this file since 82 was 82, checked in by pinsard, 16 years ago

add superbib_profile.sh (not yet for end users)

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