install.sh 6.34 KB
Newer Older
1
# One click install script dumux
2
3
4
5
6
echo " "
echo " "
echo "*********************************************************************************************"
echo "(0/4) Checking all prerequistes. (git cmake gcc g++ wget pkg-config gnuplot umfpack)"
echo "*********************************************************************************************"
Timo Koch's avatar
Timo Koch committed
7

8
# check some prerequistes
9
for PRGRM in git cmake gcc g++ wget paraview pkg-config gnuplot; do
10
11
12
13
14
15
    if ! [ -x "$(command -v $PRGRM)" ]; then
        echo "Error: $PRGRM is not installed." >&2
        exit 1
    fi
done

16
17
18
19
20
21
22
23
# check some library prerequistes
for LIBRARY in libumfpack; do
    if ! [ "$(/sbin/ldconfig -p | grep $LIBRARY)" ]; then
        echo "Error: $LIBRARY is not installed." >&2
        exit 1
    fi
done

24
currentver="$(gcc -dumpversion)"
25
requiredver="7"
26
27
28
29
30
if [ "$(printf '%s\n' "$requiredver" "$currentver" | sort -V | head -n1)" != "$requiredver" ]; then
    echo "gcc greater than or equal to $requiredver is required!" >&2
    exit 1
fi

31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
if [ $? -ne 0 ]; then
    echo "*********************************************************************************************"
    echo "(0/4) An error occured while checking for prerequistes."
    echo "*********************************************************************************************"
    exit $?
else
    echo "*********************************************************************************************"
    echo "(1/4) All prerequistes found."
    echo "*********************************************************************************************"
fi

echo " "

echo "**************************************************************************************************************"
echo "(1/4) Downloading supplementary files (test script & cmake.opts). Make sure to be connected to the internet."
echo "**************************************************************************************************************"

48
# make a new folder containing everything
49
50
mkdir $(pwd)/DUMUX
cd DUMUX
51

52
# download the test script and the cmake.opts
53
if [ ! -f "test_dumux.sh" ]; then
Theresa Schollenberger's avatar
Theresa Schollenberger committed
54
    wget https://git.iws.uni-stuttgart.de/dumux-repositories/dumux-course/raw/releases/3.4/scripts/test_dumux.sh
55
fi
56
57
chmod +x test_dumux.sh

58
if [ ! -f "cmake.opts" ]; then
Theresa Schollenberger's avatar
Theresa Schollenberger committed
59
    wget https://git.iws.uni-stuttgart.de/dumux-repositories/dumux-course/raw/releases/3.4/cmake.opts
60
fi
61

62
63
64
65
66
67
68
69
70
71
72
73
74
if [ $? -ne 0 ]; then
    echo "*********************************************************************************************"
    echo "(1/4) An error occured while downloading supplementary files."
    echo "*********************************************************************************************"
    exit $?
else
    echo "*********************************************************************************************"
    echo "(2/4) All supplementary files downloaded."
    echo "*********************************************************************************************"
fi

echo " "

75
echo "*********************************************************************************************"
76
echo "(2/4) Cloning repositories. This may take a while. Make sure to be connected to the internet."
77
echo "*********************************************************************************************"
78
DUNE_VERSION=2.7
79
80
81
82
83
84
# the core modules
for MOD in common geometry grid localfunctions istl; do
    if [ ! -d "dune-$MOD" ]; then
        git clone -b releases/$DUNE_VERSION https://gitlab.dune-project.org/core/dune-$MOD.git
    else
        echo "Skip cloning dune-$MOD because the folder already exists."
85
        git checkout releases/$DUNE_VERSION
86
87
88
89
90
91
92
93
94
    fi
done

# extension modules
for MOD in dune-foamgrid dune-alugrid; do
    if [ ! -d "$MOD" ]; then
        git clone -b releases/$DUNE_VERSION https://gitlab.dune-project.org/extensions/$MOD.git
    else
        echo "Skip cloning $MOD because the folder already exists."
95
        git checkout releases/$DUNE_VERSION
96
97
98
99
100
    fi
done

# dune-subgrid
if [ ! -d "dune-subgrid" ]; then
Theresa Schollenberger's avatar
Theresa Schollenberger committed
101
    git clone -b releases/$DUNE_VERSION  https://git.imp.fu-berlin.de/agnumpde/dune-subgrid.git
102
103
else
    echo "Skip cloning dune-subgrid because the folder already exists."
Theresa Schollenberger's avatar
Theresa Schollenberger committed
104
    git checkout releases/$DUNE_VERSION
105
106
107
108
fi

# dumux
if [ ! -d "dumux" ]; then
Theresa Schollenberger's avatar
Theresa Schollenberger committed
109
    git clone -b releases/3.4 https://git.iws.uni-stuttgart.de/dumux-repositories/dumux.git
110
111
else
    echo "Skip cloning dumux because the folder already exists."
112
    cd dumux
Theresa Schollenberger's avatar
Theresa Schollenberger committed
113
    git checkout releases/3.4
114
    cd ..
115
116
117
118
fi

# dumux-course
if [ ! -d "dumux-course" ]; then
Theresa Schollenberger's avatar
Theresa Schollenberger committed
119
    git clone -b releases/3.4 https://git.iws.uni-stuttgart.de/dumux-repositories/dumux-course.git
120
121
else
    echo "Skip cloning dumux-course because the folder already exists."
122
    cd dumux-course
Theresa Schollenberger's avatar
Theresa Schollenberger committed
123
    git checkout releases/3.4
124
    cd ..
125
126
127
128
fi

if [ $? -ne 0 ]; then
    echo "*********************************************************************************************"
129
    echo "(2/4) Failed to clone the repositories. Look for repository specific errors."
130
131
    echo "*********************************************************************************************"
    exit $?
132
133
134
135
else
    echo "*********************************************************************************************"
    echo "(3/4) All repositories have been cloned into a containing folder."
    echo "*********************************************************************************************"
136
137
fi

138
139
140
141
142
143
144
echo " "

echo "**************************************************************************************************"
echo "(3/4) Configure and build dune modules and dumux using dunecontrol. This may take several minutes."
echo "**************************************************************************************************"

# run dunecontrol
145
./dune-common/bin/dunecontrol --opts=cmake.opts all
146

147
148
if [ $? -ne 0 ]; then
    echo "*********************************************************************************************"
149
    echo "(3/4) Failed to build the dune libaries."
150
151
    echo "*********************************************************************************************"
    exit $?
152
153
154
155
156
else
    echo "*****************************************************************************************************"
    echo "(4/4) Succesfully configured and built dune and dumux."
    echo "      Please change to the dumux folder and run the test_dumux.sh script to confirm everything works."
    echo "*****************************************************************************************************"
157
fi