source: trunk/superbib_profile.sh @ 100

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

indent shell scripts

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