Ignore:
Timestamp:
03/16/14 21:15:57 (10 years ago)
Author:
pinsard
Message:

fix thanks to coding rules; utf8

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/project_profile.sh

    r13 r14  
    104104# ++ besoin de posix 
    105105# 
    106 # ++ pas de MANPATH defini par défaut sur cratos et cerbere 
     106# ++ pas de MANPATH defini par défaut sur cratos et cerbere 
    107107# 
    108108# EVOLUTIONS 
     
    140140usage=" Usage : ${command} -d directory -i indir -o outdir -t tempdir -s saxo_dir" 
    141141# 
    142 while [ ${#} -gt 0 ] 
    143 do 
    144     case ${1} in 
    145         -d) 
    146             # directory for application choosen by user 
    147             # (see svn checkout command used) 
    148             directory=${2} 
    149             shift 
    150         ;; 
    151         -i) 
    152             # directory for inputs choosen by user 
    153             indir=${2} 
    154             shift 
    155         ;; 
    156         -o) 
    157             # directory for outputs choosen by user 
    158             outdir=${2} 
    159             shift 
    160         ;; 
    161         -t) 
    162             # directory for temporary outputs choosen by user 
    163             tempdir=${2} 
    164             shift 
    165         ;; 
    166         -s) 
    167             saxo_dir=${2} 
    168             shift 
    169         ;; 
    170         *) 
    171             # other choice 
    172             echo "eee : unknown option ${1}" 
    173             echo "${usage}" 
    174             # nb : no exit because this file should be launched 
    175             # by login process 
    176         ;; 
    177     esac 
    178     # next flag 
    179     shift 
    180 done 
    181 unset usage 
    182 # 
    183 # check for ${directory} 
    184 if [ ! -d ${directory} ] 
     142pb=0 
     143# 
     144minargcount=10 
     145maxargcount=10 
     146narg=${#} 
     147# 
     148if [ ${narg} -lt ${minargcount} ] 
    185149then 
    186     echo " eee : ${directory} not found" 
     150    echo "eee : not enought arguments (${narg} vs ${minargcount})" 
     151    echo "${usage}" 
    187152    # nb : no exit because this file should be launched by login process 
     153    pb=1 
    188154fi 
    189 # 
    190 # check for permission on directory 
    191 if [ ! -x ${directory} ] 
     155unset minargcount 
     156# 
     157if [ ${narg} -gt ${maxargcount} ] 
    192158then 
    193     echo " eee : ${directory} not reachable" 
     159    echo "eee : too many arguments (${narg} vs ${maxargcount})" 
     160    echo "${usage}" 
    194161    # nb : no exit because this file should be launched by login process 
     162    pb=1 
    195163fi 
    196 # 
    197 PROJECT=${directory} 
    198 export PROJECT 
    199 unset drectory 
    200 # 
    201 # add PROJECT tools to PATH 
    202 # if not already done 
    203 suppath=$(echo ${PROJECT}/src | tr -s "/") 
    204 echo ${PATH} | grep -q "${suppath}:" 
    205 test_path=${?} 
    206 if [ ${test_path} -ne 0 ] 
     164unset maxargcount 
     165unset narg 
     166# 
     167if [ ${pb} -eq 0 ] 
    207168then 
    208     PATH=${suppath}:${PATH} 
    209     export PATH 
    210 else 
    211     # option bavarde oui/non pas encore implantée ++ 
    212     echo "${command} : iii : ${suppath} already in \${PATH}" 
     169    while [ ${#} -gt 0 ] 
     170    do 
     171        case ${1} in 
     172            -d) 
     173                # directory for application choosen by user 
     174                # (see svn checkout command used) 
     175                directory=${2} 
     176                shift 
     177            ;; 
     178            -i) 
     179                # directory for inputs choosen by user 
     180                indir=${2} 
     181                shift 
     182            ;; 
     183            -o) 
     184                # directory for outputs choosen by user 
     185                outdir=${2} 
     186                shift 
     187            ;; 
     188            -t) 
     189                # directory for temporary outputs choosen by user 
     190                tempdir=${2} 
     191                shift 
     192            ;; 
     193            -s) 
     194                saxo_dir=${2} 
     195                shift 
     196            ;; 
     197            *) 
     198                # other choice 
     199                echo "eee : unknown option ${1}" 
     200                echo "${usage}" 
     201                # nb : no exit because this file should be launched 
     202                # by login process 
     203            ;; 
     204        esac 
     205        # next flag 
     206        shift 
     207    done 
     208    unset usage 
    213209fi 
    214 unset test_path 
    215 # 
    216 # add PROJECT manuals to MANPATH 
    217 # if not already done 
    218 suppath=$(echo ${PROJECT}/doc/man | tr -s "/") 
    219 echo ${MANPATH} | grep -q "${suppath}:" 
    220 test_manpath=${?} 
    221 if [ ${test_manpath} -ne 0 ] 
     210# 
     211if [ ${pb} -eq 0 ] 
    222212then 
    223     MANPATH=${suppath}:${MANPATH} 
    224     export MANPATH 
    225 else 
    226     # option bavarde oui/non pas encore implantée ++ 
    227     echo "${command} : iii : ${suppath} already in \${MANPATH}" 
     213    # check for ${directory} 
     214    if [ ! -d ${directory} ] 
     215    then 
     216        echo " eee : ${directory} not found" 
     217        # nb : no exit because this file should be launched by login process 
     218    fi 
     219    # 
     220    # check for permission on directory 
     221    if [ ! -x ${directory} ] 
     222    then 
     223        echo " eee : ${directory} not reachable" 
     224        # nb : no exit because this file should be launched by login process 
     225    fi 
     226    # 
     227    PROJECT=${directory} 
     228    export PROJECT 
     229    unset directory 
     230    # 
     231    # add PROJECT tools to PATH 
     232    # if not already done 
     233    suppath=$(echo ${PROJECT}/src | tr -s "/") 
     234    echo ${PATH} | grep -q "${suppath}:" 
     235    test_path=${?} 
     236    if [ ${test_path} -ne 0 ] 
     237    then 
     238        PATH=${suppath}:${PATH} 
     239        export PATH 
     240    else 
     241        # option bavarde oui/non pas encore implantée ++ 
     242        echo "${command} : iii : ${suppath} already in \${PATH}" 
     243    fi 
     244    unset test_path 
     245    # 
     246    # add PROJECT manuals to MANPATH 
     247    # if not already done 
     248    suppath=$(echo ${PROJECT}/doc/man | tr -s "/") 
     249    echo ${MANPATH} | grep -q "${suppath}:" 
     250    test_manpath=${?} 
     251    if [ ${test_manpath} -ne 0 ] 
     252    then 
     253        MANPATH=${suppath}:${MANPATH} 
     254        export MANPATH 
     255    else 
     256        # option bavarde oui/non pas encore implantée ++ 
     257        echo "${command} : iii : ${suppath} already in \${MANPATH}" 
     258    fi 
     259    unset test_manpath 
     260    unset suppath 
     261    # 
     262    PROJECT_LOG=${tempdir} 
     263    export PROJECT_LOG 
     264    unset tempdir 
     265    if [ ! -d ${PROJECT_LOG} ] 
     266    then 
     267        mkdir -p ${PROJECT_LOG} 
     268        status=${?} 
     269        if [ ${status} -ne 0 ] 
     270        then 
     271            echo "${command} : eee : can not create \${POMME_LOG}" 
     272            # nb : no exit because this file should be launched by login process 
     273        else 
     274            echo "${command} : iii : creation of \${PROJECT_LOG}" 
     275        fi 
     276        unset status 
     277    fi 
     278    # check for permission on PROJECT_LOG 
     279    if [ ! -x ${PROJECT_LOG} ] 
     280    then 
     281        echo " eee : ${PROJECT_LOG} not reachable" 
     282        # nb : no exit because this file should be launched by login process 
     283    fi 
     284    # 
     285    # check for permission on PROJECT_LOG 
     286    if [ ! -w ${PROJECT_LOG} ] 
     287    then 
     288        echo " eee : ${PROJECT_LOG} not writable" 
     289        # nb : no exit because this file should reachable be launched 
     290        # by login process 
     291    fi 
     292    # 
     293    EDITOR=vi 
     294    export EDITOR 
     295    # 
     296    # io directories 
     297    PROJECT_ID=${indir} 
     298    export PROJECT_ID 
     299    unset indir 
     300    if [ ! -d ${PROJECT_ID} ] 
     301    then 
     302        mkdir -p ${PROJECT_ID} 
     303        echo "${command} : iii : creation of \${PROJECT_ID}" 
     304    fi 
     305    # check for permission on PROJECT_ID 
     306    if [ ! -x ${PROJECT_ID} ] 
     307    then 
     308        echo " eee : ${PROJECT_ID} not reachable" 
     309        # nb : no exit because this file should be launched by login process 
     310    fi 
     311    # 
     312    PROJECT_OD=${outdir} 
     313    export PROJECT_OD 
     314    unset outdir 
     315    if [ ! -d ${PROJECT_OD} ] 
     316    then 
     317        mkdir -p ${PROJECT_OD} 
     318        echo "${command} : iii : creation of \${PROJECT_OD}" 
     319    fi 
     320    # check for permission on PROJECT_OD 
     321    if [ ! -x ${PROJECT_OD} ] 
     322    then 
     323        echo " eee : ${PROJECT_OD} not reachable" 
     324        # nb : no exit because this file should be launched by login process 
     325    fi 
     326    if [ ! -w ${PROJECT_OD} ] 
     327    then 
     328        echo " eee : ${PROJECT_OD} not writable" 
     329        # nb : no exit because this file should be launched by login process 
     330    fi 
     331    # 
     332    SAXO_DIR=${saxo_dir} 
     333    export SAXO_DIR 
     334    # 
     335    # IDL startup 
     336    IDL_STARTUP=${PROJECT}/src/project_init.pro 
     337    export IDL_STARTUP 
    228338fi 
    229 unset test_manpath 
    230 unset suppath 
    231 # 
    232 PROJECT_LOG=${tempdir} 
    233 export PROJECT_LOG 
    234 unset tempdir 
    235 if [ ! -d ${PROJECT_LOG} ] 
    236 then 
    237     mkdir -p ${PROJECT_LOG} 
    238     status=${?} 
    239     if [ ${status} -ne 0 ] 
    240     then 
    241         echo "${command} : eee : can not create \${POMME_LOG}" 
    242         # nb : no exit because this file should be launched by login process 
    243     else 
    244         echo "${command} : iii : creation of \${PROJECT_LOG}" 
    245     fi 
    246     unset status 
    247 fi 
    248 # check for permission on PROJECT_LOG 
    249 if [ ! -x ${PROJECT_LOG} ] 
    250 then 
    251     echo " eee : ${PROJECT_LOG} not reachable" 
    252     # nb : no exit because this file should be launched by login process 
    253 fi 
    254 # 
    255 # check for permission on PROJECT_LOG 
    256 if [ ! -w ${PROJECT_LOG} ] 
    257 then 
    258     echo " eee : ${PROJECT_LOG} not writable" 
    259     # nb : no exit because this file should reachable be launched 
    260     # by login process 
    261 fi 
    262 # 
    263 EDITOR=vi 
    264 export EDITOR 
    265 # 
    266 # io directories 
    267 PROJECT_ID=${indir} 
    268 export PROJECT_ID 
    269 unset indir 
    270 if [ ! -d ${PROJECT_ID} ] 
    271 then 
    272     mkdir -p ${PROJECT_ID} 
    273     echo "${command} : iii : creation of \${PROJECT_ID}" 
    274 fi 
    275 # check for permission on PROJECT_ID 
    276 if [ ! -x ${PROJECT_ID} ] 
    277 then 
    278     echo " eee : ${PROJECT_ID} not reachable" 
    279     # nb : no exit because this file should be launched by login process 
    280 fi 
    281 # 
    282 PROJECT_OD=${outdir} 
    283 export PROJECT_OD 
    284 unset outdir 
    285 if [ ! -d ${PROJECT_OD} ] 
    286 then 
    287     mkdir -p ${PROJECT_OD} 
    288     echo "${command} : iii : creation of \${PROJECT_OD}" 
    289 fi 
    290 # check for permission on PROJECT_OD 
    291 if [ ! -x ${PROJECT_OD} ] 
    292 then 
    293     echo " eee : ${PROJECT_OD} not reachable" 
    294     # nb : no exit because this file should be launched by login process 
    295 fi 
    296 if [ ! -w ${PROJECT_OD} ] 
    297 then 
    298     echo " eee : ${PROJECT_OD} not writable" 
    299     # nb : no exit because this file should be launched by login process 
    300 fi 
    301 # 
    302 SAXO_DIR=${saxo_dir} 
    303 export SAXO_DIR 
    304 # 
    305 # IDL startup 
    306 IDL_STARTUP=${PROJECT}/src/project_init.pro 
    307 export IDL_STARTUP 
     339unset pb 
    308340# end 
    309341unset command 
Note: See TracChangeset for help on using the changeset viewer.