Newer
Older
#! /bin/bash
source script/show_solutions
function update_openfpm()
{
echo -e "\033[1;5;31m WARNING: the update will destroy any changes you made in the OpenFPM source code \033[0m"
possible_solutions "${commands[@]}"
## Get the name of the updating branch
echo "Checking for update from $url_update"
repo=$(cat tmp_brc)
echo "Update repo $repo"
if [ x"$repo" == x"" ]; then
echo -e "\033[1m There are no-updates \033[0m"
return
fi
git remote update
n_commit=$(git rev-list --count origin/master...master)
if [ $n_commit -eq 0 ]; then
echo -e "\033[1m There are no-updates \033[0m"
return
dir_prev_inst=$(cat dependencies_dir)
for_opt=$(cat foward_options)
if [ x"$dir_prev_inst" != x"" ]; then
if [ x"$1" == x"update" ]; then
git stash -u
git submodule foreach 'git stash'
#### New version require new version of CMAKE
dgc_major=$(cmake --version | grep "cmake version" | sed 's/.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\1/g')
dgc_middle=$(cmake --version | grep "cmake version" | sed 's/.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\2/g')
dgc_minor=$(cmake --version | grep "cmake version" | sed 's/.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\3/g')
cmake_result=0
if [ $dgc_major -gt 3 ]; then
echo -e "cmake $dgc_major.$dgc_middle.$dgc_minor \033[92;1m SUCCESS \033[0m"
cmake_result=1
elif [ $dgc_major -lt 3 ]; then
echo -e "cmake $dgc_major.$dgc_middle.$dgc_minor \033[91;5;1m FAILED \033[0m your cmake $dgc_major.$dgc_middle;$dgc_minor is too old, 3.8.X or higher is required"
elif [ $dgc_middle -gt 8 ]; then
echo -e "cmake $dgc_major.$dgc_middle.$dgc_minor \033[92;1m SUCCESS \033[0m"
cmake_result=1
elif [ $dgc_middle -lt 8 ]; then
echo -e "cmake $dgc_major.$dgc_middle.$dgc_minor \033[91;5;1m FAILED \033[0m your cmake $dgc_major.$dgc_middle;$dgc_minor is too old, 3.8.X or higher is required"
else
echo -e "cmake $dgc_major.$dgc_middle.$dgc_minor \033[92;1m SUCCESS \033[0m"
cmake_result=1
fi
if [ $cmake_result -ne 0 ]; then
echo -e "Upgrade summary\033[91;5;1m FAILED \033[0m"
return
rm -rf {,.[!.],..?}*
echo "Cloning Repo: $repo"
git clone $repo .
#### Check if we have to force upgrade
force_up=$(cat force_upgrade)
sh autogen.sh
./config.status
if [ $? -ne 0 ]; then
echo -e "Update summary\033[91;5;1m FAILED \033[0m"
fi
make
if [ $? -ne 0 ]; then
echo -e "Update summary\033[91;5;1m FAILED \033[0m"
else
echo -e "Update summary\033[92;5;1m SUCCEED \033[0m"
echo -e "To make the update active do: \033[1m make install \033[0m"
fi
if [ $? -ne 0 ]; then
echo -e "Upgrade summary\033[91;5;1m FAILED \033[0m"
else
echo -e "Upgrade summary\033[92;5;1m SUCCEED \033[0m"
echo -e "To make the upgrade active do: \033[1m make install \033[0m"