#! /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 url_update=$(cat $1) echo "Checking for update from $url_update" rm tmp_brc wget -O tmp_brc $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 set-url origin "$repo" 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 fi dir_prev_inst=$(cat dependencies_dir) for_opt=$(cat foward_options) if [ x"$dir_prev_inst" != x"" ]; then dir_prev_inst="-i $dir_prev_inst" fi if [ x"$for_opt" != x"" ]; then for_opt="-c $for_opt" fi git stash -u git submodule foreach 'git stash' git pull origin git submodule update #### Check if we have to force upgrade force_up=$(cat force_upgrade) if [ x"$1" == x"update" -a x"$force_up" == x"" ]; then source $HOME/openfpm_vars 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 else #### Remove .deps for fresh install ./install $dir_prev_inst $for_opt 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" rm force_upgrade fi fi ## end }