aboutsummaryrefslogtreecommitdiff
path: root/src/conda
diff options
context:
space:
mode:
authoreitsupi <50911393+eitsupi@users.noreply.github.com>2022-10-11 01:33:01 +0300
committerGitHub <noreply@github.com>2022-10-11 01:33:01 +0300
commita8cb375d460840bbf8c91599d16fc87d9ee8b996 (patch)
tree73dd647775325582c17a452816457f5cec82004d /src/conda
parent065b5ec9e19d4f289a070c3d5337696fd2394dc0 (diff)
Ensure remove apt-update cache at the beginning and end of the scripts (#210)
* remove apt lists * bump versions
Diffstat (limited to 'src/conda')
-rw-r--r--src/conda/devcontainer-feature.json2
-rw-r--r--src/conda/install.sh16
2 files changed, 12 insertions, 6 deletions
diff --git a/src/conda/devcontainer-feature.json b/src/conda/devcontainer-feature.json
index 1aa69a2..2c9c769 100644
--- a/src/conda/devcontainer-feature.json
+++ b/src/conda/devcontainer-feature.json
@@ -1,6 +1,6 @@
{
"id": "conda",
- "version": "1.0.3",
+ "version": "1.0.4",
"name": "Conda",
"description": "A cross-platform, language-agnostic binary package manager",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/conda",
diff --git a/src/conda/install.sh b/src/conda/install.sh
index 89d2fcb..9b51bbd 100644
--- a/src/conda/install.sh
+++ b/src/conda/install.sh
@@ -14,6 +14,9 @@ CONDA_DIR="/opt/conda"
set -eux
export DEBIAN_FRONTEND=noninteractive
+# Clean up
+rm -rf /var/lib/apt/lists/*
+
if [ "$(id -u)" -ne 0 ]; then
echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.'
exit 1
@@ -50,12 +53,11 @@ fi
# Checks if packages are installed and installs them if not
check_packages() {
if ! dpkg -s "$@" > /dev/null 2>&1; then
- apt-get update -y
+ if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
+ echo "Running apt-get update..."
+ apt-get update -y
+ fi
apt-get -y install --no-install-recommends "$@"
-
- # Clean up
- apt-get clean -y
- rm -rf /var/lib/apt/lists/*
fi
}
@@ -73,6 +75,7 @@ if ! conda --version &> /dev/null ; then
curl -sS https://repo.anaconda.com/pkgs/misc/gpgkeys/anaconda.asc | gpg --dearmor > /usr/share/keyrings/conda-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/conda-archive-keyring.gpg] https://repo.anaconda.com/pkgs/misc/debrepo/conda stable main" > /etc/apt/sources.list.d/conda.list
+ apt-get update -y
CONDA_PKG="conda=${VERSION}-0"
if [ "${VERSION}" = "latest" ]; then
@@ -123,4 +126,7 @@ if [ -f "/etc/bash.bashrc" ]; then
echo "${notice_script}" | tee -a /etc/bash.bashrc
fi
+# Clean up
+rm -rf /var/lib/apt/lists/*
+
echo "Done!"