Allwmake and {applications,src}/Allwmake use wmake/wmakeCheckPwd

- solves problems that can occur when checking $PWD and links are involved
This commit is contained in:
Mark Olesen 2009-08-07 20:24:11 +02:00
parent 1d8294b5b0
commit bdbdd25bac
4 changed files with 16 additions and 14 deletions

View File

@ -1,13 +1,12 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # run from this directory cd ${0%/*} || exit 1 # run from this directory
if [ "$PWD" != "$WM_PROJECT_DIR" ] wmakeCheckPwd "$WM_PROJECT_DIR" || {
then
echo "Error: Current directory is not \$WM_PROJECT_DIR" echo "Error: Current directory is not \$WM_PROJECT_DIR"
echo " The environment variables are inconsistent with the installation." echo " The environment variables are inconsistent with the installation."
echo " Check the OpenFOAM entries in your dot-files and source them." echo " Check the OpenFOAM entries in your dot-files and source them."
exit 1 exit 1
fi }
# wmake is required for subsequent targets # wmake is required for subsequent targets
( cd wmake/src && make ) ( cd wmake/src && make )

View File

@ -1,13 +1,12 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # run from this directory cd ${0%/*} || exit 1 # run from this directory
if [ "$PWD" != "$WM_PROJECT_DIR/applications" ] wmakeCheckPwd "$WM_PROJECT_DIR/applications" || {
then
echo "Error: Current directory is not \$WM_PROJECT_DIR/applications" echo "Error: Current directory is not \$WM_PROJECT_DIR/applications"
echo " The environment variables are inconsistent with the installation." echo " The environment variables are inconsistent with the installation."
echo " Check the OpenFOAM entries in your dot-files and source them." echo " Check the OpenFOAM entries in your dot-files and source them."
exit 1 exit 1
fi }
set -x set -x

View File

@ -1,13 +1,12 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # run from this directory cd ${0%/*} || exit 1 # run from this directory
if [ "$PWD" != "$WM_PROJECT_DIR/src" ] wmakeCheckPwd "$WM_PROJECT_DIR/src" || {
then
echo "Error: Current directory is not \$WM_PROJECT_DIR/src" echo "Error: Current directory is not \$WM_PROJECT_DIR/src"
echo " The environment variables are inconsistent with the installation." echo " The environment variables are inconsistent with the installation."
echo " Check the OpenFOAM entries in your dot-files and source them." echo " Check the OpenFOAM entries in your dot-files and source them."
exit 1 exit 1
fi }
set -x set -x

View File

@ -24,7 +24,7 @@
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# #
# Script # Script
# foamCheckPwd # wmakeCheckPwd
# #
# Description # Description
# Check that the current working directory is equal to a particular # Check that the current working directory is equal to a particular
@ -80,19 +80,24 @@ done
dirName="$1" dirName="$1"
# trival checks first # trivial checks first
[ "$PWD" = "$dirName" ] && exit 0 [ "$PWD" = "$dirName" ] && exit 0
[ -d "$dirName" ] || exit 1
[ -d "$dirName" ] || {
[ "$quietOpt" = true ] || echo "Error: Directory does not exist $dirName"
exit 1
}
# use /bin/pwd to get the absolute path (could be linked) # use /bin/pwd to get the absolute path (could be linked)
thisDir=$(/bin/pwd) thisDir=$(/bin/pwd)
dirName=$(cd $dirName 2>/dev/null && /bin/pwd) target=$(cd $dirName 2>/dev/null && /bin/pwd)
# okay # okay
[ "$thisDir" = "$dirName" ] && exit 0 [ "$thisDir" = "$target" ] && exit 0
# some other error # some other error
[ "$quietOpt" = true ] || echo "Error: Current directory is not $dirName"
exit 1 exit 1
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------