Automatically determine the additional version specification from the directory name of the installation

--HG--
branch : bgschaid/minorAdditionsBranch
This commit is contained in:
Bernhard F.W. Gschaider 2013-07-22 13:43:34 +02:00
parent a10196a180
commit 93e80e2c87
2 changed files with 55 additions and 1 deletions

View file

@ -43,6 +43,35 @@ unset prefSettingFile
export WM_PROJECT=OpenFOAM export WM_PROJECT=OpenFOAM
export WM_PROJECT_VERSION=1.6-ext export WM_PROJECT_VERSION=1.6-ext
if [ -z "$WM_PROJECT_VERSION_ADDITION" ]
then
fullScriptPath=`pwd`"/$0"
canonicalFullScriptPath="$(readlink 2>&1 -f $fullScriptPath)"
if [ $? != 0 ]
then
# System with simpler readlink (BSD, Darwin) try replacement
canonicalFullScriptPath="$(greadlink 2>&1 -f $fullScriptPath)"
if [ $? != 0 ]
then
# we give up
canonicalFullScriptPath=""
fi
fi
if [ -n "$canonicalFullScriptPath" ]
then
dirName="$(basename $(dirname $(dirname $canonicalFullScriptPath)))"
rest="$(echo $dirName | sed -e "s/OpenFOAM-$WM_PROJECT_VERSION//")"
if [ -n $rest ]
then
export WM_PROJECT_VERSION_ADDITION="$(echo $rest | sed -e "s/-//")"
fi
unset dirName rest
fi
unset fullScriptPath canonicalFullScriptPath
fi
if [ -n "$WM_PROJECT_VERSION_ADDITION" ] if [ -n "$WM_PROJECT_VERSION_ADDITION" ]
then then
export WM_PROJECT_VERSION=$WM_PROJECT_VERSION-$WM_PROJECT_VERSION_ADDITION export WM_PROJECT_VERSION=$WM_PROJECT_VERSION-$WM_PROJECT_VERSION_ADDITION

View file

@ -42,11 +42,36 @@ if ( -r $prefSettingFile ) then
# echo "Found presettings $prefSettingFile" # echo "Found presettings $prefSettingFile"
source $prefSettingFile source $prefSettingFile
endif endif
unset prefSettingFile,called
setenv WM_PROJECT OpenFOAM setenv WM_PROJECT OpenFOAM
setenv WM_PROJECT_VERSION 1.6-ext setenv WM_PROJECT_VERSION 1.6-ext
if( ! $?WM_PROJECT_VERSION_ADDITION ) then
set fullScriptPath = `pwd`"/$called[2]"
set canonicalFullScriptPath = `readlink -f $fullScriptPath |& cat`
if( $? != 0 ) then
# System with simpler readlink (BSD, Darwin) try replacement
set canonicalFullScriptPath=`greadlink -f $fullScriptPath |& cat`
if ( $? != 0 ) then
# we give up
set canonicalFullScriptPath=""
endif
endif
if ( "$canonicalFullScriptPath" != "" ) then
set pathHere=`dirname $canonicalFullScriptPath`
set pathHere=`dirname $pathHere`
set dirName=`basename $pathHere`
set rest=`echo $dirName | sed -e "s/OpenFOAM-$WM_PROJECT_VERSION//"`
if ( "$rest" != "" ) then
setenv WM_PROJECT_VERSION_ADDITION `echo $rest | sed -e "s/-//"`
endif
unset dirName pathHere rest
endif
unset fullScriptPath canonicalFullScriptPath
endif
unset prefSettingFile called
if ( $?WM_PROJECT_VERSION_ADDITION ) then if ( $?WM_PROJECT_VERSION_ADDITION ) then
setenv WM_PROJECT_VERSION $WM_PROJECT_VERSION-$WM_PROJECT_VERSION_ADDITION setenv WM_PROJECT_VERSION $WM_PROJECT_VERSION-$WM_PROJECT_VERSION_ADDITION
endif endif