intersection with triangle plane for miss
[OpenFOAM-1.5.x.git] / bin / foamSystemCheck
blob5b8d33574a74d31c7bc75c6dd1ba84f633bac397
1 #!/bin/sh
2 #------------------------------------------------------------------------------
3 # ========= |
4 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 # \\ / O peration |
6 # \\ / A nd | Copyright (C) 1991-2008 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 the
14 # Free Software Foundation; either version 2 of the License, or (at your
15 # 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, write to the Free Software Foundation,
24 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 # Script
27 # foamSystemCheck
29 # Description
30 # Checks the machine system and the user's
31 # personal configuration for running OpenFOAM.
33 #------------------------------------------------------------------------------
35 # STATIC VARIABLES
36 # ~~~~~~~~~~~~~~~~
37 FOAM_VERSION=1.5
39 HLINE="-----------------------------------------------------------------------"
40 WIDTH=16
41 unset FATALERROR
43 # FUNCTIONS
44 # ~~~~~~~~~
45 heading () {
46 echo ""
47 echo "$1"
48 echo "$HLINE"
51 lenBase () {
52 echo $1 | tr -d " " | wc -m | tr -d " "
55 length () {
56 NOCHAR=$(lenBase $1)
57 NOCHAR=$(expr $NOCHAR - 1)
58 if [ $NOCHAR -eq -1 ]
59 then
60 NOCHAR=0
62 echo $NOCHAR
65 fixlen () {
66 WORD=$1
67 ONELEN=$(length "$1")
68 LDIFF=$(expr $ONELEN - $2)
69 if [ $LDIFF -le 1 ]
70 then
71 while [ $LDIFF -lt 0 ]
73 WORD="$WORD "
74 LDIFF=$(expr $LDIFF + 1)
75 done
76 echo "$WORD"
77 else
78 LDIFF=$(expr $LDIFF + 4)
79 WORD=$(echo "$WORD" | cut -c${LDIFF}-)
80 echo "...${WORD}"
84 # MAIN CODE
85 # ~~~~~~~~~
86 heading "Checking basic system..."
88 # check shell
89 echo "$(fixlen "Shell:" $WIDTH) $SHELL"
90 case "$SHELL" in
91 */csh | */tcsh)
92 USER_CONFIG_TYPE=cshrc
94 */bash | */ksh)
95 USER_CONFIG_TYPE=bashrc
98 USER_CONFIG_TYPE=""
99 echo "FATALERROR: Cannot identify the current shell."
100 echo " OpenFOAM ${FOAM_VERSION} is compatible"
101 echo " with csh, tcsh, ksh and bash."
102 echo
103 FATALERROR=yes
105 esac
107 # check hostname
108 HOST=$(uname -n)
109 echo "$(fixlen "Host:" $WIDTH) $HOST"
110 if [ $(length $HOST) -eq 0 ]
111 then
112 echo "FATALERROR: Cannot stat hostname."
113 echo " OpenFOAM ${FOAM_VERSION} needs a valid hostname to function."
114 echo " Contact your system administrator. "
115 echo
116 FATALERROR=yes
119 # check os
120 OS=$(uname -s)
121 case "$OS" in
122 Linux | LinuxAMD64 | SunOS )
123 echo "$(fixlen "OS:" $WIDTH) ${OS} version $(uname -r)"
126 echo "FATALERROR: Incompatible operating system \"$OS\"."
127 echo " OpenFOAM ${FOAM_VERSION} is currently available for "
128 echo " Linux, LinuxAMD64 and SunOS only."
129 echo
130 FATALERROR=yes
132 esac
135 # check user name
136 USER_NAME=$LOGNAME
137 if [ $(length $USER_NAME) -eq 0 ]
138 then
139 USER_NAME=$USER
142 echo "$(fixlen "User:" $WIDTH) ${USER_NAME}"
143 if [ $(length $USER_NAME) -eq 0 ]
144 then
145 echo "FATALERROR: Cannot stat user name ${USER_NAME}."
146 echo " OpenFOAM ${FOAM_VERSION} needs a valid user name."
147 echo " Contact your system administrator. "
148 echo ""
149 FATALERROR=yes
153 echo ""
154 echo ""
155 if [ -n "$FATALERROR" ]
156 then
157 echo "System check: FAIL"
158 echo "=================="
159 echo "Your system is not currently compatible with OpenFOAM installation "
160 echo "requirements. Review the error messages and consult the documentation"
161 echo "for further instructions."
162 echo
163 else
164 echo "System check: PASS"
165 echo "=================="
166 echo "Continue OpenFOAM installation."
167 echo
170 #------------------------------------------------------------------------------