Skip to content
Snippets Groups Projects
remove_old 9.47 KiB
Newer Older
#! /bin/bash

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

    if [ -d $previous_inst ]; then
        echo "Found previous installation at "$previous_inst
        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 [ -d $1/BOOST ]; then
    	is_update=$(cat $1/BOOST/include/boost/version.hpp | grep "#define BOOST_VERSION 106800")
Pietro Incardona's avatar
Pietro Incardona committed
    	if [ x"$is_update" == x"" ]; then
            echo -e "\033[1;34;5m  --------------------------------------------------------------------------- \033[0m"
            echo -e "\033[1;34;5m  Boost has been updated to 1.68, 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
    	fi
    ## check if the METIS directory exist and the METIS version installed

    if [ -d $1/METIS ]; then
        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

    if [ -d $1/PARMETIS ]; then
        version=$(cat $1/PARMETIS/version)
        if [ x"$version" != x"1"  ]; then
            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
Pietro Incardona's avatar
Pietro Incardona committed
    fi
Pietro Incardona's avatar
Pietro Incardona committed
    if [ -d $1/TRILINOS ]; then
        version=$(cat $1/TRILINOS/version)
        if [ x"$version" != x"1"  ]; then
            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
Pietro Incardona's avatar
Pietro Incardona committed
        fi
    fi

    if [ -d $1/SUITESPARSE ]; then
        version=$(cat $1/SUITESPARSE/version)
        if [ x"$version" != x"1"  ]; then
            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
Pietro Incardona's avatar
Pietro Incardona committed
        fi
    fi

    if [ -d $1/PETSC ]; then
        version=$(cat $1/PETSC/version)
Pietro Incardona's avatar
Pietro Incardona committed
        if [ x"$version" != x"2"  ]; then
            echo -e "\033[1;34;5m  -------------------------------------------------------------------------------------- \033[0m"
Pietro Incardona's avatar
Pietro Incardona committed
            echo -e "\033[1;34;5m  PETSC has been updated to version 3.10.2, the component will be updated automatically      \033[0m"
            echo -e "\033[1;34;5m  -------------------------------------------------------------------------------------- \033[0m"
            sleep 5
            rm -rf $1/PETSC
Pietro Incardona's avatar
Pietro Incardona committed
	    rm -rf $1/HYPRE
	    rm -rf $1/MUMPS
	    rm -rf $1/SUPERLU_DIST
	    rm -rf $1/TRILINOS
    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.10.6, 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
    if [ -d $1/MPI ]; then
        version=$(cat $1/MPI/version)
Pietro Incardona's avatar
Pietro Incardona committed
        if [ x"$version" != x"4"  ]; then
            echo -e "\033[1;34;5m  -------------------------------------------------------------------------------------- \033[0m"
            echo -e "\033[1;34;5m  MPI has been updated to version 4.0.2, the component will be updated automatically      \033[0m"
            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/ZLIB
            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
        fi
    fi

    if [ -d $1/EIGEN ]; then
        version=$(cat $1/EIGEN/version)
        if [ x"$version" != x"2"  ]; then
            echo -e "\033[1;34;5m  -------------------------------------------------------------------------------- \033[0m"
            echo -e "\033[1;34;5m  EIGEN has been updated to 3.3.5 , 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

    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
		rm -rf $1/OPENBLAS
                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