diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 2e92d65680..a91cd2dc7f 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -24,13 +24,34 @@ file_env() { } if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then + if [ "$(id -u)" = '0' ]; then + case "$1" in + apache2*) + user="${APACHE_RUN_USER:-www-data}" + group="${APACHE_RUN_GROUP:-www-data}" + ;; + *) # php-fpm + user='www-data' + group='www-data' + ;; + esac + else + user="$(id -u)" + group="$(id -g)" + fi + if ! [ -e index.php -a -e wp-includes/version.php ]; then echo >&2 "WordPress 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 - tar cf - --one-file-system -C /usr/src/wordpress . | tar xf - + tar --create \ + --file - \ + --one-file-system \ + --directory /usr/src/wordpress \ + --owner "$user" --group "$group" \ + . | tar --extract --file - echo >&2 "Complete! WordPress has been successfully copied to $PWD" if [ ! -e .htaccess ]; then # NOTE: The "Indexes" option is disabled in the php:apache base image @@ -46,7 +67,7 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then # END WordPress EOF - chown www-data:www-data .htaccess + chown "$user:$group" .htaccess fi fi @@ -115,7 +136,7 @@ if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROT } EOPHP - chown www-data:www-data wp-config.php + chown "$user:$group" wp-config.php fi # see http://stackoverflow.com/a/2705678/433558 diff --git a/php5.6/apache/docker-entrypoint.sh b/php5.6/apache/docker-entrypoint.sh index 2e92d65680..a91cd2dc7f 100755 --- a/php5.6/apache/docker-entrypoint.sh +++ b/php5.6/apache/docker-entrypoint.sh @@ -24,13 +24,34 @@ file_env() { } if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then + if [ "$(id -u)" = '0' ]; then + case "$1" in + apache2*) + user="${APACHE_RUN_USER:-www-data}" + group="${APACHE_RUN_GROUP:-www-data}" + ;; + *) # php-fpm + user='www-data' + group='www-data' + ;; + esac + else + user="$(id -u)" + group="$(id -g)" + fi + if ! [ -e index.php -a -e wp-includes/version.php ]; then echo >&2 "WordPress 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 - tar cf - --one-file-system -C /usr/src/wordpress . | tar xf - + tar --create \ + --file - \ + --one-file-system \ + --directory /usr/src/wordpress \ + --owner "$user" --group "$group" \ + . | tar --extract --file - echo >&2 "Complete! WordPress has been successfully copied to $PWD" if [ ! -e .htaccess ]; then # NOTE: The "Indexes" option is disabled in the php:apache base image @@ -46,7 +67,7 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then # END WordPress EOF - chown www-data:www-data .htaccess + chown "$user:$group" .htaccess fi fi @@ -115,7 +136,7 @@ if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROT } EOPHP - chown www-data:www-data wp-config.php + chown "$user:$group" wp-config.php fi # see http://stackoverflow.com/a/2705678/433558 diff --git a/php5.6/fpm-alpine/docker-entrypoint.sh b/php5.6/fpm-alpine/docker-entrypoint.sh index 2e92d65680..a91cd2dc7f 100755 --- a/php5.6/fpm-alpine/docker-entrypoint.sh +++ b/php5.6/fpm-alpine/docker-entrypoint.sh @@ -24,13 +24,34 @@ file_env() { } if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then + if [ "$(id -u)" = '0' ]; then + case "$1" in + apache2*) + user="${APACHE_RUN_USER:-www-data}" + group="${APACHE_RUN_GROUP:-www-data}" + ;; + *) # php-fpm + user='www-data' + group='www-data' + ;; + esac + else + user="$(id -u)" + group="$(id -g)" + fi + if ! [ -e index.php -a -e wp-includes/version.php ]; then echo >&2 "WordPress 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 - tar cf - --one-file-system -C /usr/src/wordpress . | tar xf - + tar --create \ + --file - \ + --one-file-system \ + --directory /usr/src/wordpress \ + --owner "$user" --group "$group" \ + . | tar --extract --file - echo >&2 "Complete! WordPress has been successfully copied to $PWD" if [ ! -e .htaccess ]; then # NOTE: The "Indexes" option is disabled in the php:apache base image @@ -46,7 +67,7 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then # END WordPress EOF - chown www-data:www-data .htaccess + chown "$user:$group" .htaccess fi fi @@ -115,7 +136,7 @@ if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROT } EOPHP - chown www-data:www-data wp-config.php + chown "$user:$group" wp-config.php fi # see http://stackoverflow.com/a/2705678/433558 diff --git a/php5.6/fpm/docker-entrypoint.sh b/php5.6/fpm/docker-entrypoint.sh index 2e92d65680..a91cd2dc7f 100755 --- a/php5.6/fpm/docker-entrypoint.sh +++ b/php5.6/fpm/docker-entrypoint.sh @@ -24,13 +24,34 @@ file_env() { } if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then + if [ "$(id -u)" = '0' ]; then + case "$1" in + apache2*) + user="${APACHE_RUN_USER:-www-data}" + group="${APACHE_RUN_GROUP:-www-data}" + ;; + *) # php-fpm + user='www-data' + group='www-data' + ;; + esac + else + user="$(id -u)" + group="$(id -g)" + fi + if ! [ -e index.php -a -e wp-includes/version.php ]; then echo >&2 "WordPress 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 - tar cf - --one-file-system -C /usr/src/wordpress . | tar xf - + tar --create \ + --file - \ + --one-file-system \ + --directory /usr/src/wordpress \ + --owner "$user" --group "$group" \ + . | tar --extract --file - echo >&2 "Complete! WordPress has been successfully copied to $PWD" if [ ! -e .htaccess ]; then # NOTE: The "Indexes" option is disabled in the php:apache base image @@ -46,7 +67,7 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then # END WordPress EOF - chown www-data:www-data .htaccess + chown "$user:$group" .htaccess fi fi @@ -115,7 +136,7 @@ if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROT } EOPHP - chown www-data:www-data wp-config.php + chown "$user:$group" wp-config.php fi # see http://stackoverflow.com/a/2705678/433558 diff --git a/php7.0/apache/docker-entrypoint.sh b/php7.0/apache/docker-entrypoint.sh index 2e92d65680..a91cd2dc7f 100755 --- a/php7.0/apache/docker-entrypoint.sh +++ b/php7.0/apache/docker-entrypoint.sh @@ -24,13 +24,34 @@ file_env() { } if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then + if [ "$(id -u)" = '0' ]; then + case "$1" in + apache2*) + user="${APACHE_RUN_USER:-www-data}" + group="${APACHE_RUN_GROUP:-www-data}" + ;; + *) # php-fpm + user='www-data' + group='www-data' + ;; + esac + else + user="$(id -u)" + group="$(id -g)" + fi + if ! [ -e index.php -a -e wp-includes/version.php ]; then echo >&2 "WordPress 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 - tar cf - --one-file-system -C /usr/src/wordpress . | tar xf - + tar --create \ + --file - \ + --one-file-system \ + --directory /usr/src/wordpress \ + --owner "$user" --group "$group" \ + . | tar --extract --file - echo >&2 "Complete! WordPress has been successfully copied to $PWD" if [ ! -e .htaccess ]; then # NOTE: The "Indexes" option is disabled in the php:apache base image @@ -46,7 +67,7 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then # END WordPress EOF - chown www-data:www-data .htaccess + chown "$user:$group" .htaccess fi fi @@ -115,7 +136,7 @@ if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROT } EOPHP - chown www-data:www-data wp-config.php + chown "$user:$group" wp-config.php fi # see http://stackoverflow.com/a/2705678/433558 diff --git a/php7.0/fpm-alpine/docker-entrypoint.sh b/php7.0/fpm-alpine/docker-entrypoint.sh index 2e92d65680..a91cd2dc7f 100755 --- a/php7.0/fpm-alpine/docker-entrypoint.sh +++ b/php7.0/fpm-alpine/docker-entrypoint.sh @@ -24,13 +24,34 @@ file_env() { } if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then + if [ "$(id -u)" = '0' ]; then + case "$1" in + apache2*) + user="${APACHE_RUN_USER:-www-data}" + group="${APACHE_RUN_GROUP:-www-data}" + ;; + *) # php-fpm + user='www-data' + group='www-data' + ;; + esac + else + user="$(id -u)" + group="$(id -g)" + fi + if ! [ -e index.php -a -e wp-includes/version.php ]; then echo >&2 "WordPress 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 - tar cf - --one-file-system -C /usr/src/wordpress . | tar xf - + tar --create \ + --file - \ + --one-file-system \ + --directory /usr/src/wordpress \ + --owner "$user" --group "$group" \ + . | tar --extract --file - echo >&2 "Complete! WordPress has been successfully copied to $PWD" if [ ! -e .htaccess ]; then # NOTE: The "Indexes" option is disabled in the php:apache base image @@ -46,7 +67,7 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then # END WordPress EOF - chown www-data:www-data .htaccess + chown "$user:$group" .htaccess fi fi @@ -115,7 +136,7 @@ if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROT } EOPHP - chown www-data:www-data wp-config.php + chown "$user:$group" wp-config.php fi # see http://stackoverflow.com/a/2705678/433558 diff --git a/php7.0/fpm/docker-entrypoint.sh b/php7.0/fpm/docker-entrypoint.sh index 2e92d65680..a91cd2dc7f 100755 --- a/php7.0/fpm/docker-entrypoint.sh +++ b/php7.0/fpm/docker-entrypoint.sh @@ -24,13 +24,34 @@ file_env() { } if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then + if [ "$(id -u)" = '0' ]; then + case "$1" in + apache2*) + user="${APACHE_RUN_USER:-www-data}" + group="${APACHE_RUN_GROUP:-www-data}" + ;; + *) # php-fpm + user='www-data' + group='www-data' + ;; + esac + else + user="$(id -u)" + group="$(id -g)" + fi + if ! [ -e index.php -a -e wp-includes/version.php ]; then echo >&2 "WordPress 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 - tar cf - --one-file-system -C /usr/src/wordpress . | tar xf - + tar --create \ + --file - \ + --one-file-system \ + --directory /usr/src/wordpress \ + --owner "$user" --group "$group" \ + . | tar --extract --file - echo >&2 "Complete! WordPress has been successfully copied to $PWD" if [ ! -e .htaccess ]; then # NOTE: The "Indexes" option is disabled in the php:apache base image @@ -46,7 +67,7 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then # END WordPress EOF - chown www-data:www-data .htaccess + chown "$user:$group" .htaccess fi fi @@ -115,7 +136,7 @@ if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROT } EOPHP - chown www-data:www-data wp-config.php + chown "$user:$group" wp-config.php fi # see http://stackoverflow.com/a/2705678/433558 diff --git a/php7.1/apache/docker-entrypoint.sh b/php7.1/apache/docker-entrypoint.sh index 2e92d65680..a91cd2dc7f 100755 --- a/php7.1/apache/docker-entrypoint.sh +++ b/php7.1/apache/docker-entrypoint.sh @@ -24,13 +24,34 @@ file_env() { } if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then + if [ "$(id -u)" = '0' ]; then + case "$1" in + apache2*) + user="${APACHE_RUN_USER:-www-data}" + group="${APACHE_RUN_GROUP:-www-data}" + ;; + *) # php-fpm + user='www-data' + group='www-data' + ;; + esac + else + user="$(id -u)" + group="$(id -g)" + fi + if ! [ -e index.php -a -e wp-includes/version.php ]; then echo >&2 "WordPress 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 - tar cf - --one-file-system -C /usr/src/wordpress . | tar xf - + tar --create \ + --file - \ + --one-file-system \ + --directory /usr/src/wordpress \ + --owner "$user" --group "$group" \ + . | tar --extract --file - echo >&2 "Complete! WordPress has been successfully copied to $PWD" if [ ! -e .htaccess ]; then # NOTE: The "Indexes" option is disabled in the php:apache base image @@ -46,7 +67,7 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then # END WordPress EOF - chown www-data:www-data .htaccess + chown "$user:$group" .htaccess fi fi @@ -115,7 +136,7 @@ if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROT } EOPHP - chown www-data:www-data wp-config.php + chown "$user:$group" wp-config.php fi # see http://stackoverflow.com/a/2705678/433558 diff --git a/php7.1/fpm-alpine/docker-entrypoint.sh b/php7.1/fpm-alpine/docker-entrypoint.sh index 2e92d65680..a91cd2dc7f 100755 --- a/php7.1/fpm-alpine/docker-entrypoint.sh +++ b/php7.1/fpm-alpine/docker-entrypoint.sh @@ -24,13 +24,34 @@ file_env() { } if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then + if [ "$(id -u)" = '0' ]; then + case "$1" in + apache2*) + user="${APACHE_RUN_USER:-www-data}" + group="${APACHE_RUN_GROUP:-www-data}" + ;; + *) # php-fpm + user='www-data' + group='www-data' + ;; + esac + else + user="$(id -u)" + group="$(id -g)" + fi + if ! [ -e index.php -a -e wp-includes/version.php ]; then echo >&2 "WordPress 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 - tar cf - --one-file-system -C /usr/src/wordpress . | tar xf - + tar --create \ + --file - \ + --one-file-system \ + --directory /usr/src/wordpress \ + --owner "$user" --group "$group" \ + . | tar --extract --file - echo >&2 "Complete! WordPress has been successfully copied to $PWD" if [ ! -e .htaccess ]; then # NOTE: The "Indexes" option is disabled in the php:apache base image @@ -46,7 +67,7 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then # END WordPress EOF - chown www-data:www-data .htaccess + chown "$user:$group" .htaccess fi fi @@ -115,7 +136,7 @@ if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROT } EOPHP - chown www-data:www-data wp-config.php + chown "$user:$group" wp-config.php fi # see http://stackoverflow.com/a/2705678/433558 diff --git a/php7.1/fpm/docker-entrypoint.sh b/php7.1/fpm/docker-entrypoint.sh index 2e92d65680..a91cd2dc7f 100755 --- a/php7.1/fpm/docker-entrypoint.sh +++ b/php7.1/fpm/docker-entrypoint.sh @@ -24,13 +24,34 @@ file_env() { } if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then + if [ "$(id -u)" = '0' ]; then + case "$1" in + apache2*) + user="${APACHE_RUN_USER:-www-data}" + group="${APACHE_RUN_GROUP:-www-data}" + ;; + *) # php-fpm + user='www-data' + group='www-data' + ;; + esac + else + user="$(id -u)" + group="$(id -g)" + fi + if ! [ -e index.php -a -e wp-includes/version.php ]; then echo >&2 "WordPress 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 - tar cf - --one-file-system -C /usr/src/wordpress . | tar xf - + tar --create \ + --file - \ + --one-file-system \ + --directory /usr/src/wordpress \ + --owner "$user" --group "$group" \ + . | tar --extract --file - echo >&2 "Complete! WordPress has been successfully copied to $PWD" if [ ! -e .htaccess ]; then # NOTE: The "Indexes" option is disabled in the php:apache base image @@ -46,7 +67,7 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then # END WordPress EOF - chown www-data:www-data .htaccess + chown "$user:$group" .htaccess fi fi @@ -115,7 +136,7 @@ if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROT } EOPHP - chown www-data:www-data wp-config.php + chown "$user:$group" wp-config.php fi # see http://stackoverflow.com/a/2705678/433558 diff --git a/php7.2/apache/docker-entrypoint.sh b/php7.2/apache/docker-entrypoint.sh index 2e92d65680..a91cd2dc7f 100755 --- a/php7.2/apache/docker-entrypoint.sh +++ b/php7.2/apache/docker-entrypoint.sh @@ -24,13 +24,34 @@ file_env() { } if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then + if [ "$(id -u)" = '0' ]; then + case "$1" in + apache2*) + user="${APACHE_RUN_USER:-www-data}" + group="${APACHE_RUN_GROUP:-www-data}" + ;; + *) # php-fpm + user='www-data' + group='www-data' + ;; + esac + else + user="$(id -u)" + group="$(id -g)" + fi + if ! [ -e index.php -a -e wp-includes/version.php ]; then echo >&2 "WordPress 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 - tar cf - --one-file-system -C /usr/src/wordpress . | tar xf - + tar --create \ + --file - \ + --one-file-system \ + --directory /usr/src/wordpress \ + --owner "$user" --group "$group" \ + . | tar --extract --file - echo >&2 "Complete! WordPress has been successfully copied to $PWD" if [ ! -e .htaccess ]; then # NOTE: The "Indexes" option is disabled in the php:apache base image @@ -46,7 +67,7 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then # END WordPress EOF - chown www-data:www-data .htaccess + chown "$user:$group" .htaccess fi fi @@ -115,7 +136,7 @@ if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROT } EOPHP - chown www-data:www-data wp-config.php + chown "$user:$group" wp-config.php fi # see http://stackoverflow.com/a/2705678/433558 diff --git a/php7.2/fpm-alpine/docker-entrypoint.sh b/php7.2/fpm-alpine/docker-entrypoint.sh index 2e92d65680..a91cd2dc7f 100755 --- a/php7.2/fpm-alpine/docker-entrypoint.sh +++ b/php7.2/fpm-alpine/docker-entrypoint.sh @@ -24,13 +24,34 @@ file_env() { } if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then + if [ "$(id -u)" = '0' ]; then + case "$1" in + apache2*) + user="${APACHE_RUN_USER:-www-data}" + group="${APACHE_RUN_GROUP:-www-data}" + ;; + *) # php-fpm + user='www-data' + group='www-data' + ;; + esac + else + user="$(id -u)" + group="$(id -g)" + fi + if ! [ -e index.php -a -e wp-includes/version.php ]; then echo >&2 "WordPress 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 - tar cf - --one-file-system -C /usr/src/wordpress . | tar xf - + tar --create \ + --file - \ + --one-file-system \ + --directory /usr/src/wordpress \ + --owner "$user" --group "$group" \ + . | tar --extract --file - echo >&2 "Complete! WordPress has been successfully copied to $PWD" if [ ! -e .htaccess ]; then # NOTE: The "Indexes" option is disabled in the php:apache base image @@ -46,7 +67,7 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then # END WordPress EOF - chown www-data:www-data .htaccess + chown "$user:$group" .htaccess fi fi @@ -115,7 +136,7 @@ if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROT } EOPHP - chown www-data:www-data wp-config.php + chown "$user:$group" wp-config.php fi # see http://stackoverflow.com/a/2705678/433558 diff --git a/php7.2/fpm/docker-entrypoint.sh b/php7.2/fpm/docker-entrypoint.sh index 2e92d65680..a91cd2dc7f 100755 --- a/php7.2/fpm/docker-entrypoint.sh +++ b/php7.2/fpm/docker-entrypoint.sh @@ -24,13 +24,34 @@ file_env() { } if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then + if [ "$(id -u)" = '0' ]; then + case "$1" in + apache2*) + user="${APACHE_RUN_USER:-www-data}" + group="${APACHE_RUN_GROUP:-www-data}" + ;; + *) # php-fpm + user='www-data' + group='www-data' + ;; + esac + else + user="$(id -u)" + group="$(id -g)" + fi + if ! [ -e index.php -a -e wp-includes/version.php ]; then echo >&2 "WordPress 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 - tar cf - --one-file-system -C /usr/src/wordpress . | tar xf - + tar --create \ + --file - \ + --one-file-system \ + --directory /usr/src/wordpress \ + --owner "$user" --group "$group" \ + . | tar --extract --file - echo >&2 "Complete! WordPress has been successfully copied to $PWD" if [ ! -e .htaccess ]; then # NOTE: The "Indexes" option is disabled in the php:apache base image @@ -46,7 +67,7 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then # END WordPress EOF - chown www-data:www-data .htaccess + chown "$user:$group" .htaccess fi fi @@ -115,7 +136,7 @@ if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROT } EOPHP - chown www-data:www-data wp-config.php + chown "$user:$group" wp-config.php fi # see http://stackoverflow.com/a/2705678/433558