@@ -24,14 +24,22 @@ file_env() {
2424}
2525
2626if [[ " $1 " == apache2* ]] || [ " $1 " == php-fpm ]; then
27+ : " ${APACHE_RUN_USER:- www-data} "
28+ : " ${APACHE_RUN_GROUP:- www-data} "
29+ export APACHE_RUN_USER APACHE_RUN_GROUP
30+
2731 if ! [ -e index.php -a -e wp-includes/version.php ]; then
2832 echo >&2 " WordPress not found in $PWD - copying now..."
2933 if [ " $( ls -A) " ]; then
3034 echo >&2 " WARNING: $PWD is not empty - press Ctrl+C now if this is an error!"
3135 ( set -x; ls -A; sleep 10 )
3236 fi
33- tar cf - --one-file-system -C /usr/src/wordpress . | tar xf -
34- chown -R ${APACHE_RUN_USER:- www-data} :${APACHE_RUN_GROUP:- www-data} $PWD
37+ tar --create \
38+ --file - \
39+ --one-file-system \
40+ --directory /usr/src/wordpress \
41+ --owner " ${APACHE_RUN_USER} " --group " ${APACHE_RUN_GROUP} " \
42+ . | tar --extract --file -
3543 echo >&2 " Complete! WordPress has been successfully copied to $PWD "
3644 if [ ! -e .htaccess ]; then
3745 # NOTE: The "Indexes" option is disabled in the php:apache base image
@@ -47,7 +55,7 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
4755 </IfModule>
4856 # END WordPress
4957 EOF
50- chown ${APACHE_RUN_USER:- www-data } :${APACHE_RUN_GROUP:- www-data } .htaccess
58+ chown ${APACHE_RUN_USER} :${APACHE_RUN_GROUP} .htaccess
5159 fi
5260 fi
5361
@@ -116,7 +124,7 @@ if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROT
116124}
117125
118126EOPHP
119- chown ${APACHE_RUN_USER:- www-data } :${APACHE_RUN_GROUP:- www-data } wp-config.php
127+ chown ${APACHE_RUN_USER} :${APACHE_RUN_GROUP} wp-config.php
120128 fi
121129
122130 # see http://stackoverflow.com/a/2705678/433558
0 commit comments