diff --git a/2021.09/apache/Dockerfile b/2021.09/apache/Dockerfile index d10b6b3..1c44e67 100644 --- a/2021.09/apache/Dockerfile +++ b/2021.09/apache/Dockerfile @@ -95,7 +95,7 @@ RUN set -ex; \ # pecl will claim success even if one install fails, so we need to perform each install separately pecl install apcu-5.1.21; \ pecl install memcached-3.1.5; \ - pecl install redis-5.3.6; \ + pecl install redis-5.3.7; \ pecl install imagick-3.7.0; \ \ docker-php-ext-enable \ diff --git a/2021.09/apache/entrypoint.sh b/2021.09/apache/entrypoint.sh index bb723fb..87dcbe2 100755 --- a/2021.09/apache/entrypoint.sh +++ b/2021.09/apache/entrypoint.sh @@ -3,11 +3,11 @@ set -eu # run an command with the www-data user run_as() { + set -- sh -c "cd /var/www/html; $*" if [ "$(id -u)" -eq 0 ]; then - su -p www-data -s /bin/sh -c "$1" - else - sh -c "$1" + set -- gosu www-data "$@" fi + "$@" } # checks if the the first parameter is greater than the second parameter @@ -20,11 +20,11 @@ version_greater() { # (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of # "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) file_env() { - local var="$1" - local fileVar="${var}_FILE" - local def="${2:-}" - local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") - local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") + var="$1" + fileVar="${var}_FILE" + def="${2:-}" + varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") + fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then echo >&2 "error: both $var and $fileVar are set (but are exclusive)" exit 1 @@ -49,7 +49,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then file_env REDIS_PW echo 'session.save_handler = redis' # check if redis host is an unix socket path - if [ "${REDIS_HOST:0:1}" = "/" ]; then + if expr "${REDIS_HOST}" : "/" 1>/dev/null; then if [ -n "${REDIS_PW+x}" ]; then echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_PW}\"" else diff --git a/2021.09/fpm-alpine/Dockerfile b/2021.09/fpm-alpine/Dockerfile index df75eaa..a297278 100644 --- a/2021.09/fpm-alpine/Dockerfile +++ b/2021.09/fpm-alpine/Dockerfile @@ -81,7 +81,7 @@ RUN set -ex; \ # pecl will claim success even if one install fails, so we need to perform each install separately pecl install APCu-5.1.21; \ pecl install memcached-3.1.5; \ - pecl install redis-5.3.6; \ + pecl install redis-5.3.7; \ pecl install imagick-3.7.0; \ \ docker-php-ext-enable \ diff --git a/2021.09/fpm-alpine/entrypoint.sh b/2021.09/fpm-alpine/entrypoint.sh index bb723fb..87dcbe2 100755 --- a/2021.09/fpm-alpine/entrypoint.sh +++ b/2021.09/fpm-alpine/entrypoint.sh @@ -3,11 +3,11 @@ set -eu # run an command with the www-data user run_as() { + set -- sh -c "cd /var/www/html; $*" if [ "$(id -u)" -eq 0 ]; then - su -p www-data -s /bin/sh -c "$1" - else - sh -c "$1" + set -- gosu www-data "$@" fi + "$@" } # checks if the the first parameter is greater than the second parameter @@ -20,11 +20,11 @@ version_greater() { # (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of # "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) file_env() { - local var="$1" - local fileVar="${var}_FILE" - local def="${2:-}" - local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") - local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") + var="$1" + fileVar="${var}_FILE" + def="${2:-}" + varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") + fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then echo >&2 "error: both $var and $fileVar are set (but are exclusive)" exit 1 @@ -49,7 +49,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then file_env REDIS_PW echo 'session.save_handler = redis' # check if redis host is an unix socket path - if [ "${REDIS_HOST:0:1}" = "/" ]; then + if expr "${REDIS_HOST}" : "/" 1>/dev/null; then if [ -n "${REDIS_PW+x}" ]; then echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_PW}\"" else diff --git a/2021.09/fpm/Dockerfile b/2021.09/fpm/Dockerfile index 0421b17..8f7395d 100644 --- a/2021.09/fpm/Dockerfile +++ b/2021.09/fpm/Dockerfile @@ -95,7 +95,7 @@ RUN set -ex; \ # pecl will claim success even if one install fails, so we need to perform each install separately pecl install apcu-5.1.21; \ pecl install memcached-3.1.5; \ - pecl install redis-5.3.6; \ + pecl install redis-5.3.7; \ pecl install imagick-3.7.0; \ \ docker-php-ext-enable \ diff --git a/2021.09/fpm/entrypoint.sh b/2021.09/fpm/entrypoint.sh index bb723fb..87dcbe2 100755 --- a/2021.09/fpm/entrypoint.sh +++ b/2021.09/fpm/entrypoint.sh @@ -3,11 +3,11 @@ set -eu # run an command with the www-data user run_as() { + set -- sh -c "cd /var/www/html; $*" if [ "$(id -u)" -eq 0 ]; then - su -p www-data -s /bin/sh -c "$1" - else - sh -c "$1" + set -- gosu www-data "$@" fi + "$@" } # checks if the the first parameter is greater than the second parameter @@ -20,11 +20,11 @@ version_greater() { # (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of # "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) file_env() { - local var="$1" - local fileVar="${var}_FILE" - local def="${2:-}" - local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") - local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") + var="$1" + fileVar="${var}_FILE" + def="${2:-}" + varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") + fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then echo >&2 "error: both $var and $fileVar are set (but are exclusive)" exit 1 @@ -49,7 +49,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then file_env REDIS_PW echo 'session.save_handler = redis' # check if redis host is an unix socket path - if [ "${REDIS_HOST:0:1}" = "/" ]; then + if expr "${REDIS_HOST}" : "/" 1>/dev/null; then if [ -n "${REDIS_PW+x}" ]; then echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_PW}\"" else diff --git a/2022.02/apache/Dockerfile b/2022.02/apache/Dockerfile index 60a0b8e..2a150a7 100644 --- a/2022.02/apache/Dockerfile +++ b/2022.02/apache/Dockerfile @@ -95,7 +95,7 @@ RUN set -ex; \ # pecl will claim success even if one install fails, so we need to perform each install separately pecl install apcu-5.1.21; \ pecl install memcached-3.1.5; \ - pecl install redis-5.3.6; \ + pecl install redis-5.3.7; \ pecl install imagick-3.7.0; \ \ docker-php-ext-enable \ diff --git a/2022.02/apache/entrypoint.sh b/2022.02/apache/entrypoint.sh index bb723fb..87dcbe2 100755 --- a/2022.02/apache/entrypoint.sh +++ b/2022.02/apache/entrypoint.sh @@ -3,11 +3,11 @@ set -eu # run an command with the www-data user run_as() { + set -- sh -c "cd /var/www/html; $*" if [ "$(id -u)" -eq 0 ]; then - su -p www-data -s /bin/sh -c "$1" - else - sh -c "$1" + set -- gosu www-data "$@" fi + "$@" } # checks if the the first parameter is greater than the second parameter @@ -20,11 +20,11 @@ version_greater() { # (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of # "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) file_env() { - local var="$1" - local fileVar="${var}_FILE" - local def="${2:-}" - local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") - local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") + var="$1" + fileVar="${var}_FILE" + def="${2:-}" + varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") + fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then echo >&2 "error: both $var and $fileVar are set (but are exclusive)" exit 1 @@ -49,7 +49,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then file_env REDIS_PW echo 'session.save_handler = redis' # check if redis host is an unix socket path - if [ "${REDIS_HOST:0:1}" = "/" ]; then + if expr "${REDIS_HOST}" : "/" 1>/dev/null; then if [ -n "${REDIS_PW+x}" ]; then echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_PW}\"" else diff --git a/2022.02/fpm-alpine/Dockerfile b/2022.02/fpm-alpine/Dockerfile index 3862c63..a13605b 100644 --- a/2022.02/fpm-alpine/Dockerfile +++ b/2022.02/fpm-alpine/Dockerfile @@ -81,7 +81,7 @@ RUN set -ex; \ # pecl will claim success even if one install fails, so we need to perform each install separately pecl install APCu-5.1.21; \ pecl install memcached-3.1.5; \ - pecl install redis-5.3.6; \ + pecl install redis-5.3.7; \ pecl install imagick-3.7.0; \ \ docker-php-ext-enable \ diff --git a/2022.02/fpm-alpine/entrypoint.sh b/2022.02/fpm-alpine/entrypoint.sh index bb723fb..87dcbe2 100755 --- a/2022.02/fpm-alpine/entrypoint.sh +++ b/2022.02/fpm-alpine/entrypoint.sh @@ -3,11 +3,11 @@ set -eu # run an command with the www-data user run_as() { + set -- sh -c "cd /var/www/html; $*" if [ "$(id -u)" -eq 0 ]; then - su -p www-data -s /bin/sh -c "$1" - else - sh -c "$1" + set -- gosu www-data "$@" fi + "$@" } # checks if the the first parameter is greater than the second parameter @@ -20,11 +20,11 @@ version_greater() { # (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of # "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) file_env() { - local var="$1" - local fileVar="${var}_FILE" - local def="${2:-}" - local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") - local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") + var="$1" + fileVar="${var}_FILE" + def="${2:-}" + varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") + fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then echo >&2 "error: both $var and $fileVar are set (but are exclusive)" exit 1 @@ -49,7 +49,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then file_env REDIS_PW echo 'session.save_handler = redis' # check if redis host is an unix socket path - if [ "${REDIS_HOST:0:1}" = "/" ]; then + if expr "${REDIS_HOST}" : "/" 1>/dev/null; then if [ -n "${REDIS_PW+x}" ]; then echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_PW}\"" else diff --git a/2022.02/fpm/Dockerfile b/2022.02/fpm/Dockerfile index bb581e5..54fb188 100644 --- a/2022.02/fpm/Dockerfile +++ b/2022.02/fpm/Dockerfile @@ -95,7 +95,7 @@ RUN set -ex; \ # pecl will claim success even if one install fails, so we need to perform each install separately pecl install apcu-5.1.21; \ pecl install memcached-3.1.5; \ - pecl install redis-5.3.6; \ + pecl install redis-5.3.7; \ pecl install imagick-3.7.0; \ \ docker-php-ext-enable \ diff --git a/2022.02/fpm/entrypoint.sh b/2022.02/fpm/entrypoint.sh index bb723fb..87dcbe2 100755 --- a/2022.02/fpm/entrypoint.sh +++ b/2022.02/fpm/entrypoint.sh @@ -3,11 +3,11 @@ set -eu # run an command with the www-data user run_as() { + set -- sh -c "cd /var/www/html; $*" if [ "$(id -u)" -eq 0 ]; then - su -p www-data -s /bin/sh -c "$1" - else - sh -c "$1" + set -- gosu www-data "$@" fi + "$@" } # checks if the the first parameter is greater than the second parameter @@ -20,11 +20,11 @@ version_greater() { # (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of # "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) file_env() { - local var="$1" - local fileVar="${var}_FILE" - local def="${2:-}" - local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") - local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") + var="$1" + fileVar="${var}_FILE" + def="${2:-}" + varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") + fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then echo >&2 "error: both $var and $fileVar are set (but are exclusive)" exit 1 @@ -49,7 +49,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then file_env REDIS_PW echo 'session.save_handler = redis' # check if redis host is an unix socket path - if [ "${REDIS_HOST:0:1}" = "/" ]; then + if expr "${REDIS_HOST}" : "/" 1>/dev/null; then if [ -n "${REDIS_PW+x}" ]; then echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_PW}\"" else diff --git a/2022.05-dev/apache/Dockerfile b/2022.05-dev/apache/Dockerfile index db618f1..a6a967f 100644 --- a/2022.05-dev/apache/Dockerfile +++ b/2022.05-dev/apache/Dockerfile @@ -95,7 +95,7 @@ RUN set -ex; \ # pecl will claim success even if one install fails, so we need to perform each install separately pecl install apcu-5.1.21; \ pecl install memcached-3.1.5; \ - pecl install redis-5.3.6; \ + pecl install redis-5.3.7; \ pecl install imagick-3.7.0; \ \ docker-php-ext-enable \ diff --git a/2022.05-dev/apache/entrypoint.sh b/2022.05-dev/apache/entrypoint.sh index bb723fb..87dcbe2 100755 --- a/2022.05-dev/apache/entrypoint.sh +++ b/2022.05-dev/apache/entrypoint.sh @@ -3,11 +3,11 @@ set -eu # run an command with the www-data user run_as() { + set -- sh -c "cd /var/www/html; $*" if [ "$(id -u)" -eq 0 ]; then - su -p www-data -s /bin/sh -c "$1" - else - sh -c "$1" + set -- gosu www-data "$@" fi + "$@" } # checks if the the first parameter is greater than the second parameter @@ -20,11 +20,11 @@ version_greater() { # (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of # "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) file_env() { - local var="$1" - local fileVar="${var}_FILE" - local def="${2:-}" - local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") - local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") + var="$1" + fileVar="${var}_FILE" + def="${2:-}" + varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") + fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then echo >&2 "error: both $var and $fileVar are set (but are exclusive)" exit 1 @@ -49,7 +49,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then file_env REDIS_PW echo 'session.save_handler = redis' # check if redis host is an unix socket path - if [ "${REDIS_HOST:0:1}" = "/" ]; then + if expr "${REDIS_HOST}" : "/" 1>/dev/null; then if [ -n "${REDIS_PW+x}" ]; then echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_PW}\"" else diff --git a/2022.05-dev/fpm-alpine/Dockerfile b/2022.05-dev/fpm-alpine/Dockerfile index 2a9d914..9894226 100644 --- a/2022.05-dev/fpm-alpine/Dockerfile +++ b/2022.05-dev/fpm-alpine/Dockerfile @@ -81,7 +81,7 @@ RUN set -ex; \ # pecl will claim success even if one install fails, so we need to perform each install separately pecl install APCu-5.1.21; \ pecl install memcached-3.1.5; \ - pecl install redis-5.3.6; \ + pecl install redis-5.3.7; \ pecl install imagick-3.7.0; \ \ docker-php-ext-enable \ diff --git a/2022.05-dev/fpm-alpine/entrypoint.sh b/2022.05-dev/fpm-alpine/entrypoint.sh index bb723fb..87dcbe2 100755 --- a/2022.05-dev/fpm-alpine/entrypoint.sh +++ b/2022.05-dev/fpm-alpine/entrypoint.sh @@ -3,11 +3,11 @@ set -eu # run an command with the www-data user run_as() { + set -- sh -c "cd /var/www/html; $*" if [ "$(id -u)" -eq 0 ]; then - su -p www-data -s /bin/sh -c "$1" - else - sh -c "$1" + set -- gosu www-data "$@" fi + "$@" } # checks if the the first parameter is greater than the second parameter @@ -20,11 +20,11 @@ version_greater() { # (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of # "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) file_env() { - local var="$1" - local fileVar="${var}_FILE" - local def="${2:-}" - local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") - local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") + var="$1" + fileVar="${var}_FILE" + def="${2:-}" + varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") + fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then echo >&2 "error: both $var and $fileVar are set (but are exclusive)" exit 1 @@ -49,7 +49,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then file_env REDIS_PW echo 'session.save_handler = redis' # check if redis host is an unix socket path - if [ "${REDIS_HOST:0:1}" = "/" ]; then + if expr "${REDIS_HOST}" : "/" 1>/dev/null; then if [ -n "${REDIS_PW+x}" ]; then echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_PW}\"" else diff --git a/2022.05-dev/fpm/Dockerfile b/2022.05-dev/fpm/Dockerfile index 8a6917e..83c3355 100644 --- a/2022.05-dev/fpm/Dockerfile +++ b/2022.05-dev/fpm/Dockerfile @@ -95,7 +95,7 @@ RUN set -ex; \ # pecl will claim success even if one install fails, so we need to perform each install separately pecl install apcu-5.1.21; \ pecl install memcached-3.1.5; \ - pecl install redis-5.3.6; \ + pecl install redis-5.3.7; \ pecl install imagick-3.7.0; \ \ docker-php-ext-enable \ diff --git a/2022.05-dev/fpm/entrypoint.sh b/2022.05-dev/fpm/entrypoint.sh index bb723fb..87dcbe2 100755 --- a/2022.05-dev/fpm/entrypoint.sh +++ b/2022.05-dev/fpm/entrypoint.sh @@ -3,11 +3,11 @@ set -eu # run an command with the www-data user run_as() { + set -- sh -c "cd /var/www/html; $*" if [ "$(id -u)" -eq 0 ]; then - su -p www-data -s /bin/sh -c "$1" - else - sh -c "$1" + set -- gosu www-data "$@" fi + "$@" } # checks if the the first parameter is greater than the second parameter @@ -20,11 +20,11 @@ version_greater() { # (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of # "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) file_env() { - local var="$1" - local fileVar="${var}_FILE" - local def="${2:-}" - local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") - local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") + var="$1" + fileVar="${var}_FILE" + def="${2:-}" + varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") + fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then echo >&2 "error: both $var and $fileVar are set (but are exclusive)" exit 1 @@ -49,7 +49,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then file_env REDIS_PW echo 'session.save_handler = redis' # check if redis host is an unix socket path - if [ "${REDIS_HOST:0:1}" = "/" ]; then + if expr "${REDIS_HOST}" : "/" 1>/dev/null; then if [ -n "${REDIS_PW+x}" ]; then echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_PW}\"" else diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index bb723fb..87dcbe2 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -3,11 +3,11 @@ set -eu # run an command with the www-data user run_as() { + set -- sh -c "cd /var/www/html; $*" if [ "$(id -u)" -eq 0 ]; then - su -p www-data -s /bin/sh -c "$1" - else - sh -c "$1" + set -- gosu www-data "$@" fi + "$@" } # checks if the the first parameter is greater than the second parameter @@ -20,11 +20,11 @@ version_greater() { # (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of # "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) file_env() { - local var="$1" - local fileVar="${var}_FILE" - local def="${2:-}" - local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") - local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") + var="$1" + fileVar="${var}_FILE" + def="${2:-}" + varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//") + fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//") if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then echo >&2 "error: both $var and $fileVar are set (but are exclusive)" exit 1 @@ -49,7 +49,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then file_env REDIS_PW echo 'session.save_handler = redis' # check if redis host is an unix socket path - if [ "${REDIS_HOST:0:1}" = "/" ]; then + if expr "${REDIS_HOST}" : "/" 1>/dev/null; then if [ -n "${REDIS_PW+x}" ]; then echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_PW}\"" else