aboutsummaryrefslogtreecommitdiff
path: root/src/github-cli/install.sh
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/github-cli/install.sh
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/github-cli/install.sh')
-rwxr-xr-xsrc/github-cli/install.sh15
1 files changed, 11 insertions, 4 deletions
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/*