BUG: potentialFoam/cylinder: indexing into non-existing patch in parallel
[OpenFOAM-2.0.x.git] / bin / foamSystemCheck
blob399ced8c8aa1bc90a5aee543d6eddfaba3e596d5
1 #!/bin/sh
2 #------------------------------------------------------------------------------
3 # ========= |
4 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 # \\ / O peration |
6 # \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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 HLINE="-----------------------------------------------------------------------"
37 WIDTH=16
38 unset fatalError
40 # FUNCTIONS
41 # ~~~~~~~~~
42 heading()
44 echo
45 echo "$1"
46 echo "$HLINE"
49 lenBase()
51 echo $1 | tr -d " " | wc -m | tr -d " "
54 length()
56 NOCHAR=$(lenBase $1)
57 NOCHAR=$(expr $NOCHAR - 1)
58 [ $NOCHAR -ge 0 ] || NOCHAR=0
59 echo $NOCHAR
62 fixlen()
64 WORD=$1
65 ONELEN=$(length "$1")
66 LDIFF=$(expr $ONELEN - $2)
67 if [ $LDIFF -le 1 ]
68 then
69 while [ $LDIFF -lt 0 ]
71 WORD="$WORD "
72 LDIFF=$(expr $LDIFF + 1)
73 done
74 echo "$WORD"
75 else
76 LDIFF=$(expr $LDIFF + 4)
77 WORD=$(echo "$WORD" | cut -c${LDIFF}-)
78 echo "...${WORD}"
82 # MAIN CODE
83 # ~~~~~~~~~
84 heading "Checking basic system..."
86 # check shell
87 echo "$(fixlen Shell: $WIDTH) $SHELL"
88 case "$SHELL" in
89 */csh | */tcsh | */bash | */ksh)
92 echo "ERROR: Cannot identify the current shell."
93 echo " OpenFOAM $WM_PROJECT_VERSION is compatible"
94 echo " with csh, tcsh, ksh and bash."
95 echo
96 fatalError=true
98 esac
100 # check hostname
101 HOST=$(uname -n)
102 echo "$(fixlen Host: $WIDTH) $HOST"
103 if [ $(length $HOST) -eq 0 ]
104 then
105 echo "ERROR: Cannot stat hostname."
106 echo " OpenFOAM $WM_PROJECT_VERSION needs a valid hostname to"
107 echo " function. Contact your system administrator."
108 echo
109 fatalError=true
112 # check os
113 OSTYPE=$(uname -s)
114 case "$OSTYPE" in
115 Linux | LinuxAMD64 | SunOS )
116 echo "$(fixlen OS: $WIDTH) $OSTYPE version $(uname -r)"
119 echo "ERROR: Incompatible operating system \"$OSTYPE\"."
120 echo " OpenFOAM $WM_PROJECT_VERSION is currently available for "
121 echo " Linux, LinuxAMD64 and SunOS only."
122 echo
123 fatalError=true
125 esac
128 # check user name
129 USER_NAME=$LOGNAME
130 if [ $(length $USER_NAME) -eq 0 ]
131 then
132 USER_NAME=$USER
135 echo "$(fixlen User: $WIDTH) ${USER_NAME}"
136 if [ $(length $USER_NAME) -eq 0 ]
137 then
138 echo "ERROR: Cannot stat user name $USER_NAME."
139 echo " OpenFOAM $WM_PROJECT_VERSION needs a valid user name."
140 echo " Contact your system administrator. "
141 echo
142 fatalError=true
146 echo
147 echo
148 if [ "$fatalError" = true ]
149 then
150 echo "System check: FAIL"
151 echo "=================="
152 echo "Your system is not currently compatible with OpenFOAM installation "
153 echo "requirements. Review the error messages and consult the documentation"
154 echo "for further instructions."
155 echo
156 else
157 echo "System check: PASS"
158 echo "=================="
159 echo "Continue OpenFOAM installation."
160 echo
163 #------------------------------------------------------------------------------