🗃️ Committing everything that changed 🗃️

rootfs/usr/local/etc/docker/functions/entrypoint.sh
This commit is contained in:
casjay 2024-08-01 15:00:42 -04:00
parent b9b9650573
commit d17b4f0ac6
Signed by untrusted user who does not match committer: jason
GPG Key ID: 1AB309F42A764145

View File

@ -495,18 +495,20 @@ __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
create_user="$RUNAS_USER"
create_group="$RUNAS_USER"
create_uid="${create_uid:-1000}"
create_gid="${create_gid:-1000}"
fi
create_uid="$(__get_uid "$set_user" || echo "$create_uid")"
create_gid="$(__get_gid "$set_user" || echo "$create_gid")"
@ -530,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:-}"
[ $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