ENH: patchCloud: return pTraits<Type>::max for unfound points
[OpenFOAM-1.7.x.git] / bin / foamSystemCheck
blob1c7a4da0c5b832be7c87d044e548b9cf1f5f455f
1 #!/bin/sh
2 #---------------------------------*- sh -*-------------------------------------
3 # ========= |
4 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 # \\ / O peration |
6 # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
7 # \\/ M anipulation |
8 #------------------------------------------------------------------------------
9 # License
10 # This file is part of OpenFOAM.
12 # OpenFOAM is free software: you can redistribute it and/or modify it
13 # under the terms of the GNU General Public License as published by
14 # the Free Software Foundation, either version 3 of the License, or
15 # (at your option) any later version.
17 # OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
18 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 # for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 # Script
26 # foamSystemCheck
28 # Description
29 # Checks the machine system and the user's
30 # personal configuration for running OpenFOAM.
32 #------------------------------------------------------------------------------
34 # STATIC VARIABLES
35 # ~~~~~~~~~~~~~~~~
36 FOAM_VERSION=1.6
38 HLINE="-----------------------------------------------------------------------"
39 WIDTH=16
40 unset FATALERROR
42 # FUNCTIONS
43 # ~~~~~~~~~
44 heading () {
45 echo ""
46 echo "$1"
47 echo "$HLINE"
50 lenBase () {
51 echo $1 | tr -d " " | wc -m | tr -d " "
54 length () {
55 NOCHAR=$(lenBase $1)
56 NOCHAR=$(expr $NOCHAR - 1)
57 if [ $NOCHAR -eq -1 ]
58 then
59 NOCHAR=0
61 echo $NOCHAR
64 fixlen () {
65 WORD=$1
66 ONELEN=$(length "$1")
67 LDIFF=$(expr $ONELEN - $2)
68 if [ $LDIFF -le 1 ]
69 then
70 while [ $LDIFF -lt 0 ]
72 WORD="$WORD "
73 LDIFF=$(expr $LDIFF + 1)
74 done
75 echo "$WORD"
76 else
77 LDIFF=$(expr $LDIFF + 4)
78 WORD=$(echo "$WORD" | cut -c${LDIFF}-)
79 echo "...${WORD}"
83 # MAIN CODE
84 # ~~~~~~~~~
85 heading "Checking basic system..."
87 # check shell
88 echo "$(fixlen "Shell:" $WIDTH) $SHELL"
89 case "$SHELL" in
90 */csh | */tcsh)
91 USER_CONFIG_TYPE=cshrc
93 */bash | */ksh)
94 USER_CONFIG_TYPE=bashrc
97 USER_CONFIG_TYPE=""
98 echo "FATALERROR: Cannot identify the current shell."
99 echo " OpenFOAM ${FOAM_VERSION} is compatible"
100 echo " with csh, tcsh, ksh and bash."
101 echo
102 FATALERROR=yes
104 esac
106 # check hostname
107 HOST=$(uname -n)
108 echo "$(fixlen "Host:" $WIDTH) $HOST"
109 if [ $(length $HOST) -eq 0 ]
110 then
111 echo "FATALERROR: Cannot stat hostname."
112 echo " OpenFOAM ${FOAM_VERSION} needs a valid hostname to function."
113 echo " Contact your system administrator. "
114 echo
115 FATALERROR=yes
118 # check os
119 OS=$(uname -s)
120 case "$OS" in
121 Linux | LinuxAMD64 | SunOS )
122 echo "$(fixlen "OS:" $WIDTH) ${OS} version $(uname -r)"
125 echo "FATALERROR: Incompatible operating system \"$OS\"."
126 echo " OpenFOAM ${FOAM_VERSION} is currently available for "
127 echo " Linux, LinuxAMD64 and SunOS only."
128 echo
129 FATALERROR=yes
131 esac
134 # check user name
135 USER_NAME=$LOGNAME
136 if [ $(length $USER_NAME) -eq 0 ]
137 then
138 USER_NAME=$USER
141 echo "$(fixlen "User:" $WIDTH) ${USER_NAME}"
142 if [ $(length $USER_NAME) -eq 0 ]
143 then
144 echo "FATALERROR: Cannot stat user name ${USER_NAME}."
145 echo " OpenFOAM ${FOAM_VERSION} needs a valid user name."
146 echo " Contact your system administrator. "
147 echo ""
148 FATALERROR=yes
152 echo ""
153 echo ""
154 if [ -n "$FATALERROR" ]
155 then
156 echo "System check: FAIL"
157 echo "=================="
158 echo "Your system is not currently compatible with OpenFOAM installation "
159 echo "requirements. Review the error messages and consult the documentation"
160 echo "for further instructions."
161 echo
162 else
163 echo "System check: PASS"
164 echo "=================="
165 echo "Continue OpenFOAM installation."
166 echo
169 #------------------------------------------------------------------------------