From 092e9d552bb6a24e3b4eb850de1922b26ccbbf67 Mon Sep 17 00:00:00 2001 From: paspo Date: Thu, 31 Jul 2025 15:19:37 +0200 Subject: [PATCH] fix #11: added DISABLE_WEBROOT_CHOWN --- README.md | 3 ++- rootfs/app/entrypoint.sh | 4 ++++ rootfs/app/entrypoint.sh.d/90_chown_webroot.sh | 9 +++++++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fde01b2..2feccb4 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,8 @@ services: FPM_MAX_CHILDREN: 5 # default: 5 FPM_START_SERVERS: 1 # default: 1 FPM_MIN_SPARE_SERVERS: 1 # default: 1 - FPM_MAX_SPARE_SERVERS: 3 # default: 3 + FPM_MAX_SPARE_SERVERS: 3 # default: 3 + DISABLE_WEBROOT_CHOWN: 1 # default: 0 ``` The `/data/www` and `/data/logs` directories and their contents will be chowned to `$PUID:$PGID` and chmodded to `0755` for directories and `0644` for files at container start. diff --git a/rootfs/app/entrypoint.sh b/rootfs/app/entrypoint.sh index c7cc522..9203b36 100755 --- a/rootfs/app/entrypoint.sh +++ b/rootfs/app/entrypoint.sh @@ -24,6 +24,8 @@ FPM_START_SERVERS=${FPM_START_SERVERS:-1} FPM_MIN_SPARE_SERVERS=${FPM_MIN_SPARE_SERVERS:-1} FPM_MAX_SPARE_SERVERS=${FPM_MAX_SPARE_SERVERS:-3} +DISABLE_WEBROOT_CHOWN=${DISABLE_WEBROOT_CHOWN:-0} + export USERNAME export GROUPNAME export PATH_BASE @@ -46,6 +48,8 @@ export FPM_START_SERVERS export FPM_MIN_SPARE_SERVERS export FPM_MAX_SPARE_SERVERS +export DISABLE_WEBROOT_CHOWN + # run all scripts in order run-parts /app/entrypoint.sh.d diff --git a/rootfs/app/entrypoint.sh.d/90_chown_webroot.sh b/rootfs/app/entrypoint.sh.d/90_chown_webroot.sh index 8d7076f..7bee33b 100755 --- a/rootfs/app/entrypoint.sh.d/90_chown_webroot.sh +++ b/rootfs/app/entrypoint.sh.d/90_chown_webroot.sh @@ -1,7 +1,12 @@ #!/bin/sh -echo "# chowning ${PATH_WEBROOT} to ${PUID}:${GROUPNAME}..." +echo "# Started background chowning of ${PATH_WEBROOT} to ${USERNAME}:${GROUPNAME} (${PUID}:${PGID})..." -chown "${PUID}:${GROUPNAME}" "${PATH_WEBROOT}" -R +if [ ${DISABLE_WEBROOT_CHOWN} -eq 1 ] ; then + echo chowning skipped because of DISABLE_WEBROOT_CHOWN + exit 0 +fi + +chown "${USERNAME}:${GROUPNAME}" "${PATH_WEBROOT}" -R find "${PATH_WEBROOT}" -type d -exec chmod 0755 {} \; & find "${PATH_WEBROOT}" -type f -exec chmod 0644 {} \; &