#! /bin/sh #+ # # .. program:: project_profile.sh # # =================== # project_profile.sh # =================== # # # SYNOPSIS # ======== # # Online usage :: # # $ . ./project_profile.sh -d directory -i indir -o outdir -t tempdir # # In :file:`${HOME}/.profile`, add the following line :: # # . project_profile.sh -d directory -i indir -o outdir -t tempdir # # DESCRIPTION # =========== # # .. option:: -d # .. option:: -i # .. option:: -o # .. option:: -t # .. option:: -jv jabref version # .. option:: -j jabref dir # # define SUPERBIB environment # # ${PROJECT} is the base directory of tools. # # ${PROJECT_LOG} is the directory where log files will be written. # # ${PROJECT_ID} is the directory where input files must be. # # ${PROJECT_OD} is the directory where output files will be written. # # MANPATH++ # # EXAMPLES # ======== # # For fplod, on cratos.locean-ipsl.upmc.fr:: # # cd /usr/home/fplod/src/superbib/superbib_ws/ # SUPERBIB=${HOME}/superbib_ws/ # export SUPERBIB # . ${SUPERBIB}/project_profile.sh \ # -d ${SUPERBIB} \ # -i /usr/temp/${LOGNAME}/superbib_d/ \ # -o /usr/temp/${LOGNAME}/superbib_d/ \ # -t /usr/temp/${LOGNAME}/log/ \ # -jv 2.6 \ # -j /usr/home/incas/francoise/jabref-2.6_cratos/ # -b ++ # # TODO # ==== # # ++ option bavarde # # ++ machine dependant # # ++ pas de MANPATH defini par defaut sur zeus # # reintegration de bibliolocean dans trunk ou projet bibliolocean a part # # doc sur jabref dir bibtool # # EVOLUTIONS # ========== # # $Id$ # # $URL$ # # - fplod 20130418T110932Z cratos.locean-ipsl.upmc.fr (Linux) # # * add PYTHONPATH (seems to be need be sphinx-apidoc + sphinx-build) # # - fplod 20120629T120311Z cratos (Linux) # # * path with branches/bibliolocean/src # # - fplod 20120405T085555Z cratos (Linux) # # * rename and replace SUPERBIB by PROJECT # # - fplod 20100426T094821Z aedon.locean-ipsl.upmc.fr (Darwin) # # * improve PATH and MANPATH modification # # - fplod 20100423T144248Z aedon.locean-ipsl.upmc.fr (Darwin) # # * add error handling on mkdir # # - fplod 2008-10-31T11:17:24Z aedon.locean-ipsl.upmc.fr (Darwin) # # * creation ++ pas encore en service # #- system=$(uname) case "${system}" in AIX|IRIX64) echo " www : no specific posix checking" ;; *) set -o posix ;; esac unset system # set -u # # as this script might be launch in .profile, command is forced. command=project_profile.sh # usage=" Usage : ${command} -d directory -i indir -o outdir -t tempdir -jv jabrefversion -j jabrefdir -b bibtooldir" # while [ ${#} -gt 0 ] 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 ;; -jv) jabrefversion=${2} shift ;; -j) jabrefdir=${2} shift ;; -b) bibtooldir=${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 # PROJECT=${directory} export PROJECT # # add PROJECT tools to PATH # if not already done suppath=$(echo ${PROJECT} | 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 unset suppath # suppath=$(echo ${PROJECT}/../branches/bibliolocean/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 PROJECT tools to PYTHONPATH # if not already done suppath=$(echo ${PROJECT}/aeres/scripts/ | tr -s "/") echo ${PYTHONPATH} | grep -q "${suppath}:" test_path=${?} if [ ${test_path} -ne 0 ] then PYTHONPATH=${suppath}:${PYTHONPATH} export PYTHONPATH else # option bavarde oui/non pas encore implantée ++ echo "${command} : iii : ${suppath} already in \${PYTHONPATH}" fi unset test_path unset suppath # # add PROJECT tools to PYTHONPATH # if not already done suppath=$(echo ${PROJECT}/| tr -s "/") echo ${PYTHONPATH} | grep -q "${suppath}:" test_path=${?} if [ ${test_path} -ne 0 ] then PYTHONPATH=${suppath}:${PYTHONPATH} export PYTHONPATH else # option bavarde oui/non pas encore implantée ++ echo "${command} : iii : ${suppath} already in \${PYTHONPATH}" fi unset test_path unset suppath # # add PROJECT manuals to MANPATH # if not already done suppath=$(echo ${PROJECT}/doc/manuals/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 # PROJECT_LOG=${tempdir} export PROJECT_LOG unset tempdir if [ ! -d ${PROJECT_LOG} ] then mkdir -p ${PROJECT_LOG} status=${?} if [ ${status} -ne 0 ] then echo "${command} : eee : can not create \${PROJECT_LOG}" # nb : no exit because this file should be launched by login process else echo "${command} : iii : creation of \${PROJECT_LOG}" fi unset status fi # check for permission on PROJECT_LOG if [ ! -x ${PROJECT_LOG} ] then echo " eee : ${PROJECT_LOG} not reachable" # nb : no exit because this file should be launched by login process fi # # check for permission on PROJECT_LOG if [ ! -w ${PROJECT_LOG} ] then echo " eee : ${PROJECT_LOG} not writable" # nb : no exit because this file shouldreachable be launched by login process fi # EDITOR=vi export EDITOR # # io directories PROJECT_ID=${indir} export PROJECT_ID unset indir if [ ! -d ${PROJECT_ID} ] then mkdir -p ${PROJECT_ID} echo "${command} : iii : creation of \${PROJECT_ID}" fi # check for permission on PROJECT_ID if [ ! -x ${PROJECT_ID} ] then echo " eee : ${PROJECT_ID} not reachable" # nb : no exit because this file should be launched by login process fi # PROJECT_OD=${outdir} export PROJECT_OD unset outdir if [ ! -d ${PROJECT_OD} ] then mkdir -p ${PROJECT_OD} echo "${command} : iii : creation of \${PROJECT_OD}" fi # check for permission on PROJECT_OD if [ ! -x ${PROJECT_OD} ] then echo " eee : ${PROJECT_OD} not reachable" # nb : no exit because this file should be launched by login process fi if [ ! -w ${PROJECT_OD} ] then echo " eee : ${PROJECT_OD} not writable" # nb : no exit because this file should be launched by login process fi # JABREF_DIR=${jabrefdir} export JABREF_DIR unset jabref_dir JABREF_VERSION=${jabrefversion} export JABREF_VERSION unset jabrefversion # BIBTOOL_DIR=${bibtooldir} export BIBTOOL_DIR unset bibtooldir PATH=${BIBTOOL_DIR}:${PATH} export PATH # # end unset command # nb : no exit because this file should be launched by login process