From 062e3ff69f27158fef9af7c4a6e49a4a9884bd05 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 f183f62f..9b8beca1 100644 --- a/assets/runtime/functions +++ b/assets/runtime/functions @@ -810,8 +810,8 @@ initialize_datadir() { ) for dir in "${datafolders[@]}"; do mkdir -p "${dir}" - 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 # special permissions for ~/.ssh