diff --git a/gitlab/functions.sh b/gitlab/functions.sh index 644f8cf7a730939f2f065ad1cfa06f5db38aeaa8..949626a6c269d6cb3ea0d7c312c108b77da40e21 100644 --- a/gitlab/functions.sh +++ b/gitlab/functions.sh @@ -265,7 +265,7 @@ fi # installs a miniconda installation. -# $1: Path to where to install miniconda. The path should not exist. +# $1: Path to where to install miniconda. install_miniconda() { log_info "Installing miniconda in ${1} ..." @@ -285,20 +285,29 @@ install_miniconda() { ls -l miniconda.sh fi - # Check if cache exists and save urls.txt to create a valid cache after conda - # installation override - _urls="${1}/pkgs/urls.txt" - if [ -e ${_urls} ]; then - run_cmd cp ${_urls} ${_urls}.cached + # move cache to a different folder if it exists + if [ -e ${1} ]; then + run_cmd mv ${1} ${1}.cached fi + # # Save urls.txt to create a valid cache after conda + # # installation override + # if [ -e ${_urls} ]; then + # run_cmd cp ${_urls} ${_urls}.cached + # fi + # install miniconda bash miniconda.sh -b -p ${1} - # Reset urls.txt - if [ -e ${_urls}.cached ]; then + # 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 log_info "Merging urls.txt files with cached values..." - cat ${_urls} ${_urls}.cached | sort | uniq > ${_urls} + cat ${_urls} ${_cached_urls} | sort | uniq > ${_urls} fi # List currently available packages on cache