ENH: handle odd c-shell sourcing patterns

- the result of lsof, which is used in the etc/cshrc to locate the
  installation, may contain trailing information about host and mount
  point.

  There is also a moderate concern with people sourcing the
  file indirectly with their own version in the same directory.
  For example, a 'etc/cshrc-site' that actually sources 'etc/cshrc'.
  This leads to multiple matches in the lsof output, so we only take
  the first one, stop there and hope they didn't do something even
  trickier.
This commit is contained in:
Mark Olesen
2018-12-10 10:34:11 +01:00
parent 38c56c5c6b
commit b6cb62a53f

View File

@ -54,7 +54,7 @@ setenv WM_PROJECT_VERSION plus
# If the directory naming does not match WM_PROJECT, need to change here # If the directory naming does not match WM_PROJECT, need to change here
set projectName="$WM_PROJECT" set projectName="$WM_PROJECT"
set projectDir=`lsof +p $$ |& \ set projectDir=`lsof +p $$ |& \
sed -n -e 's@^[^/]*@@; s@\(/'"$projectName"'[^/]*\)/etc/cshrc[^/]*@\1@p'` sed -ne 's@^[^/]*@@;\@/'"$projectName"'[^/]*/etc/cshrc@{s@/etc/cshrc.*@@p; q}'`
# set projectDir="$HOME/OpenFOAM/OpenFOAM-$WM_PROJECT_VERSION" # set projectDir="$HOME/OpenFOAM/OpenFOAM-$WM_PROJECT_VERSION"
# set projectDir="/opt/OpenFOAM/OpenFOAM-$WM_PROJECT_VERSION" # set projectDir="/opt/OpenFOAM/OpenFOAM-$WM_PROJECT_VERSION"