aboutsummaryrefslogtreecommitdiff
path: root/src/php/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/php/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/php/install.sh')
-rwxr-xr-xsrc/php/install.sh11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/php/install.sh b/src/php/install.sh
index fdc374a..70b63da 100755
--- a/src/php/install.sh
+++ b/src/php/install.sh
@@ -8,6 +8,9 @@
set -eux
+# Clean up
+rm -rf /var/lib/apt/lists/*
+
VERSION=${VERSION:-"latest"}
INSTALL_COMPOSER=${INSTALLCOMPOSER:-"true"}
OVERRIDE_DEFAULT_VERSION=${OVERRIDEDEFAULTVERSION:-"true"}
@@ -73,7 +76,10 @@ updaterc() {
# Checks if packages are installed and installs them if not
check_packages() {
if ! dpkg -s "$@" > /dev/null 2>&1; then
- apt-get update
+ if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
+ echo "Running apt-get update..."
+ apt-get update -y
+ fi
apt-get -y install --no-install-recommends "$@"
fi
}
@@ -222,4 +228,7 @@ chown -R "${USERNAME}:php" "${PHP_DIR}"
chmod -R g+r+w "${PHP_DIR}"
find "${PHP_DIR}" -type d -print0 | xargs -n 1 -0 chmod g+s
+# Clean up
+rm -rf /var/lib/apt/lists/*
+
echo "Done!"