puid and pgid support
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-12-15 09:39:25 +01:00
parent 4e9ca79504
commit 7a8422f208
3 changed files with 14 additions and 3 deletions

View File

@@ -3,12 +3,17 @@
WEBROOT=/data/www
PHP=${PHP:-none}
USERNAME=${USERNAME:-theuser}
PUID=${PUID:-1000}
GROUPNAME=${GROUPNAME:-thegroup}
PGID=${PGID:-1000}
RANDOMPWD=$(tr -dc A-Za-z0-9 </dev/urandom | head -c 13)
adduser -DH -h "${WEBROOT}" -G "nginx" -u "1000" "${USERNAME}"
addgroup -g "${PGID}" "${GROUPNAME}"
addgroup nginx "${GROUPNAME}"
adduser -DH -h "${WEBROOT}" -G "${GROUPNAME}" -u "${PUID}" "${USERNAME}"
printf '%s\n%s' "${RANDOMPWD}" "${RANDOMPWD}" | passwd "${USERNAME}"
echo "password for the user \"${USERNAME}\" is: ${RANDOMPWD}"
chown "${USERNAME}:nginx" "${WEBROOT}" -R
chown "${PUID}:${GROUPNAME}" "${WEBROOT}" -R
find "${WEBROOT}" -type d -exec chmod 0755 {} \;
find "${WEBROOT}" -type f -exec chmod 0644 {} \;