From b5c4eace32ea78609171b71014b91b68070d5e91 Mon Sep 17 00:00:00 2001 From: Sven Roederer Date: Tue, 27 Feb 2024 14:18:11 +0100 Subject: [PATCH] functions: only update file-permissions when needed Modifying the permissions only for files that have wrong permissions will speed up container start. A welcome sideeffect is no change of ctime, which helps to prevent not needed external backups. --- assets/runtime/functions | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/runtime/functions b/assets/runtime/functions index 0c5f2eb9..a513f5be 100644 --- a/assets/runtime/functions +++ b/assets/runtime/functions @@ -803,8 +803,8 @@ initialize_datadir() { if [ ${REDMINE_DATA_DIR} = ${dir} ]; then mkdir -p ${dir} fi - chmod -R u+rw,go+r ${dir} - chown -R ${REDMINE_USER}: ${dir} + find ${dir} \! -perm -u=wr,go=r -print0 | xargs -0 -r chmod u+rw,go+r + find ${dir} \! -user ${REDMINE_USER} -print0 | xargs -0 -r chown ${REDMINE_USER}: done }