Skip to content

Commit e3bc10f

Browse files
committed
Add "apache2-foreground" to the top-level and copy it into apache variant directories
1 parent 1f00ae6 commit e3bc10f

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

apache2-foreground

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Note: we don't just use "apache2ctl" here because it itself is just a shell-script wrapper around apache2 which provides extra functionality like "apache2ctl start" for launching apache2 in the background.
5+
# (also, when run as "apache2ctl <apache args>", it does not use "exec", which leaves an undesirable resident shell process)
6+
7+
: "${APACHE_CONFDIR:=/etc/apache2}"
8+
: "${APACHE_ENVVARS:=$APACHE_CONFDIR/envvars}"
9+
if test -f "$APACHE_ENVVARS"; then
10+
. "$APACHE_ENVVARS"
11+
fi
12+
13+
# Apache gets grumpy about PID files pre-existing
14+
: "${APACHE_RUN_DIR:=/var/run/apache2}"
15+
: "${APACHE_PID_FILE:=$APACHE_RUN_DIR/apache2.pid}"
16+
rm -f "$APACHE_PID_FILE"
17+
18+
# create missing directories
19+
# (especially APACHE_RUN_DIR, APACHE_LOCK_DIR, and APACHE_LOG_DIR)
20+
for e in "${!APACHE_@}"; do
21+
if [[ "$e" == *_DIR ]] && [[ "${!e}" == /* ]]; then
22+
# handle "/var/lock" being a symlink to "/run/lock", but "/run/lock" not existing beforehand, so "/var/lock/something" fails to mkdir
23+
# mkdir: cannot create directory '/var/lock': File exists
24+
dir="${!e}"
25+
while [ "$dir" != "$(dirname "$dir")" ]; do
26+
dir="$(dirname "$dir")"
27+
if [ -d "$dir" ]; then
28+
break
29+
fi
30+
absDir="$(readlink -f "$dir" 2>/dev/null || :)"
31+
if [ -n "$absDir" ]; then
32+
mkdir -p "$absDir"
33+
fi
34+
done
35+
36+
mkdir -p "${!e}"
37+
fi
38+
done
39+
40+
exec apache2 -DFOREGROUND "$@"

update.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,14 @@ for version in "${versions[@]}"; do
147147
ia && ac == 1 { system("cat " variant "-Dockerfile-block-" ab) }
148148
' "$version/$suite/$variant/Dockerfile"
149149

150-
cp \
150+
cp -a \
151151
docker-php-entrypoint \
152152
docker-php-ext-* \
153153
docker-php-source \
154154
"$version/$suite/$variant/"
155+
if [ "$variant" = 'apache' ]; then
156+
cp -a apache2-foreground "$version/$suite/$variant/"
157+
fi
155158

156159
if [ "$alpineVer" = '3.4' ]; then
157160
sed -ri 's!libressl!openssl!g' "$version/$suite/$variant/Dockerfile"

0 commit comments

Comments
 (0)