From eb5c16f0962fefeb85aa52f66f380b9c1704161e Mon Sep 17 00:00:00 2001
From: Pietro Incardona <incardon@mpi-cbg.de>
Date: Tue, 21 Feb 2017 19:00:12 +0100
Subject: [PATCH] Fixing update and upgrade openfpm

---
 install                |  5 ++---
 script/update_openfpm  |  7 +++---
 script/upgrade_openfpm | 48 ------------------------------------------
 3 files changed, 6 insertions(+), 54 deletions(-)
 delete mode 100755 script/upgrade_openfpm

diff --git a/install b/install
index cda09e31..ea3344d1 100755
--- a/install
+++ b/install
@@ -8,7 +8,6 @@ source script/remove_old
 source script/set_mpi
 source script/conf_PETSC
 source script/update_openfpm
-source script/upgrade_openfpm
 
 ## Check that your home is not empty
 
@@ -87,12 +86,12 @@ if [ $update_openfpm -eq 1 -a  $upgrade_openfpm -eq 1 ]; then
 fi
 
 if [ $update_openfpm -eq 1 ]; then
-	update_openfpm
+	update_openfpm update
 	exit 0
 fi
 
 if [ $upgrade_openfpm -eq 1 ]; then
-	upgrade_openfpm
+	upgrade_openfpm upgrade
 	exit 0
 fi
 
diff --git a/script/update_openfpm b/script/update_openfpm
index db7a6c57..1d58478f 100755
--- a/script/update_openfpm
+++ b/script/update_openfpm
@@ -12,7 +12,7 @@ function update_openfpm()
 
   ## Get the name of the updating branch
 
-  url_update=$(cat update)
+  url_update=$(cat $1)
   echo "Checking for update from $url_update"
   rm tmp_brc
   wget -O tmp_brc $url_update
@@ -25,7 +25,7 @@ function update_openfpm()
 
   actual_branch=$(git branch | grep \* | cut -d ' ' -f2)
 
-  if [ x"$branch" == x"actual_branch" ]; then
+  if [ x"$branch" == x"$actual_branch" ]; then
 
    git remote update
    git status -uno | grep "nothing to commit"
@@ -36,7 +36,7 @@ function update_openfpm()
     fi
   fi
 
-#  git stash
+#  git stash -u
 #  git submodule foreach 'git stash'
 
 #  git pull origin
@@ -44,6 +44,7 @@ function update_openfpm()
 #  git submodule update
 
 #  sh autogen.sh
+#  make clean
 #  make install
 
 }
diff --git a/script/upgrade_openfpm b/script/upgrade_openfpm
deleted file mode 100755
index fd9ff858..00000000
--- a/script/upgrade_openfpm
+++ /dev/null
@@ -1,48 +0,0 @@
-#! /bin/bash
-
-source script/show_solutions
-
-function upgrade_openfpm()
-{
-  echo -e "\033[1;5;31m WARNING: the update will destroy any changes in the OpenFPM source code  \033[0m"
-  
-  commands[0]="Continue"
-  commands[0]="${commands[@]}"
-  possible_solutions "${commands[@]}"
-
-  ## Get the name of the updating branch
-
-  url_upgrade=$(cat upgrade)
-  echo "Checking for update from $url_update"
-  branch=$(wget $url_upgrade)
-  if [ x"$branch" == x"" ]; then
-    echo -e "\033[1m There are no-updates \033[0m"
-    return
-  fi
-
-  actual_branch=git branch | grep \* | cut -d ' ' -f2
-
-  if [ x"$branch" == x"actual_branch" ]; then
-
-#   git remote update
-#   git status -uno | grep "nothing to commit"
-
-    if [ $? -eq 0 ]; then
-      echo -e "\033[1m There are no-updates \033[0m"
-      return
-    fi
-  fi
-
-#  git stash
-#  git submodule foreach 'git stash'
-
-#  git pull origin
-#  git checkout $branch
-#  git submodule update
-
-#  sh autogen.sh
-#  make install
-
-}
-
-
-- 
GitLab