Skip to content
Snippets Groups Projects
install-conda.sh 1.12 KiB
#!/usr/bin/env bash
# Wed 17 Aug 2016 13:50:09 CEST

if [ "${#}" != 1 ]; then
  echo "usage: `basename $0` <prefix>"
  echo "example: `basename $0` /opt/conda"
  exit 1
fi

BASEDIR=$1
CONDA=${BASEDIR}/bin/conda
MINICONDA=${HOME}/Downloads/miniconda.sh

if [ "$(uname)" == "Darwin" ]; then
  ARCH="MacOSX-x86_64"
else
  ARCH="Linux-x86_64"
fi

if [ ! -x ${MINICONDA} ]; then
  mkdir -pv `dirname ${MINICONDA}`
  echo "[>>] Downloading `basename ${MINICONDA}` -> ${MINICONDA}..."
  curl --progress-bar https://repo.continuum.io/miniconda/Miniconda3-latest-${ARCH}.sh --output ${MINICONDA}
  chmod 755 ${MINICONDA}
fi

# Create root environment and add basic channels for conda
if [ ! -x ${CONDA} ]; then
  echo "[>>] Creating root environment and setting basic options..."
  bash ${MINICONDA} -b -p ${BASEDIR}
  ${CONDA} config --set show_channel_urls True
  ${CONDA} config --add channels conda-forge
fi

echo "[>>] Updating conda in the root environment..."
${CONDA} update --yes -n root conda

echo "[>>] Installing conda-smithy..."
${CONDA} install --yes -n root conda-smithy

echo "You need to manually install https://hub.github.com/ too ..."