Ignore:
Timestamp:
02/04/14 14:41:26 (10 years ago)
Author:
pinsard
Message:

fix thanks to coding rules + update doc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/project_profile.sh

    r10 r12  
    1313# ======== 
    1414# 
    15 # Online usage:: 
    16 # 
    17 #  $ . ./project_profile.sh -d directory -i indir -o outdir -t tempdir -s saxo_dir 
    18 # 
    19 # In ${HOME}/.profile, add the following line:: 
    20 # 
    21 #  . project_profile.sh -d directory  -i indir -o outdir -t tempdir -s saxo_dir 
     15# Online usage: 
     16# 
     17# .. code-block:: bash 
     18# 
     19#    . ./project_profile.sh -d directory -i indir -o outdir -t tempdir -s saxo_dir 
     20# 
     21# In ${HOME}/.profile, add the following line: 
     22# 
     23# .. code-block:: bash 
     24# 
     25#    . project_profile.sh -d directory -i indir -o outdir -t tempdir -s saxo_dir 
    2226# 
    2327# DESCRIPTION 
     
    5559# ======== 
    5660# 
    57 # For fplod, on aedon.locean-ipsl.upmc.fr:: 
    58 # 
    59 #  $ cd /usr/home/fplod/incas/pomme/pomme_ws/ 
    60 #  $ . ./src/project_profile.sh \ 
     61# For fplod, on aedon.locean-ipsl.upmc.fr: 
     62# 
     63# .. code-block:: bash 
     64# 
     65#    cd /usr/home/fplod/incas/pomme/pomme_ws/ 
     66#    . ./src/project_profile.sh \ 
    6167#    -d $(pwd) \ 
    6268#    -i /usr/temp/${LOGNAME}/pomme_d/ \ 
     
    6571#    -s /usr/home/fplod/SAXO_DIR/ 
    6672# 
    67 # For fplod on cratos.locean-ipsl.umpc.fr:: 
    68 # 
    69 #  $ cd ${HOME}/incas/pomme/pomme_ws/ 
    70 #  $ . ./src/project_profile.sh \ 
     73# For fplod on cratos.locean-ipsl.umpc.fr: 
     74# 
     75# .. code-block:: bash 
     76# 
     77#    cd ${HOME}/incas/pomme/pomme_ws/ 
     78#    . ./src/project_profile.sh \ 
    7179#    -d $(pwd) \ 
    7280#    -i /usr/temp/${LOGNAME}/pomme_d/ \ 
     
    7583#    -s ${HOME}/SAXO_DIR/ 
    7684# 
    77 # For pinsard on camelot.ipsl.polytechnique.fr or merlin15-c.climserv:: 
    78 # 
    79 #  $ cd ${HOME}/pomme/ 
    80 #  $ . ./src/project_profile.sh \ 
    81 #   -d $(pwd) \ 
    82 #   -i /homedata/${LOGNAME}/pomme_d/ \ 
    83 #   -o /homedata/${LOGNAME}/pomme_d/ \ 
    84 #   -t /homedata/${LOGNAME}/log/ \ 
    85 #   -s ${HOME}/SAXO_DIR/ 
     85# For pinsard on camelot.ipsl.polytechnique.fr or merlin15-c.climserv: 
     86# 
     87# .. code-block:: bash 
     88# 
     89#    cd ${HOME}/pomme/ 
     90#    . ./src/project_profile.sh \ 
     91#    -d $(pwd) \ 
     92#    -i /homedata/${LOGNAME}/pomme_d/ \ 
     93#    -o /homedata/${LOGNAME}/pomme_d/ \ 
     94#    -t /homedata/${LOGNAME}/log/ \ 
     95#    -s ${HOME}/SAXO_DIR/ 
    8696# 
    8797# TODO 
     
    94104# ++ besoin de posix 
    95105# 
    96 # ++ pas de MANPATH defini par défaut sur cratos  et cerbere 
     106# ++ pas de MANPATH defini par défaut sur cratos et cerbere 
    97107# 
    98108# EVOLUTIONS 
     
    101111# - fplod 20110426T151058Z cratos.locean-ipsl.upmc.fr (Linux) 
    102112# 
    103 #   * add IDL and  SAXO env. 
     113#   * add IDL and SAXO env. 
    104114#   * replace POMME by PROJECT 
    105115#   * replace zeus by cratos 
     
    112122system=$(uname) 
    113123case "${system}" in 
    114    AIX|IRIX64) 
    115       echo " www : no specific posix checking" 
    116    ;; 
    117    *) 
    118       set -o posix 
    119    ;; 
     124    AIX|IRIX64) 
     125        echo " www : no specific posix checking" 
     126    ;; 
     127    *) 
     128        set -o posix 
     129    ;; 
    120130esac 
    121131unset system 
     
    132142while [ ${#} -gt 0 ] 
    133143do 
    134    case ${1} in 
    135       -d) 
    136          # directory for application choosen by user (see svn checkout command used) 
    137          directory=${2} 
    138          shift 
    139       ;; 
    140       -i) 
    141          # directory for inputs choosen by user 
    142          indir=${2} 
    143          shift 
    144       ;; 
    145       -o) 
    146          # directory for outputs choosen by user 
    147          outdir=${2} 
    148          shift 
    149       ;; 
    150       -t) 
    151          # directory for temporary outputs choosen by user 
    152          tempdir=${2} 
    153          shift 
    154       ;; 
    155       -s) 
    156          saxo_dir=${2} 
    157          shift 
    158       ;; 
    159       *) 
    160          # other choice 
    161          echo "eee : unknown option ${1}" 
    162          echo "${usage}" 
    163          # nb : no exit because this file should be launched by login process 
    164       ;; 
    165    esac 
    166    # next flag 
    167    shift 
     144    case ${1} in 
     145        -d) 
     146            # directory for application choosen by user (see svn checkout command used) 
     147            directory=${2} 
     148            shift 
     149        ;; 
     150        -i) 
     151            # directory for inputs choosen by user 
     152            indir=${2} 
     153            shift 
     154        ;; 
     155        -o) 
     156            # directory for outputs choosen by user 
     157            outdir=${2} 
     158            shift 
     159        ;; 
     160        -t) 
     161            # directory for temporary outputs choosen by user 
     162            tempdir=${2} 
     163            shift 
     164        ;; 
     165        -s) 
     166            saxo_dir=${2} 
     167            shift 
     168        ;; 
     169        *) 
     170            # other choice 
     171            echo "eee : unknown option ${1}" 
     172            echo "${usage}" 
     173            # nb : no exit because this file should be launched by login process 
     174        ;; 
     175    esac 
     176    # next flag 
     177    shift 
    168178done 
    169179unset usage 
     
    172182if [ ! -d ${directory} ] 
    173183then 
    174    echo " eee : ${directory} not found" 
    175    # nb : no exit because this file should be launched by login process 
     184    echo " eee : ${directory} not found" 
     185    # nb : no exit because this file should be launched by login process 
    176186fi 
    177187# 
     
    179189if [ ! -x ${directory} ] 
    180190then 
    181    echo " eee : ${directory} not reachable" 
    182    # nb : no exit because this file should be launched by login process 
     191    echo " eee : ${directory} not reachable" 
     192    # nb : no exit because this file should be launched by login process 
    183193fi 
    184194# 
     
    194204if [ ${test_path} -ne 0 ] 
    195205then 
    196    PATH=${suppath}:${PATH} 
    197    export PATH 
     206    PATH=${suppath}:${PATH} 
     207    export PATH 
    198208else 
    199    # option bavarde oui/non pas encore implantée ++ 
    200    echo "${command} : iii : ${suppath} already in \${PATH}" 
     209    # option bavarde oui/non pas encore implantée ++ 
     210    echo "${command} : iii : ${suppath} already in \${PATH}" 
    201211fi 
    202212unset test_path 
     
    209219if [ ${test_manpath} -ne 0 ] 
    210220then 
    211    MANPATH=${suppath}:${MANPATH} 
    212    export MANPATH 
     221    MANPATH=${suppath}:${MANPATH} 
     222    export MANPATH 
    213223else 
    214    # option bavarde oui/non pas encore implantée ++ 
    215    echo "${command} : iii : ${suppath} already in \${MANPATH}" 
     224    # option bavarde oui/non pas encore implantée ++ 
     225    echo "${command} : iii : ${suppath} already in \${MANPATH}" 
    216226fi 
    217227unset test_manpath 
     
    223233if [ ! -d ${PROJECT_LOG} ] 
    224234then 
    225    mkdir -p ${PROJECT_LOG} 
    226    status=${?} 
    227    if [ ${status} -ne 0 ] 
    228    then 
    229       echo "${command} : eee : can not create \${POMME_LOG}" 
    230       # nb : no exit because this file should be launched by login process 
    231    else 
    232       echo "${command} : iii : creation of \${PROJECT_LOG}" 
    233    fi 
    234    unset status 
     235    mkdir -p ${PROJECT_LOG} 
     236    status=${?} 
     237    if [ ${status} -ne 0 ] 
     238    then 
     239        echo "${command} : eee : can not create \${POMME_LOG}" 
     240        # nb : no exit because this file should be launched by login process 
     241    else 
     242        echo "${command} : iii : creation of \${PROJECT_LOG}" 
     243    fi 
     244    unset status 
    235245fi 
    236246# check for permission on PROJECT_LOG 
    237247if [ ! -x ${PROJECT_LOG} ] 
    238248then 
    239    echo " eee : ${PROJECT_LOG} not reachable" 
    240    # nb : no exit because this file should be launched by login process 
     249    echo " eee : ${PROJECT_LOG} not reachable" 
     250    # nb : no exit because this file should be launched by login process 
    241251fi 
    242252# 
     
    244254if [ ! -w ${PROJECT_LOG} ] 
    245255then 
    246    echo " eee : ${PROJECT_LOG} not writable" 
    247    # nb : no exit because this file shouldreachable be launched by login process 
     256    echo " eee : ${PROJECT_LOG} not writable" 
     257    # nb : no exit because this file shouldreachable be launched by login process 
    248258fi 
    249259# 
     
    257267if [ ! -d ${PROJECT_ID} ] 
    258268then 
    259    mkdir -p ${PROJECT_ID} 
    260    echo "${command} : iii : creation of \${PROJECT_ID}" 
     269    mkdir -p ${PROJECT_ID} 
     270    echo "${command} : iii : creation of \${PROJECT_ID}" 
    261271fi 
    262272# check for permission on PROJECT_ID 
    263273if [ ! -x ${PROJECT_ID} ] 
    264274then 
    265    echo " eee : ${PROJECT_ID} not reachable" 
    266    # nb : no exit because this file should be launched by login process 
     275    echo " eee : ${PROJECT_ID} not reachable" 
     276    # nb : no exit because this file should be launched by login process 
    267277fi 
    268278# 
     
    278288if [ ! -x ${PROJECT_OD} ] 
    279289then 
    280    echo " eee : ${PROJECT_OD} not reachable" 
    281    # nb : no exit because this file should be launched by login process 
     290    echo " eee : ${PROJECT_OD} not reachable" 
     291    # nb : no exit because this file should be launched by login process 
    282292fi 
    283293if [ ! -w ${PROJECT_OD} ] 
    284294then 
    285    echo " eee : ${PROJECT_OD} not writable" 
    286    # nb : no exit because this file should be launched by login process 
     295    echo " eee : ${PROJECT_OD} not writable" 
     296    # nb : no exit because this file should be launched by login process 
    287297fi 
    288298# 
Note: See TracChangeset for help on using the changeset viewer.