mirror of
https://github.com/casjaysdevdocker/gitea
synced 2025-09-21 03:57:48 -04:00
🗃️ Committing everything that changed 🗃️
Some checks failed
release-tag / release-image (push) Failing after 20s
Some checks failed
release-tag / release-image (push) Failing after 20s
rootfs/usr/local/etc/docker/functions/entrypoint.sh rootfs/usr/local/etc/docker/init.d/05-dockerd.sh rootfs/usr/local/etc/docker/init.d/08-gitea.sh rootfs/usr/local/etc/docker/init.d/zz-act_runner.sh
This commit is contained in:
26
rootfs/usr/local/etc/docker/init.d/05-dockerd.sh
Executable file → Normal file
26
rootfs/usr/local/etc/docker/init.d/05-dockerd.sh
Executable file → Normal file
@@ -36,13 +36,25 @@ export PATH="/usr/local/etc/docker/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/s
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
SCRIPT_FILE="$0"
|
||||
SERVICE_NAME="docker"
|
||||
# Function to exit appropriately based on context
|
||||
__script_exit() {
|
||||
local exit_code="${1:-0}"
|
||||
if [ "${BASH_SOURCE[0]}" != "${0}" ]; then
|
||||
# Script is being sourced - use return
|
||||
return "$exit_code"
|
||||
else
|
||||
# Script is being executed - use exit
|
||||
exit "$exit_code"
|
||||
fi
|
||||
}
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
SCRIPT_NAME="$(basename "$SCRIPT_FILE" 2>/dev/null)"
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# exit if __start_init_scripts function hasn't been Initialized
|
||||
if [ ! -f "/run/__start_init_scripts.pid" ]; then
|
||||
echo "__start_init_scripts function hasn't been Initialized" >&2
|
||||
SERVICE_IS_RUNNING="no"
|
||||
exit 1
|
||||
__script_exit 1
|
||||
fi
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# import the functions file
|
||||
@@ -55,8 +67,6 @@ for set_env in "/root/env.sh" "/usr/local/etc/docker/env"/*.sh "/config/env"/*.s
|
||||
[ -f "$set_env" ] && . "$set_env"
|
||||
done
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
printf '%s\n' "# - - - Initializing $SERVICE_NAME - - - #"
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Custom functions
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
@@ -256,7 +266,7 @@ EOF
|
||||
if [ $exitStatus -ne 0 ]; then
|
||||
echo "The pre-execution check has failed" >&2
|
||||
[ -f "$SERVICE_PID_FILE" ] && rm -Rf "$SERVICE_PID_FILE"
|
||||
exit 1
|
||||
__script_exit 1
|
||||
fi
|
||||
return $exitStatus
|
||||
}
|
||||
@@ -413,7 +423,7 @@ __run_start_script() {
|
||||
__post_execute 2>"/dev/stderr" | tee -p -a "$LOG_DIR/init.txt"
|
||||
retVal=$?
|
||||
echo "Initializing $SCRIPT_NAME has completed"
|
||||
exit $retVal
|
||||
__script_exit $retVal
|
||||
else
|
||||
# ensure the command exists
|
||||
if [ ! -x "$cmd" ]; then
|
||||
@@ -448,7 +458,7 @@ __run_start_script() {
|
||||
if [ ! -f "$START_SCRIPT" ]; then
|
||||
cat <<EOF >"$START_SCRIPT"
|
||||
#!/usr/bin/env bash
|
||||
trap 'exitCode=\$?;[ \$exitCode -ne 0 ] && [ -f "\$SERVICE_PID_FILE" ] && rm -Rf "\$SERVICE_PID_FILE";exit \$exitCode' EXIT
|
||||
trap 'exitCode=\$?;if [ \$exitCode -ne 0 ] && [ -f "\$SERVICE_PID_FILE" ]; then rm -Rf "\$SERVICE_PID_FILE"; fi; exit \$exitCode' EXIT
|
||||
#
|
||||
set -Eeo pipefail
|
||||
# Setting up $cmd to run as ${SERVICE_USER:-root} with env
|
||||
@@ -470,7 +480,7 @@ EOF
|
||||
execute_command="$(__trim "$su_exec $cmd_exec")"
|
||||
cat <<EOF >"$START_SCRIPT"
|
||||
#!/usr/bin/env bash
|
||||
trap 'exitCode=\$?;[ \$exitCode -ne 0 ] && [ -f "\$SERVICE_PID_FILE" ] && rm -Rf "\$SERVICE_PID_FILE";exit \$exitCode' EXIT
|
||||
trap 'exitCode=\$?;if [ \$exitCode -ne 0 ] && [ -f "\$SERVICE_PID_FILE" ]; then rm -Rf "\$SERVICE_PID_FILE"; fi; exit \$exitCode' EXIT
|
||||
#
|
||||
set -Eeo pipefail
|
||||
# Setting up $cmd to run as ${SERVICE_USER:-root}
|
||||
@@ -628,4 +638,4 @@ fi
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
__banner "Initializing of $SERVICE_NAME has completed with statusCode: $SERVICE_EXIT_CODE" | tee -p -a "/data/logs/entrypoint.log" "$LOG_DIR/init.txt"
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
exit $SERVICE_EXIT_CODE
|
||||
__script_exit $SERVICE_EXIT_CODE
|
||||
|
Reference in New Issue
Block a user