From 73ecffd9d57163550a89c08639ff92eb9de0094a Mon Sep 17 00:00:00 2001 From: thomasl Date: Tue, 18 Nov 2014 17:00:00 +0000 Subject: [PATCH] fix set_openair() function to be correct from any launching directory git-svn-id: http://svn.eurecom.fr/openair4G/trunk@6034 818b1a75-f10b-46b9-bf7c-635c3b92a50f --- targets/build_helper.bash | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/targets/build_helper.bash b/targets/build_helper.bash index a46439af10..fe9d9c83b5 100755 --- a/targets/build_helper.bash +++ b/targets/build_helper.bash @@ -872,18 +872,19 @@ create_hss_database(){ ############################### set_openair_env(){ - index=`pwd | grep -b -o /targets | cut -d: -f1` - if [ $index = "" ] ; then - echo_error "Please run the script from targets directory or any child directories" - else - oai_path=`pwd | cut -c1-$index` - export OPENAIR_HOME=$oai_path - export OPENAIR1_DIR=$oai_path/openair1 - export OPENAIR2_DIR=$oai_path/openair2 - export OPENAIR3_DIR=$oai_path/openair3 - export OPENAIR_TARGETS=$oai_path/targets - export OPENAIRCN_DIR=$oai_path/openair-cn - fi + fullpath=`readlink -f $BASH_SOURCE` + [ -f "/.$fullpath" ] || fullpath=`readlink -f $PWD/$fullpath` + openair_path=${fullpath%/targets/*} + openair_path=${openair_path%/openair-cn/*} + openair_path=${openair_path%/openair[123]/*} + + export OPENAIR_DIR=$openair_path + export OPENAIR_HOME=$openair_path + export OPENAIR1_DIR=$openair_path/openair1 + export OPENAIR2_DIR=$openair_path/openair2 + export OPENAIR3_DIR=$openair_path/openair3 + export OPENAIRCN_DIR=$openair_path/openair-cn + export OPENAIR_TARGETS=$openair_path/targets }