aboutsummaryrefslogtreecommitdiff
path: root/src/go/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/go/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/go/install.sh')
-rwxr-xr-xsrc/go/install.sh15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/go/install.sh b/src/go/install.sh
index 86bdbc6..9bb8047 100755
--- a/src/go/install.sh
+++ b/src/go/install.sh
@@ -19,6 +19,9 @@ GO_GPG_KEY_URI="https://dl.google.com/linux/linux_signing_key.pub"
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
@@ -97,8 +100,10 @@ get_common_setting() {
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
@@ -114,8 +119,7 @@ export DEBIAN_FRONTEND=noninteractive
# Install curl, tar, git, other dependencies if missing
check_packages curl ca-certificates gnupg2 tar g++ gcc libc6-dev make pkg-config
if ! type git > /dev/null 2>&1; then
- apt_get_update
- apt-get -y install --no-install-recommends git
+ check_packages git
fi
# Get closest match for version number specified
@@ -225,4 +229,7 @@ chmod -R g+r+w "${TARGET_GOROOT}" "${TARGET_GOPATH}"
find "${TARGET_GOROOT}" -type d -print0 | xargs -n 1 -0 chmod g+s
find "${TARGET_GOPATH}" -type d -print0 | xargs -n 1 -0 chmod g+s
+# Clean up
+rm -rf /var/lib/apt/lists/*
+
echo "Done!"