remove_old 10.6 KB
Newer Older
1
2
3
4
5
#! /bin/bash

function remove_old()
{
    ## Get the previos openFPM installation
6
7
8
9
    previous_inst=`echo $2 | sed 's/--prefix=//g'`

    if [ -d $previous_inst ]; then
        echo "Found previous installation at "$previous_inst
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
        if [ -d "$previous_inst/openfpm_pdata" ]; then
            echo "Removing the folder: $previous_inst/openfpm_pdata"
            rm -rf "$previous_inst/openfpm_pdata"
            if [ -d "$previous_inst/openfpm_pdata" ]; then
                echo -e "\033[91;5;1m Remove failed, manually remove the folder $previous_inst/openfpm_pdata, I am waiting ... \033[0m"
            fi
            while [ -d "$previous_inst/openfpm_pdata" ]
            do
                sleep 1
            done
            echo "Thanks"
        fi

        if [ -d "$previous_inst/openfpm_data" ]; then
            echo "Removing the folder: $previous_inst/openfpm_data"
            rm -rf "$previous_inst/openfpm_data"
            if [ -d "$previous_inst/openfpm_data" ]; then
                echo -e "\033[91;5;1m Remove failed, manually remove the folder $previous_inst/openfpm_data, I am waiting ... \033[0m"
            fi
            while [ -d "$previous_inst/openfpm_data" ]
            do
                sleep 1
            done
            echo "Thanks"
        fi
35

36
37
38
39
40
41
42
43
44
45
46
47
        if [ -d "$previous_inst/openfpm_devices" ]; then
            echo "Removing the folder: $previous_inst/openfpm_devices"
            rm -rf "$previous_inst/openfpm_devices"
            if [ -d "$previous_inst/openfpm_devices" ]; then
                echo -e "\033[91;5;1m Remove failed, manually remove the folder $previous_inst/openfpm_devices, I am waiting ... \033[0m"
            fi
            while [ -d "$previous_inst/openfpm_devices" ]
            do
                sleep 1
            done
            echo "Thanks"
        fi
48

49
50
51
52
53
54
55
56
57
58
59
60
        if [ -d "$previous_inst/openfpm_io" ]; then
            echo "Removing the folder: $previous_inst/openfpm_io"
            rm -rf "$previous_inst/openfpm_io"
            if [ -d "$previous_inst/openfpm_io" ]; then
                echo -e "\033[91;5;1m Remove failed, manually remove the folder $previous_inst/openfpm_io, I am waiting ... \033[0m"
            fi
            while [ -d "$previous_inst/openfpm_io" ]
            do
                sleep 1
            done
            echo "Thanks"
        fi
61

62
63
64
65
66
67
68
69
70
71
72
73
74
        if [ -d "$previous_inst/openfpm_vcluster" ]; then
            echo "Removing the folder: $previous_inst/openfpm_vcluster"
            rm -rf "$previous_inst/openfpm_vcluster"
            if [ -d "$previous_inst/openfpm_vcluster" ]; then
                echo -e "\033[91;5;1m Remove failed, manually remove the folder $previous_inst/openfpm_vcluster, I am waiting ... \033[0m"
            fi
            while [ -d "$previous_inst/openfpm_vcluster" ]
            do
                sleep 1
            done
            echo "Thanks"
        fi
    fi
75

76
    ## Check the installed version of the dependencies
77

78
    if [ -d $1/BOOST ]; then
incardon's avatar
incardon committed
79
    	is_update=$(cat $1/BOOST/include/boost/version.hpp | grep "#define BOOST_VERSION 106300")
Pietro Incardona's avatar
Pietro Incardona committed
80
    	if [ x"$is_update" == x"" ]; then
81
82
83
84
85
86
87
            echo -e "\033[1;34;5m  --------------------------------------------------------------------------- \033[0m"
            echo -e "\033[1;34;5m  Boost has been updated to 1.63, the component will be updated automatically \033[0m"
            echo -e "\033[1;34;5m  --------------------------------------------------------------------------- \033[0m"
            sleep 5
            rm -rf $1/BOOST/include
            rm -rf $1/BOOST/lib
            rm -rf $1/BOOST
Pietro Incardona's avatar
Pietro Incardona committed
88
    	fi
89
90
    fi

91
92
93
    ## check if the METIS directory exist and the METIS version installed

    if [ -d $1/METIS ]; then
94
95
96
97
98
99
100
101
102
103
104
105
        version=$(cat $1/METIS/version)
        if [ x"$version" != x"1"  ]; then
            echo -e "\033[1;34;5m  ------------------------------------------------------------------- \033[0m"
            echo -e "\033[1;34;5m  METIS has been updated, the component will be updated automatically \033[0m"
            echo -e "\033[1;34;5m  ------------------------------------------------------------------- \033[0m"
            sleep 5
            rm -rf $1/METIS/include
            rm -rf $1/METIS/lib
            rm -rf $1/METIS
        fi
    fi

106
107
108
    if [ -d $1/PARMETIS ]; then
        version=$(cat $1/PARMETIS/version)
        if [ x"$version" != x"1"  ]; then
109
110
111
112
113
114
115
116
            echo -e "\033[1;34;5m  ---------------------------------------------------------------------- \033[0m"
            echo -e "\033[1;34;5m  PARMETIS has been updated, the component will be updated automatically \033[0m"
            echo -e "\033[1;34;5m  ---------------------------------------------------------------------- \033[0m"
            sleep 5
            rm -rf $1/PARMETIS/include
            rm -rf $1/PARMETIS/lib
            rm -rf $1/PARMETIS/bin
            rm -rf $1/PARMETIS
117
        fi
Pietro Incardona's avatar
Pietro Incardona committed
118
    fi
Pietro Incardona's avatar
Pietro Incardona committed
119

incardon's avatar
incardon committed
120
121
122
    if [ -d $1/TRILINOS ]; then
        version=$(cat $1/TRILINOS/version)
        if [ x"$version" != x"1"  ]; then
123
124
125
126
127
128
            echo -e "\033[1;34;5m  ------------------------------------------------------------------------------------------- \033[0m"
            echo -e "\033[1;34;5m  Trilinos has been updated to version 12.10.1, the component will be updated automatically      \033[0m"
            echo -e "\033[1;34;5m  ------------------------------------------------------------------------------------------- \033[0m"
            sleep 5
            rm -rf $1/TRILINOS
            rm -rf $1/PETSC
incardon's avatar
incardon committed
129
130
131
132
133
134
        fi
    fi

    if [ -d $1/SUITESPARSE ]; then
        version=$(cat $1/SUITESPARSE/version)
        if [ x"$version" != x"1"  ]; then
135
136
137
138
139
140
            echo -e "\033[1;34;5m  ------------------------------------------------------------------------------------------- \033[0m"
            echo -e "\033[1;34;5m  SuiteSparse has been updated to version 4.5.5, the component will be updated automatically      \033[0m"
            echo -e "\033[1;34;5m  ------------------------------------------------------------------------------------------- \033[0m"
            sleep 5
            rm -rf $1/SUITESPARSE
            rm -rf $1/PETSC
incardon's avatar
incardon committed
141
142
143
144
145
146
        fi
    fi

    if [ -d $1/SUPERLU_DIST ]; then
        version=$(cat $1/SUPERLU_DIST/version)
        if [ x"$version" != x"1"  ]; then
147
148
149
150
151
152
            echo -e "\033[1;34;5m  ---------------------------------------------------------------------------------------------------------- \033[0m"
            echo -e "\033[1;34;5m  SuperLU (Distributed) has been updated to version 5.2.1, the component will be updated automatically      \033[0m"
            echo -e "\033[1;34;5m  ---------------------------------------------------------------------------------------------------------- \033[0m"
            sleep 5
            rm -rf $1/SUPERLU_DIST
            rm -rf $1/PETSC
incardon's avatar
incardon committed
153
154
155
156
157
158
        fi
    fi

    if [ -d $1/HYPRE ]; then
        version=$(cat $1/HYPRE/version)
        if [ x"$version" != x"1"  ]; then
159
160
161
162
163
164
            echo -e "\033[1;34;5m  ------------------------------------------------------------------------------------------- \033[0m"
            echo -e "\033[1;34;5m  HYPRE has been updated to version 2.11.2, the component will be updated automatically      \033[0m"
            echo -e "\033[1;34;5m  ------------------------------------------------------------------------------------------- \033[0m"
            sleep 5
            rm -rf $1/HYPRE
            rm -rf $1/PETSC
incardon's avatar
incardon committed
165
166
167
168
169
170
        fi
    fi

    if [ -d $1/PETSC ]; then
        version=$(cat $1/PETSC/version)
        if [ x"$version" != x"1"  ]; then
171
172
173
174
175
            echo -e "\033[1;34;5m  -------------------------------------------------------------------------------------- \033[0m"
            echo -e "\033[1;34;5m  PETSC has been updated to version 3.7.6, the component will be updated automatically      \033[0m"
            echo -e "\033[1;34;5m  -------------------------------------------------------------------------------------- \033[0m"
            sleep 5
            rm -rf $1/PETSC
incardon's avatar
incardon committed
176
177
178
        fi
    fi

incardon's avatar
incardon committed
179
180
181
182
183
184
185
186
187
188
189
    if [ -d $1/HDF5 ]; then
        version=$(cat $1/HDF5/version)
        if [ x"$version" != x"1"  ]; then
            echo -e "\033[1;34;5m  -------------------------------------------------------------------------------------- \033[0m"
            echo -e "\033[1;34;5m  HDF5 has been updated to version 1.8.19, the component will be updated automatically   \033[0m"
            echo -e "\033[1;34;5m  -------------------------------------------------------------------------------------- \033[0m"
            sleep 5
	    rm -rf $1/HDF5
        fi
    fi

Pietro Incardona's avatar
Pietro Incardona committed
190
191
    if [ -d $1/MPI ]; then
        version=$(cat $1/MPI/version)
incardon's avatar
incardon committed
192
        if [ x"$version" != x"3"  ]; then
193
            echo -e "\033[1;34;5m  -------------------------------------------------------------------------------------- \033[0m"
194
            echo -e "\033[1;34;5m  MPI has been updated to version 3.1.1, the component will be updated automatically      \033[0m"
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
            echo -e "\033[1;34;5m  -------------------------------------------------------------------------------------- \033[0m"
            sleep 5
            rm -rf $1/MPI/include
            rm -rf $1/MPI/lib
            rm -rf $1/MPI/bin
            rm -rf $1/MPI/etc
            rm -rf $1/MPI/share
            rm -rf $1/MPI
            rm -rf $1/HDF5
            rm -rf $1/PARMETIS
            rm -rf $1/PETSC
            rm -rf $1/TRILINOS
            rm -rf $1/HYPRE
            rm -rf $1/MUMPS
            rm -rf $1/SUPERLU_DIST
Pietro Incardona's avatar
Pietro Incardona committed
210
211
        fi
    fi
212
213
214
215

    if [ -d $1/EIGEN ]; then
        version=$(cat $1/EIGEN/version)
        if [ x"$version" != x"1"  ]; then
216
217
218
219
220
221
222
            echo -e "\033[1;34;5m  ---------------------------------------------------------------------- \033[0m"
            echo -e "\033[1;34;5m  EIGEN has been updated, the component will be updated automatically    \033[0m"
            echo -e "\033[1;34;5m  ---------------------------------------------------------------------- \033[0m"
            sleep 5
            rm -rf $1/EIGEN/Eigen
            rm -rf $1/EIGEN
            rm -rf $1/PETSC
223
224
225
        fi
    fi

incardon's avatar
incardon committed
226
227
228
229
230
231
232
233

    if [ -d $1/OPENBLAS ]; then
        version=$(cat $1/OPENBLAS/version)
        if [ x"$version" != x"1"  ]; then
                echo -e "\033[1;34;5m  ---------------------------------------------------------------------- \033[0m"
                echo -e "\033[1;34;5m  OPENBLAS has been updated, the component will be updated automatically    \033[0m"
                echo -e "\033[1;34;5m  ---------------------------------------------------------------------- \033[0m"
                sleep 5
incardon's avatar
incardon committed
234
		rm -rf $1/OPENBLAS
incardon's avatar
incardon committed
235
236
237
238
239
240
241
242
243
244
                rm -rf $1/EIGEN
                rm -rf $1/PETSC
		rm -rf $1/SUITESPARSE
		rm -rf $1/SCALAPACK
		rm -rf $1/SUPERLU_DIST
		rm -rf $1/TRILINOS
		rm -rf $1/HYPRE
        fi
    fi

245
246
247
}