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/php | |
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/php')
-rw-r--r-- | src/php/devcontainer-feature.json | 2 | ||||
-rwxr-xr-x | src/php/install.sh | 11 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/php/devcontainer-feature.json b/src/php/devcontainer-feature.json index 418162f..294c687 100644 --- a/src/php/devcontainer-feature.json +++ b/src/php/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "php", - "version": "1.0.6", + "version": "1.0.7", "name": "PHP", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/php", "options": { 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!" |