From 99c91d922b06652fdd4e45aa1cb100eeffb39ad7 Mon Sep 17 00:00:00 2001 From: casjay Date: Thu, 1 Aug 2024 15:01:58 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=97=83=EF=B8=8F=20Committing=20everything?= =?UTF-8?q?=20that=20changed=20=F0=9F=97=83=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit rootfs/usr/local/etc/docker/functions/entrypoint.sh --- rootfs/usr/local/etc/docker/functions/entrypoint.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/rootfs/usr/local/etc/docker/functions/entrypoint.sh b/rootfs/usr/local/etc/docker/functions/entrypoint.sh index 9655491..07186cd 100644 --- a/rootfs/usr/local/etc/docker/functions/entrypoint.sh +++ b/rootfs/usr/local/etc/docker/functions/entrypoint.sh @@ -495,13 +495,13 @@ __set_user_group_id() { # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - __create_service_user() { local exitStatus=0 - local set_home_dir="" local create_user="${1:-$SERVICE_USER}" local create_group="${2:-${SERVICE_GROUP:-$create_user}}" - local create_home_dir="${3:-${WORK_DIR:-/home/$create_user}}" + local create_home_dir="${3:-$WORK_DIR}" local create_uid="${4:-${SERVICE_UID:-$USER_UID}}" local create_gid="${5:-${SERVICE_GID:-$USER_GID}}" local random_id="$(__generate_random_uids)" + local create_home_dir="${create_home_dir:-/home/$create_user}" grep -sq "^$create_user:" "/etc/passwd" && grep -sq "^$create_group:" "/etc/group" && return [ "$create_user" = "root" ] && [ "$create_group" = "root" ] && return 0 if [ "$RUNAS_USER" != "root" ] && [ "$RUNAS_USER" != "" ]; then @@ -532,7 +532,11 @@ __create_service_user() { fi grep -qs "$create_group" "/etc/group" || exitStatus=$((exitCode + 1)) grep -qs "$create_user" "/etc/passwd" || exitStatus=$((exitCode + 1)) - [ $exitStatus -eq 0 ] && export WORK_DIR="${set_home_dir:-}" && mkdir -p "$WORK_DIR" + [ $exitStatus -eq 0 ] && export WORK_DIR="${create_home_dir:-}" + if [ -n "$WORK_DIR" ]; then + [ -d "$WORK_DIR" ] || mkdir -p "$WORK_DIR" + [ -d "/etc/.skel" ] && cp -Rf /etc/.skel/. "$WORK_DIR/" + fi export SERVICE_UID="$create_uid" SERVICE_GID="$create_gid" export SERVICE_USER="$create_user" SERVICE_GROUP="$create_group" return $exitStatus