aboutsummaryrefslogtreecommitdiff
path: root/src/oryx/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/oryx/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/oryx/install.sh')
-rwxr-xr-xsrc/oryx/install.sh20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/oryx/install.sh b/src/oryx/install.sh
index 826d916..f84cf22 100755
--- a/src/oryx/install.sh
+++ b/src/oryx/install.sh
@@ -12,6 +12,9 @@ MICROSOFT_GPG_KEYS_URI="https://packages.microsoft.com/keys/microsoft.asc"
set -eu
+# 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
@@ -53,19 +56,17 @@ function 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
check_packages() {
if ! dpkg -s "$@" > /dev/null 2>&1; then
apt_get_update
- DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends "$@"
-
- # Clean up
- apt-get clean -y
- rm -rf /var/lib/apt/lists/*
+ apt-get -y install --no-install-recommends "$@"
fi
}
@@ -105,6 +106,8 @@ fi
# If we don't already have Oryx installed, install it now.
if oryx --version > /dev/null ; then
echo "oryx is already installed. Skipping installation."
+ # Clean up
+ rm -rf /var/lib/apt/lists/*
exit 0
fi
@@ -182,4 +185,7 @@ if [[ "${DOTNET_INSTALLATION_PACKAGE}" != "" ]]; then
apt purge -yq $DOTNET_INSTALLATION_PACKAGE
fi
+# Clean up
+rm -rf /var/lib/apt/lists/*
+
echo "Done!"