STYLE: unify cd, check for the cwd and error message

This commit is contained in:
Mark Olesen
2017-02-06 09:13:59 +01:00
parent aaeab42691
commit 3e5307111c
4 changed files with 39 additions and 43 deletions

View File

@ -1,21 +1,20 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory # Run from OPENFOAM top-level directory only
cd ${0%/*} && wmakeCheckPwd "$WM_PROJECT_DIR" 2>/dev/null || {
echo "Error (${0##*/}) : not located in \$WM_PROJECT_DIR"
echo " Check your OpenFOAM environment and installation"
exit 1
}
[ -n "$FOAM_EXT_LIBBIN" ] || {
echo "Error (${0##*/}) : FOAM_EXT_LIBBIN not set"
echo " Check your OpenFOAM environment and installation"
exit 1
}
# Parse arguments for library compilation # Parse arguments for library compilation
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
wmakeCheckPwd "$WM_PROJECT_DIR" || { #------------------------------------------------------------------------------
echo "Allwmake error: Current directory is not \$WM_PROJECT_DIR"
echo " The environment variables are inconsistent with the installation."
echo " Check the OpenFOAM entries in your dot-files and source them."
exit 1
}
[ -n "$FOAM_EXT_LIBBIN" ] || {
echo "Allwmake error: FOAM_EXT_LIBBIN not set"
echo " Check the OpenFOAM entries in your dot-files and source them."
exit 1
}
# Compile wmake support applications # Compile wmake support applications
(cd wmake/src && make) (cd wmake/src && make)

View File

@ -1,21 +1,20 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory # Run from OPENFOAM applications/ directory only
cd ${0%/*} && wmakeCheckPwd "$WM_PROJECT_DIR/applications" 2>/dev/null || {
echo "Error (${0##*/}) : not located in \$WM_PROJECT_DIR/applications"
echo " Check your OpenFOAM environment and installation"
exit 1
}
[ -n "$FOAM_EXT_LIBBIN" ] || {
echo "Error (${0##*/}) : FOAM_EXT_LIBBIN not set"
echo " Check your OpenFOAM environment and installation"
exit 1
}
# Parse arguments for library compilation # Parse arguments for library compilation
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
wmakeCheckPwd "$WM_PROJECT_DIR/applications" || { #------------------------------------------------------------------------------
echo "Allwmake error: Current directory is not \$WM_PROJECT_DIR/applications"
echo " The environment variables are inconsistent with the installation."
echo " Check the OpenFOAM entries in your dot-files and source them."
exit 1
}
[ -n "$FOAM_EXT_LIBBIN" ] || {
echo "Allwmake error: FOAM_EXT_LIBBIN not set"
echo " Check the OpenFOAM entries in your dot-files and source them."
exit 1
}
wmake -all $targetType solvers wmake -all $targetType solvers
wmake -all $targetType utilities wmake -all $targetType utilities

View File

@ -1,9 +1,8 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory cd ${0%/*} || exit 1 # Run from this directory
[ -d "$WM_PROJECT_DIR" ] || { [ -d "$WM_PROJECT_DIR" ] || {
echo " Error: WM_PROJECT_DIR directory does not exist" echo "Error (${0##*/}) : no \$WM_PROJECT_DIR found"
echo " Check the OpenFOAM entries in your dot-files and source them." echo " Check your OpenFOAM environment and installation"
echo " WM_PROJECT_DIR=$WM_PROJECT_DIR" echo " WM_PROJECT_DIR=$WM_PROJECT_DIR"
exit 1 exit 1
} }

View File

@ -1,21 +1,20 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory # Run from OPENFOAM src/ directory only
cd ${0%/*} && wmakeCheckPwd "$WM_PROJECT_DIR/src" 2>/dev/null || {
echo "Error (${0##*/}) : not located in \$WM_PROJECT_DIR/src"
echo " Check your OpenFOAM environment and installation"
exit 1
}
[ -n "$FOAM_EXT_LIBBIN" ] || {
echo "Error (${0##*/}) : FOAM_EXT_LIBBIN not set"
echo " Check your OpenFOAM environment and installation"
exit 1
}
# Parse arguments for library compilation # Parse arguments for library compilation
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
wmakeCheckPwd "$WM_PROJECT_DIR/src" || { #------------------------------------------------------------------------------
echo "Allwmake error: Current directory is not \$WM_PROJECT_DIR/src"
echo " The environment variables are inconsistent with the installation."
echo " Check the OpenFOAM entries in your dot-files and source them."
exit 1
}
[ -n "$FOAM_EXT_LIBBIN" ] || {
echo "Allwmake error: FOAM_EXT_LIBBIN not set"
echo " Check the OpenFOAM entries in your dot-files and source them."
exit 1
}
# Update OpenFOAM version strings if required # Update OpenFOAM version strings if required
wmakePrintBuild -check || wrmo OpenFOAM/global/global.o 2>/dev/null wmakePrintBuild -check || wrmo OpenFOAM/global/global.o 2>/dev/null