now works in "sourcing" mode.

still have to worry about figuring out the lib/pathinfo details and setting LD_LIBRARY_PATH accordingly...
This commit is contained in:
Philip Eisenlohr 2012-11-06 15:40:45 +00:00
parent 5b6baa7c0d
commit e0dc2710b5
1 changed files with 16 additions and 31 deletions

View File

@ -1,31 +1,16 @@
#!/bin/bash # sets up an environment for DAMASK
# sets up an environment for DAMASK # usage: source damask_env.sh
# usage: source damask_env.sh
currentDir=${PWD}
# It would be nice to set the variables if [ "${BASH_SOURCE[0]:0:1}" = "/" ]
# depending on the location of the script then cd -P `dirname "${BASH_SOURCE[0]}"`
# /!\ CAREFUL WITH HARDLINKS else cd -P `dirname "${PWD}/${BASH_SOURCE[0]}"`
# but the ideas below don't work with sourcing this snippet. fi
# scriptloc = `dirname $0` theRoot=${PWD}
scriptloc=`dirname $(readlink -f $0)` cd $currentDir
#echo I am here: $scriptloc
#export DAMASK_ROOT=$scriptloc export DAMASK_ROOT=$theRoot
#export DAMASK_BIN=$scriptloc/bin export DAMASK_BIN=$theRoot/bin
[[ "${PATH}" == *"${DAMASK_BIN}"* ]] || export PATH=${PATH}:${DAMASK_BIN}
[[ "${PYTHONPATH}" == *"${DAMASK_ROOT}/lib"* ]] || export PYTHONPATH=${PYTHONPATH}:${DAMASK_ROOT}/lib
# Until the above works, we assume DAMASK #export LD_LIBRARY_PATH=${DAMASK_ROOT}/lib/fftw/lib:lib/acml4.4.0/ifort64_mp/lib:lib/acml4.4.0/ifort64/lib:${LD_LIBRARY_PATH}
# lives at the top of the user's home dir
# strip the username from "MPIE\"
me=`echo $USER |cut -d'\\' -f 2`
#echo user: $me
#export DAMASK_ROOT=`echo /nethome/$me/DAMASK`
#export DAMASK_BIN=`echo /nethome/$me/DAMASK/bin`
export DAMASK_ROOT=~/DAMASK
export DAMASK_BIN=~/DAMASK/bin
echo DAMASK_ROOT = $DAMASK_ROOT
echo DAMASK_BIN = $DAMASK_BIN
# set more variables depending on the above ones
export PATH=${PATH}:${DAMASK_BIN}
export PYTHONPATH=${PYTHONPATH}:${DAMASK_ROOT}/lib
export LD_LIBRARY_PATH=${DAMASK_ROOT}/lib/fftw/lib:lib/acml4.4.0/ifort64_mp/lib:lib/acml4.4.0/ifort64/lib:${LD_LIBRARY_PATH}