From 899e5280999f05437662ead3660fbad9d814d54b Mon Sep 17 00:00:00 2001 From: casjay Date: Fri, 5 Jun 2026 18:24:24 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Update=20entrypoint.sh=20and=20f?= =?UTF-8?q?unctions=20library=20from=20current=20template=20=F0=9F=90=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Stale copies called __initialize_default_templates, __initialize_config_dir, and __initialize_data_dir which are not in the old functions library, causing container startup failures. Replaced with current template versions (202606041210-git) which no longer call those missing functions. - rootfs/usr/local/bin/entrypoint.sh: update to current template - rootfs/usr/local/etc/docker/functions/entrypoint.sh: update to current template rootfs/usr/local/bin/entrypoint.sh rootfs/usr/local/etc/docker/functions/entrypoint.sh --- rootfs/usr/local/bin/entrypoint.sh | 91 ++++++------------- .../local/etc/docker/functions/entrypoint.sh | 29 +++--- 2 files changed, 44 insertions(+), 76 deletions(-) diff --git a/rootfs/usr/local/bin/entrypoint.sh b/rootfs/usr/local/bin/entrypoint.sh index f8ee44a..d46840e 100755 --- a/rootfs/usr/local/bin/entrypoint.sh +++ b/rootfs/usr/local/bin/entrypoint.sh @@ -1,15 +1,15 @@ #!/usr/bin/env bash # shellcheck shell=bash # - - - - - - - - - - - - - - - - - - - - - - - - - -##@Version : 202605052024-git +##@Version : 202606041210-git # @@Author : Jason Hempstead # @@Contact : jason@casjaysdev.pro # @@License : WTFPL # @@ReadME : entrypoint.sh --help # @@Copyright : Copyright: (c) 2026 Jason Hempstead, Casjays Developments -# @@Created : Wednesday, May 06, 2026 23:32 EDT +# @@Created : Friday, Jun 05, 2026 18:12 EDT # @@File : entrypoint.sh -# @@Description : Entrypoint file for blueonyx +# @@Description : Entrypoint file for almalinux # @@Changelog : New script # @@TODO : Better documentation # @@Other : @@ -21,23 +21,25 @@ # shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2090,SC2115,SC2120,SC2155,SC2199,SC2229,SC2317,SC2329 # - - - - - - - - - - - - - - - - - - - - - - - - - # run trap command on exit -trap 'retVal=$?;[ "$SERVICE_IS_RUNNING" != "yes" ] && [ -f "$SERVICE_PID_FILE" ] && rm -Rf "$SERVICE_PID_FILE";exit $retVal' INT TERM PWR +trap 'retVal=$?;[ "$SERVICE_IS_RUNNING" != "yes" ] && [ -f "$SERVICE_PID_FILE" ] && rm -Rf "$SERVICE_PID_FILE";exit $retVal' INT TERM +trap 'retVal=$?;[ "$SERVICE_IS_RUNNING" != "yes" ] && [ -f "$SERVICE_PID_FILE" ] && rm -Rf "$SERVICE_PID_FILE";exit $retVal' SIGPWR 2>/dev/null || true # - - - - - - - - - - - - - - - - - - - - - - - - - # setup debugging - https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html [ -f "/config/.debug" ] && [ -z "$DEBUGGER_OPTIONS" ] && export DEBUGGER_OPTIONS="$(<"/config/.debug")" || DEBUGGER_OPTIONS="${DEBUGGER_OPTIONS:-}" if [ "$DEBUGGER" = "on" ] || [ -f "/config/.debug" ]; then echo "Enabling debugging" - set -o pipefail -x$DEBUGGER_OPTIONS + set -eo pipefail + [ -n "$DEBUGGER_OPTIONS" ] && set -"$DEBUGGER_OPTIONS" export DEBUGGER="on" else - set -o pipefail + set -eo pipefail fi # - - - - - - - - - - - - - - - - - - - - - - - - - PATH="/usr/local/etc/docker/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin" # - - - - - - - - - - - - - - - - - - - - - - - - - # Set bash options SCRIPT_FILE="$0" -CONTAINER_NAME="blueonyx" +CONTAINER_NAME="almalinux" SCRIPT_NAME="${SCRIPT_FILE##*/}" CONTAINER_NAME="${ENV_CONTAINER_NAME:-$CONTAINER_NAME}" # - - - - - - - - - - - - - - - - - - - - - - - - - @@ -59,8 +61,8 @@ case "$1" in # Help message -h | --help) shift 1 - 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 "Docker container for $CONTAINER_NAME" + echo "Usage: $CONTAINER_NAME [help tail cron exec start init shell procs ports healthcheck backup command]" echo "" exit 0 ;; @@ -93,8 +95,8 @@ SERVICE_UID="${SERVICE_UID:-0}" SERVICE_GID="${SERVICE_GID:-0}" # - - - - - - - - - - - - - - - - - - - - - - - - - # User and group in which the service switches to - IE: nginx,apache,mysql,postgres -#SERVICE_USER="${SERVICE_USER:-blueonyx}" # execute command as another user -#SERVICE_GROUP="${SERVICE_GROUP:-blueonyx}" # Set the service group +#SERVICE_USER="${SERVICE_USER:-almalinux}" # execute command as another user +#SERVICE_GROUP="${SERVICE_GROUP:-almalinux}" # Set the service group # - - - - - - - - - - - - - - - - - - - - - - - - - # Secondary ports # specifiy other ports @@ -149,13 +151,10 @@ export DOMAINNAME="$(hostname -d)" # - - - - - - - - - - - - - - - - - - - - - - - - - # Default directories export SSL_DIR="${SSL_DIR:-/config/ssl}" -export SSL_CA="${SSL_CERT:-/config/ssl/ca.crt}" +export SSL_CA="${SSL_CA:-/config/ssl/ca.crt}" export SSL_KEY="${SSL_KEY:-/config/ssl/localhost.pem}" export SSL_CERT="${SSL_CERT:-/config/ssl/localhost.crt}" 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 export BACKUP_MAX_DAYS="${BACKUP_MAX_DAYS:-}" @@ -170,7 +169,7 @@ export NGINX_CONFIG_FILE="${NGINX_CONFIG_FILE:-$(__find_nginx_conf)}" export MYSQL_CONFIG_FILE="${MYSQL_CONFIG_FILE:-$(__find_mysql_conf)}" export PGSQL_CONFIG_FILE="${PGSQL_CONFIG_FILE:-$(__find_pgsql_conf)}" export MONGODB_CONFIG_FILE="${MONGODB_CONFIG_FILE:-$(__find_mongodb_conf)}" -export ENTRYPOINT_PID_FILE="${ENTRYPOINT_PID_FILE:-$ENTRYPOINT_PID_FILE}" +export ENTRYPOINT_PID_FILE="${ENTRYPOINT_PID_FILE:-/run/.entrypoint.pid}" export ENTRYPOINT_INIT_FILE="${ENTRYPOINT_INIT_FILE:-/config/.entrypoint.done}" export ENTRYPOINT_DATA_INIT_FILE="${ENTRYPOINT_DATA_INIT_FILE:-/data/.docker_has_run}" export ENTRYPOINT_CONFIG_INIT_FILE="${ENTRYPOINT_CONFIG_INIT_FILE:-/config/.docker_has_run}" @@ -212,17 +211,15 @@ else fi # - - - - - - - - - - - - - - - - - - - - - - - - - # clean ENV_PORTS variables -ENV_PORTS="${ENV_PORTS//,/ }" # -ENV_PORTS="${ENV_PORTS//\/*/}" # +ENV_PORTS="${ENV_PORTS//,/ }" +ENV_PORTS="${ENV_PORTS//\/*/}" # - - - - - - - - - - - - - - - - - - - - - - - - - # 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 -WEB_SERVER_PORTS="${WEB_SERVER_PORT//\/*/}" # -WEB_SERVER_PORTS="${WEB_SERVER_PORTS//\/*/}" # -WEB_SERVER_PORTS="${WEB_SERVER_PORT//,/ } ${ENV_WEB_SERVER_PORTS//,/ }" # +WEB_SERVER_PORTS="${WEB_SERVER_PORT//,/ } ${ENV_WEB_SERVER_PORTS//,/ }" # - - - - - - - - - - - - - - - - - - - - - - - - - # rewrite and merge variables ENV_PORTS="$(__format_variables "$ENV_PORTS" || false)" @@ -294,7 +291,7 @@ fi if [ "$ENTRYPOINT_FIRST_RUN" != "no" ]; then if [ "$CONFIG_DIR_INITIALIZED" = "no" ] || [ "$DATA_DIR_INITIALIZED" = "no" ]; then if [ "$ENTRYPOINT_MESSAGE" = "yes" ]; then - echo "Executing entrypoint script for blueonyx" + echo "Executing entrypoint script for almalinux" fi fi # - - - - - - - - - - - - - - - - - - - - - - - - - @@ -407,21 +404,6 @@ if [ "$ENTRYPOINT_FIRST_RUN" != "no" ] || [ "$CONFIG_DIR_INITIALIZED" = "no" ] | # Setup bin directory - /config/bin > /usr/local/bin __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_certs # - - - - - - - - - - - - - - - - - - - - - - - - - @@ -489,7 +471,7 @@ __set_user_group_id $SERVICE_USER ${SERVICE_UID:-} ${SERVICE_GID:-} __run_message # - - - - - - - - - - - - - - - - - - - - - - - - - # Just start services -START_SERVICES="${START_SERVICES:-SYSTEM_INIT}" +START_SERVICES="${START_SERVICES:-yes}" # - - - - - - - - - - - - - - - - - - - - - - - - - # Determine if we should start services based on command # Only skip service start for the 'init' command @@ -547,10 +529,10 @@ logs) tail -Fq /data/logs/*/* ;; clean) - log_files="$(find "/data/logs" -type f)" + mapfile -t log_files < <(find "/data/logs" -type f 2>/dev/null) for log in "${log_files[@]}"; do __log_info "Clearing log file: $log" - printf '' >$log + printf '' >"$log" done ;; *) @@ -585,7 +567,7 @@ healthcheck) healthPorts="${WEB_SERVER_PORTS:-}" healthEndPoints="${HEALTH_ENDPOINTS:-}" SERVICES_LIST="${arguments:-$SERVICES_LIST}" - services="$(echo "${SERVICES_LIST//,/ }")" + services="${SERVICES_LIST//,/ }" healthMessage="Everything seems to be running" [ "$healthEnabled" = "yes" ] || exit 0 if [ -d "/run/healthcheck" ] && ! __is_dir_empty "/run/healthcheck"; then @@ -603,7 +585,7 @@ healthcheck) fi fi done - for port in $ports; do + for port in $healthPorts; do if command -v netstat &>/dev/null && [ -n "$port" ]; then if ! netstat -taupln | grep -q ":$port "; then echo "$port isn't open" >&2 @@ -639,27 +621,6 @@ procs) [ -n "$ps" ] && printf '%s\n%s\n' "Found the following processes" "$ps" | tr '\n' ' ' 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 */bin/sh | */bin/bash | bash | sh | shell) shift 1 diff --git a/rootfs/usr/local/etc/docker/functions/entrypoint.sh b/rootfs/usr/local/etc/docker/functions/entrypoint.sh index 46003c3..bf2f7b6 100644 --- a/rootfs/usr/local/etc/docker/functions/entrypoint.sh +++ b/rootfs/usr/local/etc/docker/functions/entrypoint.sh @@ -25,11 +25,11 @@ if [ -f "/config/.debug" ] && [ -z "$DEBUGGER_OPTIONS" ]; then export DEBUGGER_OPTIONS="$(<"/config/.debug")" fi if [ "$DEBUGGER" = "on" ] || [ -f "/config/.debug" ]; then - set -o pipefail + set -eo pipefail [ -n "$DEBUGGER_OPTIONS" ] && set -"$DEBUGGER_OPTIONS" export DEBUGGER="on" else - set -o pipefail + set -eo pipefail fi # - - - - - - - - - - - - - - - - - - - - - - - - - __remove_extra_spaces() { sed -E 's/ +/ /g; s|^ ||'; } @@ -257,7 +257,8 @@ __trim() { __banner() { local message="$*" 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" } # - - - - - - - - - - - - - - - - - - - - - - - - - @@ -267,9 +268,12 @@ __service_banner() { local service="${3:-service}" local full_message="$message $service" local total_width=80 - local content_width=$((total_width - 14)) # Account for "# - - - " and " - - - #" - local icon_width=2 # Most emojis are 2 chars wide - local text_width=$((content_width - icon_width * 2 - 2)) # Account for both icons and spaces + # Account for "# - - - " and " - - - #" + local content_width=$((total_width - 14)) + # 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" } # - - - - - - - - - - - - - - - - - - - - - - - - - @@ -325,9 +329,12 @@ __find_mongodb_conf() { __random_password() { tr -dc '0-9a-zA-Z' < /dev/urandom | head -c${1:-16} && echo ""; } # - - - - - - - - - - - - - - - - - - - - - - - - - __init_working_dir() { - local service_name="$SERVICE_NAME" # get service name - local workdir="$(eval echo "${WORK_DIR:-}")" # expand variables - local home="$(eval echo "${workdir//\/root/\/tmp\/docker}")" # expand variables + # get service name + local service_name="$SERVICE_NAME" + # expand variables + local workdir="$(eval echo "${WORK_DIR:-}")" + # expand variables + local home="$(eval echo "${workdir//\/root/\/tmp\/docker}")" # set working directories [ "$home" = "$workdir" ] && workdir="" [ "$home" = "/root" ] && home="/tmp/$service_name" @@ -978,10 +985,10 @@ __start_init_scripts() { [ "$1" = " " ] && shift 1 if [ "$DEBUGGER" = "on" ]; then echo "Enabling debugging" - set -o pipefail + set -eo pipefail [ -n "$DEBUGGER_OPTIONS" ] && set -"$DEBUGGER_OPTIONS" else - set -o pipefail + set -eo pipefail fi local retPID="" local basename=""