From a8cb375d460840bbf8c91599d16fc87d9ee8b996 Mon Sep 17 00:00:00 2001 From: eitsupi <50911393+eitsupi@users.noreply.github.com> Date: Tue, 11 Oct 2022 07:33:01 +0900 Subject: Ensure remove apt-update cache at the beginning and end of the scripts (#210) * remove apt lists * bump versions --- src/aws-cli/devcontainer-feature.json | 2 +- src/aws-cli/install.sh | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'src/aws-cli') diff --git a/src/aws-cli/devcontainer-feature.json b/src/aws-cli/devcontainer-feature.json index 11b0bda..5302cf1 100644 --- a/src/aws-cli/devcontainer-feature.json +++ b/src/aws-cli/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "aws-cli", - "version": "1.0.3", + "version": "1.0.4", "name": "AWS CLI", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/aws-cli", "description": "Installs the AWS CLI along with needed dependencies. Useful for base Dockerfiles that often are missing required install dependencies like gpg.", diff --git a/src/aws-cli/install.sh b/src/aws-cli/install.sh index 4ab2234..a8b414e 100755 --- a/src/aws-cli/install.sh +++ b/src/aws-cli/install.sh @@ -9,6 +9,9 @@ set -e +# Clean up +rm -rf /var/lib/apt/lists/* + VERSION=${VERSION:-"latest"} AWSCLI_GPG_KEY=FB5DB77FD5C118B80511ADA8A6310ACC4672475C @@ -71,7 +74,10 @@ apt_get_update() # Checks if packages are installed and installs them if not check_packages() { if ! dpkg -s "$@" > /dev/null 2>&1; then - apt_get_update + 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 "$@" fi } @@ -133,4 +139,7 @@ echo "(*) Installing AWS CLI..." install +# Clean up +rm -rf /var/lib/apt/lists/* + echo "Done!" -- cgit v1.2.3