diff options
author | eitsupi <50911393+eitsupi@users.noreply.github.com> | 2022-10-11 01:33:01 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-11 01:33:01 +0300 |
commit | a8cb375d460840bbf8c91599d16fc87d9ee8b996 (patch) | |
tree | 73dd647775325582c17a452816457f5cec82004d /src/github-cli | |
parent | 065b5ec9e19d4f289a070c3d5337696fd2394dc0 (diff) |
Ensure remove apt-update cache at the beginning and end of the scripts (#210)
* remove apt lists
* bump versions
Diffstat (limited to 'src/github-cli')
-rw-r--r-- | src/github-cli/devcontainer-feature.json | 2 | ||||
-rwxr-xr-x | src/github-cli/install.sh | 15 |
2 files changed, 12 insertions, 5 deletions
diff --git a/src/github-cli/devcontainer-feature.json b/src/github-cli/devcontainer-feature.json index 597291d..3108a69 100644 --- a/src/github-cli/devcontainer-feature.json +++ b/src/github-cli/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "github-cli", - "version": "1.0.4", + "version": "1.0.5", "name": "GitHub CLI", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/github-cli", "description": "Installs the GitHub CLI. Auto-detects latest version and installs needed dependencies.", diff --git a/src/github-cli/install.sh b/src/github-cli/install.sh index 22ed040..5f59d01 100755 --- a/src/github-cli/install.sh +++ b/src/github-cli/install.sh @@ -17,6 +17,9 @@ keyserver hkp://keyserver.pgp.com" set -e +# 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 @@ -141,8 +144,10 @@ receive_gpg_keys() { apt_get_update() { - echo "Running apt-get update..." - apt-get update -y + if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then + echo "Running apt-get update..." + apt-get update -y + fi } # Checks if packages are installed and installs them if not @@ -209,8 +214,7 @@ export DEBIAN_FRONTEND=noninteractive # Install curl, apt-transport-https, curl, gpg, or dirmngr, git if missing check_packages curl ca-certificates apt-transport-https dirmngr gnupg2 if ! type git > /dev/null 2>&1; then - apt_get_update - apt-get -y install --no-install-recommends git + check_packages git fi # Soft version matching @@ -236,3 +240,6 @@ else rm -rf "/tmp/gh/gnupg" echo "Done!" fi + +# Clean up +rm -rf /var/lib/apt/lists/* |