#! /bin/sh #+ # # .. program:: tropflux_profile.sh # # .. _tropflux_profile.sh: # # ================================================== # tropflux_profile.sh -- define TROPFLUX environment # ================================================== # # SYNOPSIS # ======== # # Online usage:: # # $ . ./tropflux_profile.sh -d directory -i indir -o outdir -t tempdir # # In ${HOME}/.profile, add the following line:: # # . tropflux_profile.sh -d directory -i indir -o outdir -t tempdir # # DESCRIPTION # =========== # # .. option:: -d # .. option:: -i # .. option:: -o # .. option:: -t # # define TROPFLUX environment # # ${TROPFLUX} is the base directory of tools. # # ${TROPFLUX_LOG} is the directory where log files will be written. # # ${TROPFLUX_ID} is the directory where input files must be. # # ${TROPFLUX_OD} is the directory where output files will be written. # # PATH is completed with ${TROPFLUX}. # # SEE ALSO # ======== # # for IDL/GDL environment : # # :ref:`tropflux_startup.pro` # # EXAMPLES # ======== # # For fplod, on aedon.locean-ipsl.upmc.fr:: # # $ cd /usr/home/fplod/incas/tropflux/tropflux_ws/ # $ . ./src/tropflux_profile.sh \ # -d $(pwd) \ # -i /usr/temp/${LOGNAME}/tropflux_d/ \ # -o /usr/temp/${LOGNAME}/tropflux_d/ \ # -t /usr/temp/${LOGNAME}/log/ # # For fplod on zeus.locean-ipsl.umpc.fr:: # # $ cd ${HOME}/incas/tropflux/tropflux_ws/ # $ . ./src/tropflux_profile.sh \ # -d $(pwd) \ # -i /usr/temp/${LOGNAME}/tropflux_d/ \ # -o /usr/temp/${LOGNAME}/tropflux_d/ \ # -t /usr/temp/${LOGNAME}/log/ # # For pinsard on camelot.ipsl.polytechnique.fr or merlin15-c.climserv:: # # $ cd ${HOME}/tropflux/ # $ . ./src/tropflux_profile.sh \ # -d $(pwd) \ # -i /homedata/${LOGNAME}/tropflux_d/ \ # -o /homedata/${LOGNAME}/tropflux_d/ \ # -t /homedata/${LOGNAME}/log/ # # TODO # ==== # # ++ option bavarde # # ++ machine dependant # # ++ besoin de posix # # ++ pas de MANPATH defini par défaut sur zeus et cerbere # # define IDL startup file # # EVOLUTIONS # ========== # # - fplod 20101118T171653Z aedon.locean-ipsl.upmc.fr (Darwin) # # * creation # #- system=$(uname) case "${system}" in AIX|IRIX64) echo " www : no specific posix checking" ;; *) set -o posix ;; esac unset system # LANG=C # # as this script might be launch in .profile, command is forced. command=tropflux_profile.sh # usage=" Usage : ${command} -d directory -i indir -o outdir -t tempdir" # set +u while [ ! -z "${1}" ] do case ${1} in -d) # directory for application choosen by user (see svn checkout command used) directory=${2} shift ;; -i) # directory for inputs choosen by user indir=${2} shift ;; -o) # directory for outputs choosen by user outdir=${2} shift ;; -t) # directory for temporary outputs choosen by user tempdir=${2} shift ;; *) # other choice echo "eee : unknown option ${1}" echo "${usage}" # nb : no exit because this file should be launched by login process ;; esac # next flag shift done unset usage # # check for ${directory} if [ ! -d ${directory} ] then echo " eee : ${directory} not found" # nb : no exit because this file should be launched by login process fi # # check for permission on directory if [ ! -x ${directory} ] then echo " eee : ${directory} not reachable" # nb : no exit because this file should be launched by login process fi # TROPFLUX=${directory} export TROPFLUX unset drectory # # add TROPFLUX tools to PATH # if not already done suppath=$(echo ${TROPFLUX}/src | tr -s "/") echo ${PATH} | grep -q "${suppath}:" test_path=${?} if [ ${test_path} -ne 0 ] then PATH=${suppath}:${PATH} export PATH else # option bavarde oui/non pas encore implantée ++ echo "${command} : iii : ${suppath} already in \${PATH}" fi unset test_path # # add TROPFLUX manuals to MANPATH # if not already done suppath=$(echo ${TROPFLUX}/doc/man | tr -s "/") echo ${MANPATH} | grep -q "${suppath}:" test_manpath=${?} if [ ${test_manpath} -ne 0 ] then MANPATH=${suppath}:${MANPATH} export MANPATH else # option bavarde oui/non pas encore implantée ++ echo "${command} : iii : ${suppath} already in \${MANPATH}" fi unset test_manpath unset suppath # TROPFLUX_LOG=${tempdir} export TROPFLUX_LOG unset tempdir if [ ! -d ${TROPFLUX_LOG} ] then mkdir -p ${TROPFLUX_LOG} status=${?} if [ ${status} -ne 0 ] then echo "${command} : eee : can not create \${TROPFLUX_LOG}" # nb : no exit because this file should be launched by login process else echo "${command} : iii : creation of \${TROPFLUX_LOG}" fi unset status fi # check for permission on TROPFLUX_LOG if [ ! -x ${TROPFLUX_LOG} ] then echo " eee : ${TROPFLUX_LOG} not reachable" # nb : no exit because this file should be launched by login process fi # # check for permission on TROPFLUX_LOG if [ ! -w ${TROPFLUX_LOG} ] then echo " eee : ${TROPFLUX_LOG} not writable" # nb : no exit because this file shouldreachable be launched by login process fi # EDITOR=vi export EDITOR # # io directories TROPFLUX_ID=${indir} export TROPFLUX_ID unset indir if [ ! -d ${TROPFLUX_ID} ] then mkdir -p ${TROPFLUX_ID} echo "${command} : iii : creation of \${TROPFLUX_ID}" fi # check for permission on TROPFLUX_ID if [ ! -x ${TROPFLUX_ID} ] then echo " eee : ${TROPFLUX_ID} not reachable" # nb : no exit because this file should be launched by login process fi # TROPFLUX_OD=${outdir} export TROPFLUX_OD unset outdir if [ ! -d ${TROPFLUX_OD} ] then mkdir -p ${TROPFLUX_OD} echo "${command} : iii : creation of \${TROPFLUX_OD}" fi # check for permission on TROPFLUX_OD if [ ! -x ${TROPFLUX_OD} ] then echo " eee : ${TROPFLUX_OD} not reachable" # nb : no exit because this file should be launched by login process fi if [ ! -w ${TROPFLUX_OD} ] then echo " eee : ${TROPFLUX_OD} not writable" # nb : no exit because this file should be launched by login process fi # # end unset command # nb : no exit because this file should be launched by login process