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/java/install.sh | |
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/java/install.sh')
-rwxr-xr-x | src/java/install.sh | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/java/install.sh b/src/java/install.sh index 838f782..d2f735d 100755 --- a/src/java/install.sh +++ b/src/java/install.sh @@ -24,6 +24,9 @@ ADDITIONAL_VERSIONS=${ADDITIONALVERSIONS:-""} 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 @@ -65,8 +68,10 @@ updaterc() { 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 @@ -176,4 +181,7 @@ if [[ "${INSTALL_MAVEN}" = "true" ]] && ! mvn --version > /dev/null; then sdk_install maven latest fi +# Clean up +rm -rf /var/lib/apt/lists/* + echo "Done!" |