-
Notifications
You must be signed in to change notification settings - Fork 1
/
apache.setup.sh
21 lines (19 loc) · 825 Bytes
/
apache.setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env bash
if [ ! "$(getent group ${UNIX_GROUP})" ]; then
echo "Create group ${UNIX_GROUP}"
if [ "$(which apk)" ]; then
addgroup -g "${UNIX_GID}" "${UNIX_GROUP}"
else
groupadd --gid "${UNIX_GID}" "${UNIX_GROUP}"
fi
fi
sed --in-place --expression="s/APACHE_RUN_GROUP:=www-data/APACHE_RUN_GROUP:=${UNIX_GROUP}/g" /etc/apache2/envvars
if [ ! "$(getent passwd "${UNIX_USERNAME}")" ]; then
echo "Create user ${UNIX_USERNAME}"
if [ "$(which apk)" ]; then
adduser -D -h /home/developer -u "${UNIX_UID}" "${UNIX_USERNAME}" -G "${UNIX_GROUP}"
else
useradd --home /home/developer --uid "${UNIX_UID}" --gid "${UNIX_GID}" "${UNIX_USERNAME}"
fi
fi
sed --in-place --expression="s/APACHE_RUN_USER:=www-data/APACHE_RUN_USER:=${UNIX_USERNAME}/g" /etc/apache2/envvars