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 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | Website: https://openfoam.org # \\ / O peration | Website: https://openfoam.org
# \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
@ -88,7 +88,7 @@ error() {
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# the bin dir: # the bin dir:
binDir="${0%/*}" binDir="$(cd -- "$(dirname "$0")" >/dev/null 2>&1 || exit ; pwd -P)"
# the project dir: # the project dir:
projectDir="${binDir%/bin}" projectDir="${binDir%/bin}"
@ -109,32 +109,36 @@ case "$projectDirName" in
OpenFOAM-*) # standard naming convention OpenFOAM-<VERSION> OpenFOAM-*) # standard naming convention OpenFOAM-<VERSION>
version="${projectDirName##OpenFOAM-}" version="${projectDirName##OpenFOAM-}"
;; ;;
openfoam[0-9]*) # debian naming convention
openfoam[0-9]* | openfoam-dev) # debian naming convention 'openfoam<VERSION>'
versionNum="${projectDirName##openfoam}" versionNum="${projectDirName##openfoam}"
case "$versionNum" in 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@') 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@') 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" version="$WM_PROJECT_VERSION"
;; ;;
esac esac
;; ;;
openfoam-dev) # debian naming convention
versionNum="${projectDirName##openfoam}"
version="${versionNum##-}"
;;
*) *)
echo "Error : unknown/unsupported naming convention" echo "Error : unknown/unsupported naming convention"
exit 1 exit 1
;; ;;
esac esac
# default mode is 'ugo' # default mode is 'ugo'
mode=ugo mode=ugo
unset optAll optList optQuiet optSilent unset optAll optList optQuiet optSilent
@ -294,7 +298,6 @@ else
fi fi
exit $exitCode exit $exitCode
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------