source: trunk/superbib_profile.sh @ 95

Last change on this file since 95 was 95, checked in by pinsard, 14 years ago

add rest2web for manuals production (and start sphinx but not yet ok)

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