From 59ca7cb05d2c176eeb80f8e69d6c8866c4f18697 Mon Sep 17 00:00:00 2001
From: Thomas Juerges <4-jurges@users.noreply.git.astron.nl>
Date: Tue, 18 May 2021 17:26:46 +0200
Subject: [PATCH] L2SS-218 Instead of deleting the tango dir, first move it out
 of the way

---
 bootstrap/sbin/rebuild_system_from_scratch.sh | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/bootstrap/sbin/rebuild_system_from_scratch.sh b/bootstrap/sbin/rebuild_system_from_scratch.sh
index 3e2997d69..9d5502ef1 100755
--- a/bootstrap/sbin/rebuild_system_from_scratch.sh
+++ b/bootstrap/sbin/rebuild_system_from_scratch.sh
@@ -7,6 +7,9 @@ if [ ! -d ${HOME_DIR}/bootstrap ]; then
     exit 1
 fi
 
+# Save for the moment when tango will be cloned.
+OLD_HOME_DIR=${HOME_DIR}.old
+
 trap ' exit ${?} ' ABRT EXIT HUP INT TERM QUIT ERR
 
 
@@ -22,9 +25,9 @@ function build_lofar_images()
     popd
 }
 
-function remove_tango_dir()
+function move_tango_dir_out_of_the_way()
 {
-    rm -rf ${HOME_DIR}
+    mv ${HOME_DIR} ${OLD_HOME_DIR}
 }
 
 function remove_images()
@@ -90,9 +93,10 @@ stop_images
 # Clean out the Docker volumes.
 clean_images
 
-# Delete the tango repo dir.  Notice that this also deletes the bootstrap dir
-# which contains this and the helper scripts.
-remove_tango_dir
+# Move the tango repo dir out of the way.
+echo "-> Moving the tango directory ${HOME_DIR} out of the way..."
+move_tango_dir_out_of_the_way
+echo -e "\tDone.\n"
 
 # Therefore, since the tango/boostrap dir is now gone, pull the repo first
 # and then continue.
-- 
GitLab