From d6cb85e98d18adc2987896be019696d8b5a1e669 Mon Sep 17 00:00:00 2001
From: Pietro Incardona <incardon@mpi-cbg.de>
Date: Tue, 18 Dec 2018 18:44:40 +0100
Subject: [PATCH] Fixing for med scal script

---
 build.sh | 10 ++++------
 run.sh   |  6 +++++-
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/build.sh b/build.sh
index bf6365ff7..42dc7b0b6 100755
--- a/build.sh
+++ b/build.sh
@@ -8,13 +8,16 @@ target=$3
 comp_type=$4
 branch=$5
 
+if [ x"$branch" == x"" ]; then
+  branch=$(git ls-remote --heads origin | grep $(git rev-parse HEAD) | cut -d / -f 3)
+fi
+
 echo "Directory: $workspace"
 echo "Machine: $hostname"
 echo "make target: $target"
 echo "compilation type: $comp_type"
 echo "Branch name: $branch"
 
-rm -rf $HOME/openfpm_dependencies/openfpm_pdata/0
 
 if [ x"$hostname" == x"cifarm-centos-node.mpi-cbg.de"  ]; then
 	./install_MPI_mpich.sh $HOME/openfpm_dependencies/openfpm_io/$branch/ 4
@@ -32,11 +35,6 @@ if [ x"$hostname" == x"cifarm-mac-node.mpi-cbg.de"  ]; then
         echo 4 > $HOME/openfpm_dependencies/openfpm_io/$branch/MPI/version
 fi
 
-
-if [ x"$branch" == x"" ]; then
-  branch=$(git ls-remote --heads origin | grep $(git rev-parse HEAD) | cut -d / -f 3)
-fi
-
 #### If you have a dep_dir file change the branch name to the dep_dir
 
 dep_dir=$(cat dep_dir)
diff --git a/run.sh b/run.sh
index 1bbb15d97..9f1c3bd12 100755
--- a/run.sh
+++ b/run.sh
@@ -3,12 +3,16 @@
 # Make a directory in /tmp/OpenFPM_pdata
 
 workspace=$1
-hostname=$2
+hostname=$(hostname)
 nproc=$3
 ntask_per_node=$5
 nodes=$4
 branch=$6
 
+if [ x"$branch" == x"" ]; then
+  branch=$(git ls-remote --heads origin | grep $(git rev-parse HEAD) | cut -d / -f 3)
+fi
+
 echo "Directory: workspace"
 echo "Machine: $hostname"
 echo "Num of processors: $nproc"
-- 
GitLab