@@ -24,14 +24,22 @@ file_env() {
24
24
}
25
25
26
26
if [[ " $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
+
27
31
if ! [ -e index.php -a -e wp-includes/version.php ]; then
28
32
echo >&2 " WordPress not found in $PWD - copying now..."
29
33
if [ " $( ls -A) " ]; then
30
34
echo >&2 " WARNING: $PWD is not empty - press Ctrl+C now if this is an error!"
31
35
( set -x; ls -A; sleep 10 )
32
36
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 -
35
43
echo >&2 " Complete! WordPress has been successfully copied to $PWD "
36
44
if [ ! -e .htaccess ]; then
37
45
# NOTE: The "Indexes" option is disabled in the php:apache base image
@@ -47,7 +55,7 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
47
55
</IfModule>
48
56
# END WordPress
49
57
EOF
50
- chown ${APACHE_RUN_USER:- www-data } :${APACHE_RUN_GROUP:- www-data } .htaccess
58
+ chown ${APACHE_RUN_USER} :${APACHE_RUN_GROUP} .htaccess
51
59
fi
52
60
fi
53
61
@@ -116,7 +124,7 @@ if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROT
116
124
}
117
125
118
126
EOPHP
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
120
128
fi
121
129
122
130
# see http://stackoverflow.com/a/2705678/433558
0 commit comments