aboutsummaryrefslogtreecommitdiff
path: root/src/github-cli
diff options
context:
space:
mode:
Diffstat (limited to 'src/github-cli')
-rw-r--r--src/github-cli/devcontainer-feature.json2
-rwxr-xr-xsrc/github-cli/install.sh15
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/*