remove_old 3.27 KB
Newer Older
1
2
3
4
5
6
7
8
9
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#! /bin/bash

function remove_old()
{
    ## Get the previos openFPM installation
    previous_inst=$(cat $PWD/install_dir)
    
    if [ x"$previous_inst"!=x"" ]; then
        echo "Found previous installation"
        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
    
        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
    
        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
    
        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
    
    ## Check the installed version of the dependencies
    
    if [ -f $1/BOOST/include/boost/version.hpp ]; then
        is_update=$(cat $1/BOOST/include/boost/version.hpp | grep "#define BOOST_VERSION 106000")
        if [ x"$is_update"==x"" ]; then
            echo "New boost version, removing the old one"
            rm -rf $1/BOOST/include
            rm -rf $1/BOOST/lib
        fi
    fi

    
}

remove_old "/home/i-bird"