foamEtcFile: corrected locating of OpenFOAM installation

This commit is contained in:
Chris Greenshields
2022-07-05 15:19:12 +01:00
parent 2a2cc976c4
commit 80544ff43d

View File

@ -3,7 +3,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | Website: https://openfoam.org
# \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
# \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
@ -88,7 +88,7 @@ error() {
#-------------------------------------------------------------------------------
# the bin dir:
binDir="${0%/*}"
binDir="$(cd -- "$(dirname "$0")" >/dev/null 2>&1 || exit ; pwd -P)"
# the project dir:
projectDir="${binDir%/bin}"
@ -109,32 +109,36 @@ case "$projectDirName" in
OpenFOAM-*) # standard naming convention OpenFOAM-<VERSION>
version="${projectDirName##OpenFOAM-}"
;;
openfoam[0-9]* | openfoam-dev) # debian naming convention 'openfoam<VERSION>'
openfoam[0-9]*) # debian naming convention
versionNum="${projectDirName##openfoam}"
case "$versionNum" in
??) # convert 2 digit version number to decimal delineated
[4-9]) # v4-9
version="$versionNum"
;;
[1-2][0-9]) # v10 onwards
version="$versionNum"
;;
3[0-9]) # e.g. v3.0
version=$(echo "$versionNum" | sed -e 's@\(.\)\(.\)@\1.\2@')
;;
???) # convert 3 digit version number to decimal delineated
[1-2][0-9][0-9]) # e.g. v1.7.0
version=$(echo "$versionNum" | sed -e 's@\(.\)\(.\)\(.\)@\1.\2.\3@')
;;
????) # convert 4 digit version number to decimal delineated
version=$(echo "$versionNum" | sed -e 's@\(.\)\(.\)\(.\)\(.\)@\1.\2.\3.\4@')
;;
*) # failback - use current environment setting
*)
version="$WM_PROJECT_VERSION"
;;
esac
;;
openfoam-dev) # debian naming convention
versionNum="${projectDirName##openfoam}"
version="${versionNum##-}"
;;
*)
echo "Error : unknown/unsupported naming convention"
exit 1
;;
esac
# default mode is 'ugo'
mode=ugo
unset optAll optList optQuiet optSilent
@ -294,7 +298,6 @@ else
fi
exit $exitCode
#------------------------------------------------------------------------------