🗃️ Update codebase 🗃️

rootfs/usr/local/etc/docker/functions/entrypoint.sh
rootfs/usr/local/etc/docker/init.d/08-gitea.sh
This commit is contained in:
casjay
2025-11-29 09:14:55 -05:00
parent 6380077e3a
commit 18875e0298
2 changed files with 10 additions and 8 deletions

View File

@@ -1267,24 +1267,26 @@ __check_service() {
} }
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
__switch_to_user() { __switch_to_user() {
if [ "$RUNAS_USER" = "root" ]; then # Use SERVICE_USER if set, otherwise fall back to RUNAS_USER
local switch_user="${SERVICE_USER:-$RUNAS_USER}"
if [ "$switch_user" = "root" ]; then
su_exec="" su_exec=""
su_cmd() { eval "$@" || return 1; } su_cmd() { eval "$@" || return 1; }
elif [ "$(builtin type -P gosu)" ]; then elif [ "$(builtin type -P gosu)" ]; then
su_exec="gosu $RUNAS_USER" su_exec="gosu $switch_user"
su_cmd() { $su_exec "$@" || return 1; } su_cmd() { $su_exec "$@" || return 1; }
elif [ "$(builtin type -P runuser)" ]; then elif [ "$(builtin type -P runuser)" ]; then
su_exec="runuser -u $RUNAS_USER" su_exec="runuser -u $switch_user"
su_cmd() { $su_exec "$@" || return 1; } su_cmd() { $su_exec "$@" || return 1; }
elif [ "$(builtin type -P sudo)" ]; then elif [ "$(builtin type -P sudo)" ]; then
su_exec="sudo -u $RUNAS_USER" su_exec="sudo -u $switch_user"
su_cmd() { $su_exec "$@" || return 1; } su_cmd() { $su_exec "$@" || return 1; }
elif [ "$(builtin type -P su)" ]; then elif [ "$(builtin type -P su)" ]; then
su_exec="su -s /bin/sh - $RUNAS_USER" su_exec="su -s /bin/sh - $switch_user"
su_cmd() { $su_exec -c "$@" || return 1; } su_cmd() { $su_exec -c "$@" || return 1; }
else else
su_exec="" su_exec=""
su_cmd() { echo "Can not switch to $RUNAS_USER: attempting to run as root" && eval "$@" || return 1; } su_cmd() { echo "Can not switch to $switch_user: attempting to run as root" && eval "$@" || return 1; }
fi fi
export su_exec export su_exec
} }

View File

@@ -112,8 +112,8 @@ SERVICE_PORT="80"
RUNAS_USER="root" # normally root RUNAS_USER="root" # normally root
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# User and group in which the service switches to - IE: nginx,apache,mysql,postgres # User and group in which the service switches to - IE: nginx,apache,mysql,postgres
SERVICE_USER="gitea" # execute command as another user SERVICE_USER="git" # execute command as another user
SERVICE_GROUP="gitea" # Set the service group SERVICE_GROUP="git" # Set the service group
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# Set password length # Set password length
RANDOM_PASS_USER="" RANDOM_PASS_USER=""