diff --git a/rootfs/usr/local/bin/entrypoint.sh b/rootfs/usr/local/bin/entrypoint.sh index e966597..3c1dd86 100755 --- a/rootfs/usr/local/bin/entrypoint.sh +++ b/rootfs/usr/local/bin/entrypoint.sh @@ -1,13 +1,13 @@ #!/usr/bin/env bash # shellcheck shell=bash # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -##@Version : 202309031603-git +##@Version : 202309031648-git # @@Author : Jason Hempstead # @@Contact : jason@casjaysdev.pro # @@License : WTFPL # @@ReadME : docker-entrypoint --help # @@Copyright : Copyright: (c) 2023 Jason Hempstead, Casjays Developments -# @@Created : Sunday, Sep 03, 2023 16:03 EDT +# @@Created : Sunday, Sep 03, 2023 16:48 EDT # @@File : docker-entrypoint # @@Description : # @@Changelog : New script diff --git a/rootfs/usr/local/etc/docker/functions/entrypoint.sh b/rootfs/usr/local/etc/docker/functions/entrypoint.sh index e87946c..cfa3d7c 100755 --- a/rootfs/usr/local/etc/docker/functions/entrypoint.sh +++ b/rootfs/usr/local/etc/docker/functions/entrypoint.sh @@ -28,51 +28,6 @@ # Set bash options [ "$DEBUGGER" = "on" ] && echo "Enabling debugging" && set -o pipefail -x$DEBUGGER_OPTIONS || set -o pipefail # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# set variables from function calls -export INIT_DATE="${INIT_DATE:-$(date)}" -export START_SERVICES="${START_SERVICES:-yes}" -export ENTRYPOINT_MESSAGE="${ENTRYPOINT_MESSAGE:-yes}" -export ENTRYPOINT_FIRST_RUN="${ENTRYPOINT_FIRST_RUN:-yes}" -export DATA_DIR_INITIALIZED="${DATA_DIR_INITIALIZED:-false}" -export CONFIG_DIR_INITIALIZED="${CONFIG_DIR_INITIALIZED:-false}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# System -export LANG="${LANG:-C.UTF-8}" -export LC_ALL="${LANG:-C.UTF-8}" -export TZ="${TZ:-${TIMEZONE:-America/New_York}}" -export HOSTNAME="${FULL_DOMAIN_NAME:-${SERVER_HOSTNAME:-$HOSTNAME}}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Default directories -export SSL_DIR="${SSL_DIR:-/config/ssl}" -export SSL_CA="${SSL_CERT:-/config/ssl/ca.crt}" -export SSL_KEY="${SSL_KEY:-/config/ssl/localhost.pem}" -export SSL_CERT="${SSL_CERT:-/config/ssl/localhost.crt}" -export BACKUP_DIR="${BACKUP_DIR:-/data/backups}" -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}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CONTAINER_IP4_ADDRESS="${CONTAINER_IP4_ADDRESS:-$(__get_ip4)}" -CONTAINER_IP6_ADDRESS="${CONTAINER_IP6_ADDRESS:-$(__get_ip6)}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Additional -export SET_RANDOM_PASS="${SET_RANDOM_PASS:-$(__random_password 16)}" -export PHP_INI_DIR="${PHP_INI_DIR:-$(__find_php_ini)}" -export PHP_BIN_DIR="${PHP_BIN_DIR:-$(__find_php_bin)}" -export HTTPD_CONFIG_FILE="${HTTPD_CONFIG_FILE:-$(__find_httpd_conf)}" -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 LIGHTTPD_CONFIG_FILE="${LIGHTTPD_CONFIG_FILE:-$(__find_lighttpd_conf)}" -export MARIADB_CONFIG_FILE="${MARIADB_CONFIG_FILE:-$(__find_mysql_conf)}" -export POSTGRES_CONFIG_FILE="${POSTGRES_CONFIG_FILE:-$(__find_pgsql_conf)}" -export MONGODB_CONFIG_FILE="${MONGODB_CONFIG_FILE:-$(__find_mongodb_conf)}" -export ENTRYPOINT_PID_FILE="${ENTRYPOINT_PID_FILE:-/run/init.d/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}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - __printf_space() { printf "%-${1:-30}s%s\n" "${2}" "${3}"; } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - __cd() { [ -d "$1" ] && builtin cd "$1" || return 1; } @@ -839,7 +794,50 @@ __start_php_dev_server() { fi } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# export variables +# set variables from function calls +export INIT_DATE="${INIT_DATE:-$(date)}" +export START_SERVICES="${START_SERVICES:-yes}" +export ENTRYPOINT_MESSAGE="${ENTRYPOINT_MESSAGE:-yes}" +export ENTRYPOINT_FIRST_RUN="${ENTRYPOINT_FIRST_RUN:-yes}" +export DATA_DIR_INITIALIZED="${DATA_DIR_INITIALIZED:-false}" +export CONFIG_DIR_INITIALIZED="${CONFIG_DIR_INITIALIZED:-false}" +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# System +export LANG="${LANG:-C.UTF-8}" +export LC_ALL="${LANG:-C.UTF-8}" +export TZ="${TZ:-${TIMEZONE:-America/New_York}}" +export HOSTNAME="${FULL_DOMAIN_NAME:-${SERVER_HOSTNAME:-$HOSTNAME}}" +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# Default directories +export SSL_DIR="${SSL_DIR:-/config/ssl}" +export SSL_CA="${SSL_CERT:-/config/ssl/ca.crt}" +export SSL_KEY="${SSL_KEY:-/config/ssl/localhost.pem}" +export SSL_CERT="${SSL_CERT:-/config/ssl/localhost.crt}" +export BACKUP_DIR="${BACKUP_DIR:-/data/backups}" +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}" +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +CONTAINER_IP4_ADDRESS="${CONTAINER_IP4_ADDRESS:-$(__get_ip4)}" +CONTAINER_IP6_ADDRESS="${CONTAINER_IP6_ADDRESS:-$(__get_ip6)}" +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# Additional +export SET_RANDOM_PASS="${SET_RANDOM_PASS:-$(__random_password 16)}" +export PHP_INI_DIR="${PHP_INI_DIR:-$(__find_php_ini)}" +export PHP_BIN_DIR="${PHP_BIN_DIR:-$(__find_php_bin)}" +export HTTPD_CONFIG_FILE="${HTTPD_CONFIG_FILE:-$(__find_httpd_conf)}" +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 LIGHTTPD_CONFIG_FILE="${LIGHTTPD_CONFIG_FILE:-$(__find_lighttpd_conf)}" +export MARIADB_CONFIG_FILE="${MARIADB_CONFIG_FILE:-$(__find_mysql_conf)}" +export POSTGRES_CONFIG_FILE="${POSTGRES_CONFIG_FILE:-$(__find_pgsql_conf)}" +export MONGODB_CONFIG_FILE="${MONGODB_CONFIG_FILE:-$(__find_mongodb_conf)}" +export ENTRYPOINT_PID_FILE="${ENTRYPOINT_PID_FILE:-/run/init.d/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}" # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # is already Initialized [ -z "$DATA_DIR_INITIALIZED" ] && { [ -f "$ENTRYPOINT_DATA_INIT_FILE" ] && DATA_DIR_INITIALIZED="true" || DATA_DIR_INITIALIZED="false"; }