-
Notifications
You must be signed in to change notification settings - Fork 1
/
fpm.setup.sh
21 lines (19 loc) · 811 Bytes
/
fpm.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/group = www-data/group = ${UNIX_GROUP}/g" /usr/local/etc/php-fpm.d/www.conf
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/user = www-data/user = ${UNIX_USERNAME}/g" /usr/local/etc/php-fpm.d/www.conf