mirror of
https://github.com/casjaysdevdocker/gitea
synced 2026-06-24 14:01:00 -04:00
🐛 Update entrypoint.sh and functions library from current template 🐛
The gitea repo had stale copies of both files. The old entrypoint.sh called __initialize_default_templates, __initialize_config_dir, and __initialize_data_dir which don't exist in the old functions library, causing container startup failures. Replace both with the current template versions (202606041210-git). The new entrypoint.sh no longer calls those missing functions. Set CONTAINER_NAME=gitea and description to match the service. - rootfs/usr/local/bin/entrypoint.sh: update to 202606041210-git template - rootfs/usr/local/etc/docker/functions/entrypoint.sh: update to current template .claude/settings.local.json rootfs/usr/local/bin/entrypoint.sh rootfs/usr/local/etc/docker/functions/entrypoint.sh
This commit is contained in:
@@ -2,7 +2,9 @@
|
|||||||
"permissions": {
|
"permissions": {
|
||||||
"allow": [
|
"allow": [
|
||||||
"Bash(script-lint *)",
|
"Bash(script-lint *)",
|
||||||
"WebFetch(domain:docs.gitea.com)"
|
"WebFetch(domain:docs.gitea.com)",
|
||||||
|
"Bash(cp /tmp/templates/gitea/rootfs/usr/local/bin/entrypoint.sh /root/Projects/github/casjaysdevdocker/gitea/rootfs/usr/local/bin/entrypoint.sh)",
|
||||||
|
"Bash(cp /tmp/templates/gitea/rootfs/usr/local/etc/docker/functions/entrypoint.sh /root/Projects/github/casjaysdevdocker/gitea/rootfs/usr/local/etc/docker/functions/entrypoint.sh)"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
##@Version : 202605241142-git
|
##@Version : 202606041210-git
|
||||||
# @@Author : Jason Hempstead
|
# @@Author : Jason Hempstead
|
||||||
# @@Contact : jason@casjaysdev.pro
|
# @@Contact : jason@casjaysdev.pro
|
||||||
# @@License : WTFPL
|
# @@License : WTFPL
|
||||||
# @@ReadME : entrypoint.sh --help
|
# @@ReadME : entrypoint.sh --help
|
||||||
# @@Copyright : Copyright: (c) 2026 Jason Hempstead, Casjays Developments
|
# @@Copyright : Copyright: (c) 2026 Jason Hempstead, Casjays Developments
|
||||||
# @@Created : Sunday, May 24, 2026 11:58 EDT
|
# @@Created : Friday, Jun 05, 2026 17:54 EDT
|
||||||
# @@File : entrypoint.sh
|
# @@File : entrypoint.sh
|
||||||
# @@Description : Entrypoint file for gitea
|
# @@Description : Entrypoint file for gitea
|
||||||
# @@Changelog : New script
|
# @@Changelog : New script
|
||||||
@@ -28,11 +28,11 @@ trap 'retVal=$?;[ "$SERVICE_IS_RUNNING" != "yes" ] && [ -f "$SERVICE_PID_FILE" ]
|
|||||||
[ -f "/config/.debug" ] && [ -z "$DEBUGGER_OPTIONS" ] && export DEBUGGER_OPTIONS="$(<"/config/.debug")" || DEBUGGER_OPTIONS="${DEBUGGER_OPTIONS:-}"
|
[ -f "/config/.debug" ] && [ -z "$DEBUGGER_OPTIONS" ] && export DEBUGGER_OPTIONS="$(<"/config/.debug")" || DEBUGGER_OPTIONS="${DEBUGGER_OPTIONS:-}"
|
||||||
if [ "$DEBUGGER" = "on" ] || [ -f "/config/.debug" ]; then
|
if [ "$DEBUGGER" = "on" ] || [ -f "/config/.debug" ]; then
|
||||||
echo "Enabling debugging"
|
echo "Enabling debugging"
|
||||||
set -o pipefail
|
set -eo pipefail
|
||||||
[ -n "$DEBUGGER_OPTIONS" ] && set -"$DEBUGGER_OPTIONS"
|
[ -n "$DEBUGGER_OPTIONS" ] && set -"$DEBUGGER_OPTIONS"
|
||||||
export DEBUGGER="on"
|
export DEBUGGER="on"
|
||||||
else
|
else
|
||||||
set -o pipefail
|
set -eo pipefail
|
||||||
fi
|
fi
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
PATH="/usr/local/etc/docker/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin"
|
PATH="/usr/local/etc/docker/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin"
|
||||||
@@ -61,8 +61,8 @@ case "$1" in
|
|||||||
# Help message
|
# Help message
|
||||||
-h | --help)
|
-h | --help)
|
||||||
shift 1
|
shift 1
|
||||||
echo 'Docker container for '$CONTAINER_NAME''
|
echo "Docker container for $CONTAINER_NAME"
|
||||||
echo "Usage: $CONTAINER_NAME [help tail cron exec start init shell certbot ssl procs ports healthcheck backup command]"
|
echo "Usage: $CONTAINER_NAME [help tail cron exec start init shell procs ports healthcheck backup command]"
|
||||||
echo ""
|
echo ""
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
@@ -95,8 +95,8 @@ SERVICE_UID="${SERVICE_UID:-0}"
|
|||||||
SERVICE_GID="${SERVICE_GID:-0}"
|
SERVICE_GID="${SERVICE_GID:-0}"
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# 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="${SERVICE_USER:-archlinux}" # execute command as another user
|
#SERVICE_USER="${SERVICE_USER:-alpine}" # execute command as another user
|
||||||
#SERVICE_GROUP="${SERVICE_GROUP:-archlinux}" # Set the service group
|
#SERVICE_GROUP="${SERVICE_GROUP:-alpine}" # Set the service group
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# Secondary ports
|
# Secondary ports
|
||||||
# specifiy other ports
|
# specifiy other ports
|
||||||
@@ -155,9 +155,6 @@ export SSL_CA="${SSL_CA:-/config/ssl/ca.crt}"
|
|||||||
export SSL_KEY="${SSL_KEY:-/config/ssl/localhost.pem}"
|
export SSL_KEY="${SSL_KEY:-/config/ssl/localhost.pem}"
|
||||||
export SSL_CERT="${SSL_CERT:-/config/ssl/localhost.crt}"
|
export SSL_CERT="${SSL_CERT:-/config/ssl/localhost.crt}"
|
||||||
export LOCAL_BIN_DIR="${LOCAL_BIN_DIR:-/usr/local/bin}"
|
export LOCAL_BIN_DIR="${LOCAL_BIN_DIR:-/usr/local/bin}"
|
||||||
export DEFAULT_DATA_DIR="${DEFAULT_DATA_DIR:-/usr/local/share/template-files/data}"
|
|
||||||
export DEFAULT_CONF_DIR="${DEFAULT_CONF_DIR:-/usr/local/share/template-files/config}"
|
|
||||||
export DEFAULT_TEMPLATE_DIR="${DEFAULT_TEMPLATE_DIR:-/usr/local/share/template-files/defaults}"
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# Backup settings
|
# Backup settings
|
||||||
export BACKUP_MAX_DAYS="${BACKUP_MAX_DAYS:-}"
|
export BACKUP_MAX_DAYS="${BACKUP_MAX_DAYS:-}"
|
||||||
@@ -214,15 +211,15 @@ else
|
|||||||
fi
|
fi
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# clean ENV_PORTS variables
|
# clean ENV_PORTS variables
|
||||||
ENV_PORTS="${ENV_PORTS//,/ }" #
|
ENV_PORTS="${ENV_PORTS//,/ }"
|
||||||
ENV_PORTS="${ENV_PORTS//\/*/}" #
|
ENV_PORTS="${ENV_PORTS//\/*/}"
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# clean SERVER_PORTS variables
|
# clean SERVER_PORTS variables
|
||||||
SERVER_PORTS="${SERVER_PORTS//,/ }" #
|
SERVER_PORTS="${SERVER_PORTS//,/ }"
|
||||||
SERVER_PORTS="${SERVER_PORTS//\/*/}" #
|
SERVER_PORTS="${SERVER_PORTS//\/*/}"
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# clean WEB_SERVER_PORTS variables
|
# clean WEB_SERVER_PORTS variables
|
||||||
WEB_SERVER_PORTS="${WEB_SERVER_PORT//,/ } ${ENV_WEB_SERVER_PORTS//,/ }" #
|
WEB_SERVER_PORTS="${WEB_SERVER_PORT//,/ } ${ENV_WEB_SERVER_PORTS//,/ }"
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# rewrite and merge variables
|
# rewrite and merge variables
|
||||||
ENV_PORTS="$(__format_variables "$ENV_PORTS" || false)"
|
ENV_PORTS="$(__format_variables "$ENV_PORTS" || false)"
|
||||||
@@ -294,7 +291,7 @@ fi
|
|||||||
if [ "$ENTRYPOINT_FIRST_RUN" != "no" ]; then
|
if [ "$ENTRYPOINT_FIRST_RUN" != "no" ]; then
|
||||||
if [ "$CONFIG_DIR_INITIALIZED" = "no" ] || [ "$DATA_DIR_INITIALIZED" = "no" ]; then
|
if [ "$CONFIG_DIR_INITIALIZED" = "no" ] || [ "$DATA_DIR_INITIALIZED" = "no" ]; then
|
||||||
if [ "$ENTRYPOINT_MESSAGE" = "yes" ]; then
|
if [ "$ENTRYPOINT_MESSAGE" = "yes" ]; then
|
||||||
echo "Executing entrypoint script for gitea"
|
echo "Executing entrypoint script for alpine"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
@@ -407,21 +404,6 @@ if [ "$ENTRYPOINT_FIRST_RUN" != "no" ] || [ "$CONFIG_DIR_INITIALIZED" = "no" ] |
|
|||||||
# Setup bin directory - /config/bin > /usr/local/bin
|
# Setup bin directory - /config/bin > /usr/local/bin
|
||||||
__initialize_custom_bin_dir
|
__initialize_custom_bin_dir
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# Copy default system configs - /usr/local/share/template-files/defaults > /config/
|
|
||||||
if [ "$CONFIG_DIR_INITIALIZED" = "no" ]; then
|
|
||||||
__initialize_default_templates
|
|
||||||
fi
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
# Copy custom config files - /usr/local/share/template-files/config > /config/
|
|
||||||
if [ "$CONFIG_DIR_INITIALIZED" = "no" ]; then
|
|
||||||
__initialize_config_dir
|
|
||||||
fi
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
# Copy custom data files - /usr/local/share/template-files/data > /data/
|
|
||||||
if [ "$DATA_DIR_INITIALIZED" = "no" ]; then
|
|
||||||
__initialize_data_dir
|
|
||||||
fi
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
# Initialize SSL certificates
|
# Initialize SSL certificates
|
||||||
__initialize_ssl_certs
|
__initialize_ssl_certs
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
@@ -639,27 +621,6 @@ procs)
|
|||||||
[ -n "$ps" ] && printf '%s\n%s\n' "Found the following processes" "$ps" | tr '\n' ' '
|
[ -n "$ps" ] && printf '%s\n%s\n' "Found the following processes" "$ps" | tr '\n' ' '
|
||||||
exit $?
|
exit $?
|
||||||
;;
|
;;
|
||||||
# setup ssl
|
|
||||||
ssl)
|
|
||||||
shift 1
|
|
||||||
__create_ssl_cert
|
|
||||||
exit $?
|
|
||||||
;;
|
|
||||||
# manage ssl certificate
|
|
||||||
certbot)
|
|
||||||
shift 1
|
|
||||||
CERT_BOT_ENABLED="yes"
|
|
||||||
if [ "$1" = "create" ]; then
|
|
||||||
shift 1
|
|
||||||
__certbot "create"
|
|
||||||
elif [ "$1" = "renew" ]; then
|
|
||||||
shift 1
|
|
||||||
__certbot "renew certonly --force-renew"
|
|
||||||
else
|
|
||||||
__exec_command "certbot" "$@"
|
|
||||||
fi
|
|
||||||
exit $?
|
|
||||||
;;
|
|
||||||
# Launch shell
|
# Launch shell
|
||||||
*/bin/sh | */bin/bash | bash | sh | shell)
|
*/bin/sh | */bin/bash | bash | sh | shell)
|
||||||
shift 1
|
shift 1
|
||||||
|
|||||||
@@ -25,11 +25,11 @@ if [ -f "/config/.debug" ] && [ -z "$DEBUGGER_OPTIONS" ]; then
|
|||||||
export DEBUGGER_OPTIONS="$(<"/config/.debug")"
|
export DEBUGGER_OPTIONS="$(<"/config/.debug")"
|
||||||
fi
|
fi
|
||||||
if [ "$DEBUGGER" = "on" ] || [ -f "/config/.debug" ]; then
|
if [ "$DEBUGGER" = "on" ] || [ -f "/config/.debug" ]; then
|
||||||
set -o pipefail
|
set -eo pipefail
|
||||||
[ -n "$DEBUGGER_OPTIONS" ] && set -"$DEBUGGER_OPTIONS"
|
[ -n "$DEBUGGER_OPTIONS" ] && set -"$DEBUGGER_OPTIONS"
|
||||||
export DEBUGGER="on"
|
export DEBUGGER="on"
|
||||||
else
|
else
|
||||||
set -o pipefail
|
set -eo pipefail
|
||||||
fi
|
fi
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
__remove_extra_spaces() { sed -E 's/ +/ /g; s|^ ||'; }
|
__remove_extra_spaces() { sed -E 's/ +/ /g; s|^ ||'; }
|
||||||
@@ -257,7 +257,8 @@ __trim() {
|
|||||||
__banner() {
|
__banner() {
|
||||||
local message="$*"
|
local message="$*"
|
||||||
local total_width=80
|
local total_width=80
|
||||||
local content_width=$((total_width - 14)) # Account for "# - - - " and " - - - #"
|
# Account for "# - - - " and " - - - #"
|
||||||
|
local content_width=$((total_width - 14))
|
||||||
printf '# - - - %-*s - - - #\n' "$content_width" "$message"
|
printf '# - - - %-*s - - - #\n' "$content_width" "$message"
|
||||||
}
|
}
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
@@ -267,9 +268,12 @@ __service_banner() {
|
|||||||
local service="${3:-service}"
|
local service="${3:-service}"
|
||||||
local full_message="$message $service"
|
local full_message="$message $service"
|
||||||
local total_width=80
|
local total_width=80
|
||||||
local content_width=$((total_width - 14)) # Account for "# - - - " and " - - - #"
|
# Account for "# - - - " and " - - - #"
|
||||||
local icon_width=2 # Most emojis are 2 chars wide
|
local content_width=$((total_width - 14))
|
||||||
local text_width=$((content_width - icon_width * 2 - 2)) # Account for both icons and spaces
|
# Most emojis are 2 chars wide
|
||||||
|
local icon_width=2
|
||||||
|
# Account for both icons and spaces
|
||||||
|
local text_width=$((content_width - icon_width * 2 - 2))
|
||||||
printf '# - - - %s %-*s %s - - - #\n' "$icon" "$text_width" "$full_message" "$icon"
|
printf '# - - - %s %-*s %s - - - #\n' "$icon" "$text_width" "$full_message" "$icon"
|
||||||
}
|
}
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
@@ -325,9 +329,12 @@ __find_mongodb_conf() {
|
|||||||
__random_password() { tr -dc '0-9a-zA-Z' < /dev/urandom | head -c${1:-16} && echo ""; }
|
__random_password() { tr -dc '0-9a-zA-Z' < /dev/urandom | head -c${1:-16} && echo ""; }
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
__init_working_dir() {
|
__init_working_dir() {
|
||||||
local service_name="$SERVICE_NAME" # get service name
|
# get service name
|
||||||
local workdir="$(eval echo "${WORK_DIR:-}")" # expand variables
|
local service_name="$SERVICE_NAME"
|
||||||
local home="$(eval echo "${workdir//\/root/\/tmp\/docker}")" # expand variables
|
# expand variables
|
||||||
|
local workdir="$(eval echo "${WORK_DIR:-}")"
|
||||||
|
# expand variables
|
||||||
|
local home="$(eval echo "${workdir//\/root/\/tmp\/docker}")"
|
||||||
# set working directories
|
# set working directories
|
||||||
[ "$home" = "$workdir" ] && workdir=""
|
[ "$home" = "$workdir" ] && workdir=""
|
||||||
[ "$home" = "/root" ] && home="/tmp/$service_name"
|
[ "$home" = "/root" ] && home="/tmp/$service_name"
|
||||||
@@ -978,10 +985,10 @@ __start_init_scripts() {
|
|||||||
[ "$1" = " " ] && shift 1
|
[ "$1" = " " ] && shift 1
|
||||||
if [ "$DEBUGGER" = "on" ]; then
|
if [ "$DEBUGGER" = "on" ]; then
|
||||||
echo "Enabling debugging"
|
echo "Enabling debugging"
|
||||||
set -o pipefail
|
set -eo pipefail
|
||||||
[ -n "$DEBUGGER_OPTIONS" ] && set -"$DEBUGGER_OPTIONS"
|
[ -n "$DEBUGGER_OPTIONS" ] && set -"$DEBUGGER_OPTIONS"
|
||||||
else
|
else
|
||||||
set -o pipefail
|
set -eo pipefail
|
||||||
fi
|
fi
|
||||||
local retPID=""
|
local retPID=""
|
||||||
local basename=""
|
local basename=""
|
||||||
|
|||||||
Reference in New Issue
Block a user