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/github-cli/install.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/github-cli/install.sh') 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/* -- cgit v1.2.3