diff --git a/gitlab/functions.sh b/gitlab/functions.sh index 6ab06be69f310db506faffdf23ca37b0588551af..cf1fde30cf6200288f5214d4c355c2d9ebf404bc 100644 --- a/gitlab/functions.sh +++ b/gitlab/functions.sh @@ -268,12 +268,14 @@ fi # $1: Path to where to install miniconda. The path should not exist. install_miniconda() { log_info "Installing miniconda in ${1} ..." + # Download the latest conda installation script if [ "${OSNAME}" == "macosx" ]; then object=https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh else object=https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh fi + # check if miniconda.sh exists if [ ! -e miniconda.sh ]; then log_info "Downloading latest miniconda3 installer..." @@ -282,21 +284,27 @@ install_miniconda() { log_info "Re-using cached miniconda3 installer..." 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 fi + + # install miniconda bash miniconda.sh -b -p ${1} + # Reset urls.txt if [ -e ${_urls}.cached ]; then log_info "Merging urls.txt files with cached values..." cat ${_urls} ${_urls}.cached | sort | uniq > ${_urls} fi + # List currently available packages on cache run_cmd ls -l ${1}/pkgs/ run_cmd cat ${1}/pkgs/urls.txt + hash -r } @@ -323,7 +331,7 @@ if [ -z "${CONDA_FOLDER}" ]; then fi # check if a conda installation exists. Otherwise, install one: -if [ ! -e $1 ]; then +if [ ! -e ${CONDA_FOLDER} ]; then install_miniconda ${CONDA_FOLDER} fi