Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions src/conda/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,23 @@ accept_anaconda_tos_if_needed() {

for channel in "https://repo.anaconda.com/pkgs/main" "https://repo.anaconda.com/pkgs/r"; do
echo "Accepting Conda Terms of Service for ${channel}..."
# Accept as root (for install-time commands)
"${CONDA_DIR}/bin/conda" tos accept --override-channels --channel "${channel}"
# Accept as the target user (for runtime usage)
sudo_if "${CONDA_DIR}/bin/conda" tos accept --override-channels --channel "${channel}"
done
}

clean_conda_cache() {
"${CONDA_DIR}/bin/conda" clean --all --yes
find "${CONDA_DIR}" -type f -name '*.pyc' -delete
find "${CONDA_DIR}" -type d -name '__pycache__' -exec rm -rf {} +
rm -rf "${CONDA_DIR}/pkgs/cache" /root/.cache/pip
if [ "${USERNAME}" != "root" ]; then
rm -rf "/home/${USERNAME}/.cache/pip"
fi
}

# Install Conda if it's missing
if ! conda --version &> /dev/null ; then
if ! cat /etc/group | grep -e "^conda:" > /dev/null 2>&1; then
Expand Down Expand Up @@ -145,16 +158,7 @@ if ! conda --version &> /dev/null ; then

find "${CONDA_DIR}" -type d -print0 | xargs -n 1 -0 chmod g+s

# Temporary fixes
# Due to https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23491
install_user_package certifi
# Due to https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-0286 and https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-23931
install_user_package cryptography
# Due to https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-40897
install_user_package setuptools

install_user_package pluggy

clean_conda_cache
fi

# Display a notice on conda when not running in GitHub Codespaces
Expand Down
1 change: 1 addition & 0 deletions test/conda/conda_channel_creation_with_root.sh
16 changes: 14 additions & 2 deletions test/conda/scenarios.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"install_conda": {
"image": "ubuntu:noble",
"image": "mcr.microsoft.com/devcontainers/base:noble",
"features": {
"conda": {
"version": "latest",
Expand All @@ -9,12 +9,24 @@
}
},
"install_conda_package_after_upgrade": {
"image": "ubuntu:noble",
"image": "mcr.microsoft.com/devcontainers/base:noble",
"features": {
"conda": {}
}
},
"conda_channel_creation": {
"image": "mcr.microsoft.com/devcontainers/base:noble",
"features": {
"conda": {}
}
},
"install_conda_package_after_upgrade_with_root": {
"image": "ubuntu:noble",
"features": {
"conda": {}
}
},
"conda_channel_creation_with_root": {
"image": "ubuntu:noble",
"features": {
"conda": {}
Expand Down
Loading