From e7a10f012c32a3ea3ac2d15327c0b4d7f488e028 Mon Sep 17 00:00:00 2001
From: Amir MOHAMMADI <amir.mohammadi@idiap.ch>
Date: Fri, 22 Sep 2017 14:10:28 +0200
Subject: [PATCH] Delete extra folder after cache is restored

---
 gitlab/functions.sh | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/gitlab/functions.sh b/gitlab/functions.sh
index 9ccd6f1..fa1df62 100644
--- a/gitlab/functions.sh
+++ b/gitlab/functions.sh
@@ -300,19 +300,19 @@ install_miniconda() {
   bash miniconda.sh -b -p ${1}
 
   # Put back cache and merge urls.txt
-  if [ -e ${1}.cached ]; then
-    run_cmd mv -n ${1}.cached/pkgs/*.tar.bz2 ${1}/pkgs/
-  fi
   _cached_urls="${1}.cached/pkgs/urls.txt"
   _urls="${1}/pkgs/urls.txt"
-  if [ -e ${_cached_urls} ]; then
+  if [ -e ${1}.cached ]; then
     log_info "Merging urls.txt files with cached values..."
+    mv -n ${1}.cached/pkgs/*.tar.bz2 ${1}/pkgs/
     cat ${_urls} ${_cached_urls} | sort | uniq > ${_urls}
+    # remove the backup cache folder
+    rm -rf ${1}.cached
   fi
 
   # List currently available packages on cache
-  run_cmd ls -l ${1}/pkgs/
-  run_cmd cat ${1}/pkgs/urls.txt
+  # run_cmd ls -l ${1}/pkgs/
+  # run_cmd cat ${1}/pkgs/urls.txt
 
   hash -r
 }
-- 
GitLab