From 6ad364ab140acd75e3b097952d635b30878c5fe3 Mon Sep 17 00:00:00 2001 From: Thierry Corbin Date: Tue, 19 Dec 2017 09:55:04 +0100 Subject: [PATCH] Accelerate map_uidgid Hi, I use the function "map_uidgid" and each restart of the container is at least 30 seconds for the command chown. With this change I am 1 second. I added the path ${GITLAB_HOME} at the end to not get an error if the "find" finds nothing. does this change suit you? --- assets/runtime/functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/runtime/functions b/assets/runtime/functions index 44917d19..791b4930 100644 --- a/assets/runtime/functions +++ b/assets/runtime/functions @@ -1144,7 +1144,7 @@ map_uidgid() { echo "Mapping UID and GID for ${GITLAB_USER}:${GITLAB_USER} to $USERMAP_UID:$USERMAP_GID" groupmod -o -g ${USERMAP_GID} ${GITLAB_USER} sed -i -e "s|:${USERMAP_ORIG_UID}:${USERMAP_GID}:|:${USERMAP_UID}:${USERMAP_GID}:|" /etc/passwd - find ${GITLAB_HOME} -path ${GITLAB_DATA_DIR}/\* -prune -o -print0 | xargs -0 chown -h ${GITLAB_USER}: + find ${GITLAB_HOME} -path ${GITLAB_DATA_DIR}/\* \( ! -uid ${USERMAP_ORIG_UID} -o ! -gid ${USERMAP_ORIG_GID} \) -print0 | xargs -0 chown -h ${GITLAB_USER}: ${GITLAB_HOME} fi }