From 90d47bb171492d1adbe95d5477bb12f02503ca3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Sun, 7 Dec 2025 21:11:37 +0100 Subject: [PATCH 1/2] stop execution if docroot is not-empty and SKIP_CHECK_EMPTY_DOCROOT is not set either Closes: https://github.com/roundcube/roundcubemail-docker/issues/384 --- templates/docker-entrypoint.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/templates/docker-entrypoint.sh b/templates/docker-entrypoint.sh index 600d0f04b..48b3af3b7 100644 --- a/templates/docker-entrypoint.sh +++ b/templates/docker-entrypoint.sh @@ -36,11 +36,13 @@ if [[ "$1" == apache2* || "$1" == php-fpm || "$1" == bin* ]]; then INSTALLDIR=`pwd` # docroot is empty if ! [ -e index.php -a -e bin/installto.sh ]; then - echo >&2 "roundcubemail not found in $PWD - copying now..." - if [ "$(ls -A)" ]; then - echo >&2 "WARNING: $PWD is not empty - press Ctrl+C now if this is an error!" - ( set -x; ls -A; sleep 10 ) + if [ -z "${SKIP_CHECK_EMPTY_DOCROOT}" ]; then + if find . -mindepth 1 -maxdepth 1 -print -quit | grep -q .; then + echo >&2 "ERROR: $PWD is not empty; export SKIP_CHECK_EMPTY_DOCROOT=yes to ignore this" + exit 1 + fi fi + echo >&2 "roundcubemail not found in $PWD - copying now..." tar cf - --one-file-system -C /usr/src/roundcubemail . | tar xf - echo >&2 "Complete! ROUNDCUBEMAIL has been successfully copied to $INSTALLDIR" # update Roundcube in docroot From a2b27d4060b7e94bf6c47b3596f804720276edbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Sun, 7 Dec 2025 21:22:22 +0100 Subject: [PATCH 2/2] Update variants with new SKIP_CHECK_EMPTY_DOCROOT test --- apache/docker-entrypoint.sh | 10 ++++++---- fpm-alpine/docker-entrypoint.sh | 10 ++++++---- fpm/docker-entrypoint.sh | 10 ++++++---- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/apache/docker-entrypoint.sh b/apache/docker-entrypoint.sh index 600d0f04b..48b3af3b7 100755 --- a/apache/docker-entrypoint.sh +++ b/apache/docker-entrypoint.sh @@ -36,11 +36,13 @@ if [[ "$1" == apache2* || "$1" == php-fpm || "$1" == bin* ]]; then INSTALLDIR=`pwd` # docroot is empty if ! [ -e index.php -a -e bin/installto.sh ]; then - echo >&2 "roundcubemail not found in $PWD - copying now..." - if [ "$(ls -A)" ]; then - echo >&2 "WARNING: $PWD is not empty - press Ctrl+C now if this is an error!" - ( set -x; ls -A; sleep 10 ) + if [ -z "${SKIP_CHECK_EMPTY_DOCROOT}" ]; then + if find . -mindepth 1 -maxdepth 1 -print -quit | grep -q .; then + echo >&2 "ERROR: $PWD is not empty; export SKIP_CHECK_EMPTY_DOCROOT=yes to ignore this" + exit 1 + fi fi + echo >&2 "roundcubemail not found in $PWD - copying now..." tar cf - --one-file-system -C /usr/src/roundcubemail . | tar xf - echo >&2 "Complete! ROUNDCUBEMAIL has been successfully copied to $INSTALLDIR" # update Roundcube in docroot diff --git a/fpm-alpine/docker-entrypoint.sh b/fpm-alpine/docker-entrypoint.sh index 600d0f04b..48b3af3b7 100755 --- a/fpm-alpine/docker-entrypoint.sh +++ b/fpm-alpine/docker-entrypoint.sh @@ -36,11 +36,13 @@ if [[ "$1" == apache2* || "$1" == php-fpm || "$1" == bin* ]]; then INSTALLDIR=`pwd` # docroot is empty if ! [ -e index.php -a -e bin/installto.sh ]; then - echo >&2 "roundcubemail not found in $PWD - copying now..." - if [ "$(ls -A)" ]; then - echo >&2 "WARNING: $PWD is not empty - press Ctrl+C now if this is an error!" - ( set -x; ls -A; sleep 10 ) + if [ -z "${SKIP_CHECK_EMPTY_DOCROOT}" ]; then + if find . -mindepth 1 -maxdepth 1 -print -quit | grep -q .; then + echo >&2 "ERROR: $PWD is not empty; export SKIP_CHECK_EMPTY_DOCROOT=yes to ignore this" + exit 1 + fi fi + echo >&2 "roundcubemail not found in $PWD - copying now..." tar cf - --one-file-system -C /usr/src/roundcubemail . | tar xf - echo >&2 "Complete! ROUNDCUBEMAIL has been successfully copied to $INSTALLDIR" # update Roundcube in docroot diff --git a/fpm/docker-entrypoint.sh b/fpm/docker-entrypoint.sh index 600d0f04b..48b3af3b7 100755 --- a/fpm/docker-entrypoint.sh +++ b/fpm/docker-entrypoint.sh @@ -36,11 +36,13 @@ if [[ "$1" == apache2* || "$1" == php-fpm || "$1" == bin* ]]; then INSTALLDIR=`pwd` # docroot is empty if ! [ -e index.php -a -e bin/installto.sh ]; then - echo >&2 "roundcubemail not found in $PWD - copying now..." - if [ "$(ls -A)" ]; then - echo >&2 "WARNING: $PWD is not empty - press Ctrl+C now if this is an error!" - ( set -x; ls -A; sleep 10 ) + if [ -z "${SKIP_CHECK_EMPTY_DOCROOT}" ]; then + if find . -mindepth 1 -maxdepth 1 -print -quit | grep -q .; then + echo >&2 "ERROR: $PWD is not empty; export SKIP_CHECK_EMPTY_DOCROOT=yes to ignore this" + exit 1 + fi fi + echo >&2 "roundcubemail not found in $PWD - copying now..." tar cf - --one-file-system -C /usr/src/roundcubemail . | tar xf - echo >&2 "Complete! ROUNDCUBEMAIL has been successfully copied to $INSTALLDIR" # update Roundcube in docroot