From 7eabdbf791a68feebdb76f262608163389309003 Mon Sep 17 00:00:00 2001 From: Michele Locati Date: Fri, 13 Aug 2021 08:54:09 +0200 Subject: [PATCH] Let users keep the system packages cache --- README.md | 7 ++++--- install-php-extensions | 23 ++++++++++++++--------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 4a85148..84e1275 100644 --- a/README.md +++ b/README.md @@ -273,12 +273,13 @@ zlib ## Configuration -The compilation of some extensions may be fine-tuned to better fit your needs by using environment variables: +You can configure the behavior of the script, as well as fine-tune some extensions in order fit your needs, by using environment variables: | Extension | Environment variable | Description | |---|---|---| -| lzf | IPE_LZF_BETTERCOMPRESSION=1 | By default `install-php-extensions` compiles the `lzf` extension to prefer speed over size; you can use this environment variable to compile it preferring size over speed | -| event | IPE_EVENT_NAMESPACE=... | By default the `event` classes are defined in the root namespace. You can use this environment variable to specify a custom namespace | +| | `IPE_KEEP_SYSPKG_CACHE=1` | By default the script will clear the apt/apk/pear cache in order to save disk space. You can disable it by setting this environment variable | +| lzf | `IPE_LZF_BETTERCOMPRESSION=1` | By default `install-php-extensions` compiles the `lzf` extension to prefer speed over size; you can use this environment variable to compile it preferring size over speed | +| event | `IPE_EVENT_NAMESPACE=`... | By default the `event` classes are defined in the root namespace. You can use this environment variable to specify a custom namespace | ## Special requirements diff --git a/install-php-extensions b/install-php-extensions index e41e655..9f4e474 100755 --- a/install-php-extensions +++ b/install-php-extensions @@ -2725,20 +2725,25 @@ cleanup() { ;; esac fi - case "$DISTRO" in - alpine) - rm -rf /var/cache/apk/* - ;; - debian) - rm -rf /var/lib/apt/lists/* - ;; - esac docker-php-source delete - rm -rf /tmp/pear rm -rf /tmp/src rm -rf /tmp/pickle rm -rf /tmp/pickle.tmp rm -rf "$CONFIGURE_FILE" + case "${IPE_KEEP_SYSPKG_CACHE:-}" in + 1 | y* | Y*) ;; + *) + case "$DISTRO" in + alpine) + rm -rf /var/cache/apk/* + ;; + debian) + rm -rf /var/lib/apt/lists/* + ;; + esac + rm -rf /tmp/pear + ;; + esac } resetIFS