diff --git a/apache/docker-entrypoint.sh b/apache/docker-entrypoint.sh index 600d0f04b..03874e7a9 100755 --- a/apache/docker-entrypoint.sh +++ b/apache/docker-entrypoint.sh @@ -3,6 +3,47 @@ # PWD=`pwd` +check_empty_docroot() { + local dirty_docroot_timeout=60 + + # check if ROUNDCUBEMAIL_ALLOW_DIRTY_DOCROOT is valid + case "$(echo "${ROUNDCUBEMAIL_ALLOW_DIRTY_DOCROOT}" | tr '[:upper:]' '[:lower:]')" in + yes|y|true|t|on|1) + # valid and truish: nothing to do + return 0 + ;; + no|n|false|f|off|0|"") + # valid and either falsish or unset: proceed to the test + ;; + *) + # invalid; proceed + cat >&2 <&2 <&2 <&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 ) - fi + + check_empty_docroot + 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..03874e7a9 100755 --- a/fpm-alpine/docker-entrypoint.sh +++ b/fpm-alpine/docker-entrypoint.sh @@ -3,6 +3,47 @@ # PWD=`pwd` +check_empty_docroot() { + local dirty_docroot_timeout=60 + + # check if ROUNDCUBEMAIL_ALLOW_DIRTY_DOCROOT is valid + case "$(echo "${ROUNDCUBEMAIL_ALLOW_DIRTY_DOCROOT}" | tr '[:upper:]' '[:lower:]')" in + yes|y|true|t|on|1) + # valid and truish: nothing to do + return 0 + ;; + no|n|false|f|off|0|"") + # valid and either falsish or unset: proceed to the test + ;; + *) + # invalid; proceed + cat >&2 <&2 <&2 <&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 ) - fi + + check_empty_docroot + 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..03874e7a9 100755 --- a/fpm/docker-entrypoint.sh +++ b/fpm/docker-entrypoint.sh @@ -3,6 +3,47 @@ # PWD=`pwd` +check_empty_docroot() { + local dirty_docroot_timeout=60 + + # check if ROUNDCUBEMAIL_ALLOW_DIRTY_DOCROOT is valid + case "$(echo "${ROUNDCUBEMAIL_ALLOW_DIRTY_DOCROOT}" | tr '[:upper:]' '[:lower:]')" in + yes|y|true|t|on|1) + # valid and truish: nothing to do + return 0 + ;; + no|n|false|f|off|0|"") + # valid and either falsish or unset: proceed to the test + ;; + *) + # invalid; proceed + cat >&2 <&2 <&2 <&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 ) - fi + + check_empty_docroot + 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/templates/docker-entrypoint.sh b/templates/docker-entrypoint.sh index 600d0f04b..03874e7a9 100644 --- a/templates/docker-entrypoint.sh +++ b/templates/docker-entrypoint.sh @@ -3,6 +3,47 @@ # PWD=`pwd` +check_empty_docroot() { + local dirty_docroot_timeout=60 + + # check if ROUNDCUBEMAIL_ALLOW_DIRTY_DOCROOT is valid + case "$(echo "${ROUNDCUBEMAIL_ALLOW_DIRTY_DOCROOT}" | tr '[:upper:]' '[:lower:]')" in + yes|y|true|t|on|1) + # valid and truish: nothing to do + return 0 + ;; + no|n|false|f|off|0|"") + # valid and either falsish or unset: proceed to the test + ;; + *) + # invalid; proceed + cat >&2 <&2 <&2 <&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 ) - fi + + check_empty_docroot + 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