diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 0d37f1d7b8..f00874db50 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -46,6 +46,11 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then fi if [ ! -e index.php ] && [ ! -e wp-includes/version.php ]; then + # if the directory exists and WordPress doesn't appear to be installed AND the permissions of it are root:root, let's chown it (likely a Docker-created directory) + if [ "$(id -u)" = '0' ] && [ "$(stat -c '%u:%g' .)" = '0:0' ]; then + chown "$user:$group" . + fi + echo >&2 "WordPress not found in $PWD - copying now..." if [ -n "$(ls -A)" ]; then echo >&2 "WARNING: $PWD is not empty! (copying anyhow)" diff --git a/php7.1/apache/docker-entrypoint.sh b/php7.1/apache/docker-entrypoint.sh index 0d37f1d7b8..f00874db50 100755 --- a/php7.1/apache/docker-entrypoint.sh +++ b/php7.1/apache/docker-entrypoint.sh @@ -46,6 +46,11 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then fi if [ ! -e index.php ] && [ ! -e wp-includes/version.php ]; then + # if the directory exists and WordPress doesn't appear to be installed AND the permissions of it are root:root, let's chown it (likely a Docker-created directory) + if [ "$(id -u)" = '0' ] && [ "$(stat -c '%u:%g' .)" = '0:0' ]; then + chown "$user:$group" . + fi + echo >&2 "WordPress not found in $PWD - copying now..." if [ -n "$(ls -A)" ]; then echo >&2 "WARNING: $PWD is not empty! (copying anyhow)" diff --git a/php7.1/fpm-alpine/docker-entrypoint.sh b/php7.1/fpm-alpine/docker-entrypoint.sh index 0d37f1d7b8..f00874db50 100755 --- a/php7.1/fpm-alpine/docker-entrypoint.sh +++ b/php7.1/fpm-alpine/docker-entrypoint.sh @@ -46,6 +46,11 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then fi if [ ! -e index.php ] && [ ! -e wp-includes/version.php ]; then + # if the directory exists and WordPress doesn't appear to be installed AND the permissions of it are root:root, let's chown it (likely a Docker-created directory) + if [ "$(id -u)" = '0' ] && [ "$(stat -c '%u:%g' .)" = '0:0' ]; then + chown "$user:$group" . + fi + echo >&2 "WordPress not found in $PWD - copying now..." if [ -n "$(ls -A)" ]; then echo >&2 "WARNING: $PWD is not empty! (copying anyhow)" diff --git a/php7.1/fpm/docker-entrypoint.sh b/php7.1/fpm/docker-entrypoint.sh index 0d37f1d7b8..f00874db50 100755 --- a/php7.1/fpm/docker-entrypoint.sh +++ b/php7.1/fpm/docker-entrypoint.sh @@ -46,6 +46,11 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then fi if [ ! -e index.php ] && [ ! -e wp-includes/version.php ]; then + # if the directory exists and WordPress doesn't appear to be installed AND the permissions of it are root:root, let's chown it (likely a Docker-created directory) + if [ "$(id -u)" = '0' ] && [ "$(stat -c '%u:%g' .)" = '0:0' ]; then + chown "$user:$group" . + fi + echo >&2 "WordPress not found in $PWD - copying now..." if [ -n "$(ls -A)" ]; then echo >&2 "WARNING: $PWD is not empty! (copying anyhow)" diff --git a/php7.2/apache/docker-entrypoint.sh b/php7.2/apache/docker-entrypoint.sh index 0d37f1d7b8..f00874db50 100755 --- a/php7.2/apache/docker-entrypoint.sh +++ b/php7.2/apache/docker-entrypoint.sh @@ -46,6 +46,11 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then fi if [ ! -e index.php ] && [ ! -e wp-includes/version.php ]; then + # if the directory exists and WordPress doesn't appear to be installed AND the permissions of it are root:root, let's chown it (likely a Docker-created directory) + if [ "$(id -u)" = '0' ] && [ "$(stat -c '%u:%g' .)" = '0:0' ]; then + chown "$user:$group" . + fi + echo >&2 "WordPress not found in $PWD - copying now..." if [ -n "$(ls -A)" ]; then echo >&2 "WARNING: $PWD is not empty! (copying anyhow)" diff --git a/php7.2/fpm-alpine/docker-entrypoint.sh b/php7.2/fpm-alpine/docker-entrypoint.sh index 0d37f1d7b8..f00874db50 100755 --- a/php7.2/fpm-alpine/docker-entrypoint.sh +++ b/php7.2/fpm-alpine/docker-entrypoint.sh @@ -46,6 +46,11 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then fi if [ ! -e index.php ] && [ ! -e wp-includes/version.php ]; then + # if the directory exists and WordPress doesn't appear to be installed AND the permissions of it are root:root, let's chown it (likely a Docker-created directory) + if [ "$(id -u)" = '0' ] && [ "$(stat -c '%u:%g' .)" = '0:0' ]; then + chown "$user:$group" . + fi + echo >&2 "WordPress not found in $PWD - copying now..." if [ -n "$(ls -A)" ]; then echo >&2 "WARNING: $PWD is not empty! (copying anyhow)" diff --git a/php7.2/fpm/docker-entrypoint.sh b/php7.2/fpm/docker-entrypoint.sh index 0d37f1d7b8..f00874db50 100755 --- a/php7.2/fpm/docker-entrypoint.sh +++ b/php7.2/fpm/docker-entrypoint.sh @@ -46,6 +46,11 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then fi if [ ! -e index.php ] && [ ! -e wp-includes/version.php ]; then + # if the directory exists and WordPress doesn't appear to be installed AND the permissions of it are root:root, let's chown it (likely a Docker-created directory) + if [ "$(id -u)" = '0' ] && [ "$(stat -c '%u:%g' .)" = '0:0' ]; then + chown "$user:$group" . + fi + echo >&2 "WordPress not found in $PWD - copying now..." if [ -n "$(ls -A)" ]; then echo >&2 "WARNING: $PWD is not empty! (copying anyhow)" diff --git a/php7.3/apache/docker-entrypoint.sh b/php7.3/apache/docker-entrypoint.sh index 0d37f1d7b8..f00874db50 100755 --- a/php7.3/apache/docker-entrypoint.sh +++ b/php7.3/apache/docker-entrypoint.sh @@ -46,6 +46,11 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then fi if [ ! -e index.php ] && [ ! -e wp-includes/version.php ]; then + # if the directory exists and WordPress doesn't appear to be installed AND the permissions of it are root:root, let's chown it (likely a Docker-created directory) + if [ "$(id -u)" = '0' ] && [ "$(stat -c '%u:%g' .)" = '0:0' ]; then + chown "$user:$group" . + fi + echo >&2 "WordPress not found in $PWD - copying now..." if [ -n "$(ls -A)" ]; then echo >&2 "WARNING: $PWD is not empty! (copying anyhow)" diff --git a/php7.3/fpm-alpine/docker-entrypoint.sh b/php7.3/fpm-alpine/docker-entrypoint.sh index 0d37f1d7b8..f00874db50 100755 --- a/php7.3/fpm-alpine/docker-entrypoint.sh +++ b/php7.3/fpm-alpine/docker-entrypoint.sh @@ -46,6 +46,11 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then fi if [ ! -e index.php ] && [ ! -e wp-includes/version.php ]; then + # if the directory exists and WordPress doesn't appear to be installed AND the permissions of it are root:root, let's chown it (likely a Docker-created directory) + if [ "$(id -u)" = '0' ] && [ "$(stat -c '%u:%g' .)" = '0:0' ]; then + chown "$user:$group" . + fi + echo >&2 "WordPress not found in $PWD - copying now..." if [ -n "$(ls -A)" ]; then echo >&2 "WARNING: $PWD is not empty! (copying anyhow)" diff --git a/php7.3/fpm/docker-entrypoint.sh b/php7.3/fpm/docker-entrypoint.sh index 0d37f1d7b8..f00874db50 100755 --- a/php7.3/fpm/docker-entrypoint.sh +++ b/php7.3/fpm/docker-entrypoint.sh @@ -46,6 +46,11 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then fi if [ ! -e index.php ] && [ ! -e wp-includes/version.php ]; then + # if the directory exists and WordPress doesn't appear to be installed AND the permissions of it are root:root, let's chown it (likely a Docker-created directory) + if [ "$(id -u)" = '0' ] && [ "$(stat -c '%u:%g' .)" = '0:0' ]; then + chown "$user:$group" . + fi + echo >&2 "WordPress not found in $PWD - copying now..." if [ -n "$(ls -A)" ]; then echo >&2 "WARNING: $PWD is not empty! (copying anyhow)"