]> git.phdru.name Git - dotfiles.git/commitdiff
Add `lib/config/conda`
authorOleg Broytman <phd@phdru.name>
Sat, 2 Nov 2024 13:34:44 +0000 (16:34 +0300)
committerOleg Broytman <phd@phdru.name>
Sat, 2 Nov 2024 13:34:44 +0000 (16:34 +0300)
Install and configure conda-forge.

lib/config/conda [new file with mode: 0644]

diff --git a/lib/config/conda b/lib/config/conda
new file mode 100644 (file)
index 0000000..a64d3e1
--- /dev/null
@@ -0,0 +1,37 @@
+_conda_variant=miniforge
+if [ $_conda_variant = miniconda ]; then
+   CONDA_ROOT="$HOME"/miniconda3
+   conda_version=24.9.2-0
+elif [ $_conda_variant = miniforge ]; then
+   CONDA_ROOT="$HOME"/miniforge3
+   conda_version=24.9.0-0
+elif [ $_conda_variant = mambaforge ]; then
+   CONDA_ROOT="$HOME"/mambaforge
+   conda_version=24.9.0-0
+fi
+
+if [ ! -d "$CONDA_ROOT" ]; then
+   if [ $_conda_variant = miniconda ]; then
+       wget -N https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh &&
+       sh ./Miniconda3-latest-Linux-x86_64.sh -b -p "$CONDA_ROOT"
+   elif [ $_conda_variant = miniforge ]; then
+       wget -N https://github.com/conda-forge/miniforge/releases/download/"$conda_version"/Miniforge3-"$conda_version"-Linux-x86_64.sh &&
+       sh ./Miniforge3-"$conda_version"-Linux-x86_64.sh -b -p "$CONDA_ROOT"
+   elif [ $_conda_variant = mambaforge ]; then
+       wget -N https://github.com/conda-forge/miniforge/releases/download/"$conda_version"/Mambaforge-"$conda_version"-Linux-x86_64.sh &&
+       sh ./Mambaforge-"$conda_version"-Linux-x86_64.sh -b -p "$CONDA_ROOT"
+   fi
+fi &&
+
+. "$CONDA_ROOT"/etc/profile.d/conda.sh &&
+
+#if [ ! -f "$CONDA_ROOT"/bin/register-python-argcomplete ]; then
+#eval "$($CONDA_ROOT/bin/register-python-argcomplete conda)" &&
+#fi &&
+
+if [ ! -f "$CONDA_ROOT"/etc/profile.d/bash_completion.sh ]; then
+    conda install --name base --yes conda-bash-completion
+fi &&
+. "$CONDA_ROOT"/etc/profile.d/bash_completion.sh &&
+
+unset _conda_variant CONDA_ROOT conda_version