diff options
author | Samruddhi Khandale <skhandale@microsoft.com> | 2023-01-10 01:49:43 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-10 01:49:43 +0300 |
commit | 59fa3e3c21fd2c896da2d3272604509ea9a55a91 (patch) | |
tree | 3f5fa14326b0fbd514a195472615dce5f78656d6 /src/conda/install.sh | |
parent | 04143e31ff4ef64f44603492a4052fe7b03de7bd (diff) |
Conda: Update 'certifi' due to CVE-2022-23491 (#383)
Diffstat (limited to 'src/conda/install.sh')
-rw-r--r-- | src/conda/install.sh | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/conda/install.sh b/src/conda/install.sh index 6e90882..55b280c 100644 --- a/src/conda/install.sh +++ b/src/conda/install.sh @@ -61,6 +61,20 @@ check_packages() { fi } +sudo_if() { + COMMAND="$*" + if [ "$(id -u)" -eq 0 ] && [ "$USERNAME" != "root" ]; then + su - "$USERNAME" -c "$COMMAND" + else + $COMMAND + fi +} + +install_user_package() { + PACKAGE="$1" + sudo_if "${CONDA_DIR}/bin/python3" -m pip install --user --upgrade "$PACKAGE" +} + # Install Conda if it's missing if ! conda --version &> /dev/null ; then if ! cat /etc/group | grep -e "^conda:" > /dev/null 2>&1; then @@ -99,6 +113,9 @@ if ! conda --version &> /dev/null ; then chmod -R g+r+w "${CONDA_DIR}" find "${CONDA_DIR}" -type d -print0 | xargs -n 1 -0 chmod g+s + + # Temporary due to https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23491 + install_user_package certifi fi # Display a notice on conda when not running in GitHub Codespaces |