mirror of
				https://github.com/casjaysdevdocker/tor
				synced 2025-10-30 20:02:25 -04:00 
			
		
		
		
	🗃️ Update codebase 🗃️
rootfs/usr/local/etc/docker/functions/entrypoint.sh rootfs/usr/local/etc/docker/init.d/01-tor-bridge.sh rootfs/usr/local/etc/docker/init.d/02-tor-relay.sh rootfs/usr/local/etc/docker/init.d/03-tor-server.sh rootfs/usr/local/etc/docker/init.d/09-unbound.sh rootfs/usr/local/etc/docker/init.d/98-privoxy.sh rootfs/usr/local/etc/docker/init.d/zz-nginx.sh rootfs/usr/local/bin/entrypoint.sh rootfs/usr/local/etc/docker/init.d/01-tor-bridge.sh rootfs/usr/local/etc/docker/init.d/02-tor-relay.sh rootfs/usr/local/etc/docker/init.d/03-tor-server.sh rootfs/usr/local/etc/docker/init.d/09-unbound.sh rootfs/usr/local/etc/docker/init.d/98-privoxy.sh rootfs/usr/local/etc/docker/init.d/zz-nginx.sh
This commit is contained in:
		| @@ -21,7 +21,7 @@ | |||||||
| # shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317,SC2329 | # shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317,SC2329 | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| # run trap command on exit | # run trap command on exit | ||||||
| trap 'retVal=$?;[ "$SERVICE_IS_RUNNING" != "yes" ] && [ -f "$SERVICE_PID_FILE" ] && rm -Rf "$SERVICE_PID_FILE";exit $retVal' SIGINT SIGTERM SIGPWR | trap 'retVal=$?;if [ "$SERVICE_IS_RUNNING" != "yes" ] && [ -f "$SERVICE_PID_FILE" ]; then rm -Rf "$SERVICE_PID_FILE"; fi;exit $retVal' SIGINT SIGTERM SIGPWR | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| # setup debugging - https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html | # 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:-}" | [ -f "/config/.debug" ] && [ -z "$DEBUGGER_OPTIONS" ] && export DEBUGGER_OPTIONS="$(<"/config/.debug")" || DEBUGGER_OPTIONS="${DEBUGGER_OPTIONS:-}" | ||||||
|   | |||||||
| @@ -20,40 +20,59 @@ | |||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| # shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317,SC2329 | # shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317,SC2329 | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| # Exit if service is disabled |  | ||||||
| if [ "$TOR_BRIDGE_ENABLED" != "yes" ]; then SERVICE_DISABLED=yes && exit 0; fi |  | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |  | ||||||
| # run trap command on exit | # run trap command on exit | ||||||
| trap 'retVal=$?;[ "$SERVICE_IS_RUNNING" != "yes" ] && [ -f "$SERVICE_PID_FILE" ] && rm -Rf "$SERVICE_PID_FILE";exit $retVal' SIGINT SIGTERM | trap 'retVal=$?; echo "❌ Fatal error occurred: Exit code $retVal at line $LINENO in command: $BASH_COMMAND"; kill -TERM 1' ERR | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | trap 'retVal=$?;if [ "$SERVICE_IS_RUNNING" != "yes" ] && [ -f "$SERVICE_PID_FILE" ]; then rm -Rf "$SERVICE_PID_FILE"; fi;exit $retVal' SIGINT SIGTERM SIGPWR | ||||||
| # 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:-}" |  | ||||||
| { [ "$DEBUGGER" = "on" ] || [ -f "/config/.debug" ]; } && echo "Enabling debugging" && set -xo pipefail -x$DEBUGGER_OPTIONS && export DEBUGGER="on" || set -o pipefail |  | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |  | ||||||
| export PATH="/usr/local/etc/docker/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin" |  | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| SCRIPT_FILE="$0" | SCRIPT_FILE="$0" | ||||||
| SERVICE_NAME="tor-bridge" | SERVICE_NAME="tor-bridge" | ||||||
| SCRIPT_NAME="$(basename -- "$SCRIPT_FILE" 2>/dev/null)" | SCRIPT_NAME="$(basename -- "$SCRIPT_FILE" 2>/dev/null)" | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| # exit if __start_init_scripts function hasn't been Initialized | # Function to exit appropriately based on context | ||||||
| if [ ! -f "/run/__start_init_scripts.pid" ]; then | __script_exit() { | ||||||
| 	echo "__start_init_scripts function hasn't been Initialized" >&2 | 	local exit_code="${1:-0}" | ||||||
| 	SERVICE_IS_RUNNING="no" | 	if [ "${BASH_SOURCE[0]}" != "${0}" ]; then | ||||||
| 	exit 1 | 		# Script is being sourced - use return | ||||||
|  | 		return "$exit_code" | ||||||
|  | 	else | ||||||
|  | 		# Script is being executed - use exit | ||||||
|  | 		exit "$exit_code" | ||||||
| 	fi | 	fi | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | } | ||||||
|  | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
|  | # Exit if service is disabled | ||||||
|  | [ -z "$TOR_BRIDGE_ENABLED" ] || if [ "$TOR_BRIDGE_ENABLED" != "yes" ]; then export SERVICE_DISABLED="$SERVICE_NAME" && __script_exit 0; fi | ||||||
|  | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
|  | # 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:-}" | ||||||
|  | { [ "$DEBUGGER" = "on" ] || [ -f "/config/.debug" ]; } && echo "Enabling debugging" && set -xo pipefail -x$DEBUGGER_OPTIONS && export DEBUGGER="on" || set -o pipefail | ||||||
|  | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
|  | export PATH="/usr/local/etc/docker/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin" | ||||||
|  | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| # import the functions file | # import the functions file | ||||||
| if [ -f "/usr/local/etc/docker/functions/entrypoint.sh" ]; then | if [ -f "/usr/local/etc/docker/functions/entrypoint.sh" ]; then | ||||||
| 	. "/usr/local/etc/docker/functions/entrypoint.sh" | 	. "/usr/local/etc/docker/functions/entrypoint.sh" | ||||||
| fi | fi | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| # import variables | # import variables | ||||||
| for set_env in "/root/env.sh" "/usr/local/etc/docker/env"/*.sh "/config/env"/*.sh; do | for set_env in "/root/env.sh" "/usr/local/etc/docker/env"/*.sh "/config/env"/*.sh; do | ||||||
| 	[ -f "$set_env" ] && . "$set_env" | 	[ -f "$set_env" ] && . "$set_env" | ||||||
| done | done | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| printf '%s\n' "# - - - Initializing $SERVICE_NAME - - - #" | # 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" | ||||||
|  | 	__script_exit 1 | ||||||
|  | fi | ||||||
|  | # Clean up any stale PID file for this service on startup | ||||||
|  | if [ -n "$SERVICE_NAME" ] && [ -f "/run/init.d/$SERVICE_NAME.pid" ]; then | ||||||
|  | 	old_pid=$(cat "/run/init.d/$SERVICE_NAME.pid" 2>/dev/null) | ||||||
|  | 	if [ -n "$old_pid" ] && ! kill -0 "$old_pid" 2>/dev/null; then | ||||||
|  | 		echo "🧹 Removing stale PID file for $SERVICE_NAME" | ||||||
|  | 		rm -f "/run/init.d/$SERVICE_NAME.pid" | ||||||
|  | 	fi | ||||||
|  | fi | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| # Custom functions | # Custom functions | ||||||
|  |  | ||||||
|   | |||||||
| @@ -20,40 +20,59 @@ | |||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| # shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317,SC2329 | # shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317,SC2329 | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| # Exit if service is disabled |  | ||||||
| if [ "$TOR_RELAY_ENABLED" != "yes" ]; then SERVICE_DISABLED=yes && exit 0; fi |  | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |  | ||||||
| # run trap command on exit | # run trap command on exit | ||||||
| trap 'retVal=$?;[ "$SERVICE_IS_RUNNING" != "yes" ] && [ -f "$SERVICE_PID_FILE" ] && rm -Rf "$SERVICE_PID_FILE";exit $retVal' SIGINT SIGTERM | trap 'retVal=$?; echo "❌ Fatal error occurred: Exit code $retVal at line $LINENO in command: $BASH_COMMAND"; kill -TERM 1' ERR | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | trap 'retVal=$?;if [ "$SERVICE_IS_RUNNING" != "yes" ] && [ -f "$SERVICE_PID_FILE" ]; then rm -Rf "$SERVICE_PID_FILE"; fi;exit $retVal' SIGINT SIGTERM SIGPWR | ||||||
| # 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:-}" |  | ||||||
| { [ "$DEBUGGER" = "on" ] || [ -f "/config/.debug" ]; } && echo "Enabling debugging" && set -xo pipefail -x$DEBUGGER_OPTIONS && export DEBUGGER="on" || set -o pipefail |  | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |  | ||||||
| export PATH="/usr/local/etc/docker/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin" |  | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| SCRIPT_FILE="$0" | SCRIPT_FILE="$0" | ||||||
| SERVICE_NAME="tor-relay" | SERVICE_NAME="tor-relay" | ||||||
| SCRIPT_NAME="$(basename -- "$SCRIPT_FILE" 2>/dev/null)" | SCRIPT_NAME="$(basename -- "$SCRIPT_FILE" 2>/dev/null)" | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| # exit if __start_init_scripts function hasn't been Initialized | # Function to exit appropriately based on context | ||||||
| if [ ! -f "/run/__start_init_scripts.pid" ]; then | __script_exit() { | ||||||
| 	echo "__start_init_scripts function hasn't been Initialized" >&2 | 	local exit_code="${1:-0}" | ||||||
| 	SERVICE_IS_RUNNING="no" | 	if [ "${BASH_SOURCE[0]}" != "${0}" ]; then | ||||||
| 	exit 1 | 		# Script is being sourced - use return | ||||||
|  | 		return "$exit_code" | ||||||
|  | 	else | ||||||
|  | 		# Script is being executed - use exit | ||||||
|  | 		exit "$exit_code" | ||||||
| 	fi | 	fi | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | } | ||||||
|  | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
|  | # Exit if service is disabled | ||||||
|  | [ -z "$TOR_RELAY_ENABLED" ] || if [ "$TOR_RELAY_ENABLED" != "yes" ]; then export SERVICE_DISABLED="$SERVICE_NAME" && __script_exit 0; fi | ||||||
|  | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
|  | # 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:-}" | ||||||
|  | { [ "$DEBUGGER" = "on" ] || [ -f "/config/.debug" ]; } && echo "Enabling debugging" && set -xo pipefail -x$DEBUGGER_OPTIONS && export DEBUGGER="on" || set -o pipefail | ||||||
|  | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
|  | export PATH="/usr/local/etc/docker/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin" | ||||||
|  | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| # import the functions file | # import the functions file | ||||||
| if [ -f "/usr/local/etc/docker/functions/entrypoint.sh" ]; then | if [ -f "/usr/local/etc/docker/functions/entrypoint.sh" ]; then | ||||||
| 	. "/usr/local/etc/docker/functions/entrypoint.sh" | 	. "/usr/local/etc/docker/functions/entrypoint.sh" | ||||||
| fi | fi | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| # import variables | # import variables | ||||||
| for set_env in "/root/env.sh" "/usr/local/etc/docker/env"/*.sh "/config/env"/*.sh; do | for set_env in "/root/env.sh" "/usr/local/etc/docker/env"/*.sh "/config/env"/*.sh; do | ||||||
| 	[ -f "$set_env" ] && . "$set_env" | 	[ -f "$set_env" ] && . "$set_env" | ||||||
| done | done | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| printf '%s\n' "# - - - Initializing $SERVICE_NAME - - - #" | # 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" | ||||||
|  | 	__script_exit 1 | ||||||
|  | fi | ||||||
|  | # Clean up any stale PID file for this service on startup | ||||||
|  | if [ -n "$SERVICE_NAME" ] && [ -f "/run/init.d/$SERVICE_NAME.pid" ]; then | ||||||
|  | 	old_pid=$(cat "/run/init.d/$SERVICE_NAME.pid" 2>/dev/null) | ||||||
|  | 	if [ -n "$old_pid" ] && ! kill -0 "$old_pid" 2>/dev/null; then | ||||||
|  | 		echo "🧹 Removing stale PID file for $SERVICE_NAME" | ||||||
|  | 		rm -f "/run/init.d/$SERVICE_NAME.pid" | ||||||
|  | 	fi | ||||||
|  | fi | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| # Custom functions | # Custom functions | ||||||
|  |  | ||||||
|   | |||||||
| @@ -21,36 +21,58 @@ | |||||||
| # shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317,SC2329 | # shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317,SC2329 | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| # run trap command on exit | # run trap command on exit | ||||||
| trap 'retVal=$?;[ "$SERVICE_IS_RUNNING" != "yes" ] && [ -f "$SERVICE_PID_FILE" ] && rm -Rf "$SERVICE_PID_FILE";exit $retVal' SIGINT SIGTERM | trap 'retVal=$?; echo "❌ Fatal error occurred: Exit code $retVal at line $LINENO in command: $BASH_COMMAND"; kill -TERM 1' ERR | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | trap 'retVal=$?;if [ "$SERVICE_IS_RUNNING" != "yes" ] && [ -f "$SERVICE_PID_FILE" ]; then rm -Rf "$SERVICE_PID_FILE"; fi;exit $retVal' SIGINT SIGTERM SIGPWR | ||||||
| # 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:-}" |  | ||||||
| { [ "$DEBUGGER" = "on" ] || [ -f "/config/.debug" ]; } && echo "Enabling debugging" && set -xo pipefail -x$DEBUGGER_OPTIONS && export DEBUGGER="on" || set -o pipefail |  | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |  | ||||||
| export PATH="/usr/local/etc/docker/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin" |  | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| SCRIPT_FILE="$0" | SCRIPT_FILE="$0" | ||||||
| SERVICE_NAME="tor-server" | SERVICE_NAME="tor-server" | ||||||
| SCRIPT_NAME="$(basename -- "$SCRIPT_FILE" 2>/dev/null)" | SCRIPT_NAME="$(basename -- "$SCRIPT_FILE" 2>/dev/null)" | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| # exit if __start_init_scripts function hasn't been Initialized | # Function to exit appropriately based on context | ||||||
| if [ ! -f "/run/__start_init_scripts.pid" ]; then | __script_exit() { | ||||||
| 	echo "__start_init_scripts function hasn't been Initialized" >&2 | 	local exit_code="${1:-0}" | ||||||
| 	SERVICE_IS_RUNNING="no" | 	if [ "${BASH_SOURCE[0]}" != "${0}" ]; then | ||||||
| 	exit 1 | 		# Script is being sourced - use return | ||||||
|  | 		return "$exit_code" | ||||||
|  | 	else | ||||||
|  | 		# Script is being executed - use exit | ||||||
|  | 		exit "$exit_code" | ||||||
| 	fi | 	fi | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | } | ||||||
|  | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
|  | # Exit if service is disabled | ||||||
|  | [ -z "$TOR_SERVER_ENABLED" ] || if [ "$TOR_SERVER_ENABLED" != "yes" ]; then export SERVICE_DISABLED="$SERVICE_NAME" && __script_exit 0; fi | ||||||
|  | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
|  | # 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:-}" | ||||||
|  | { [ "$DEBUGGER" = "on" ] || [ -f "/config/.debug" ]; } && echo "Enabling debugging" && set -xo pipefail -x$DEBUGGER_OPTIONS && export DEBUGGER="on" || set -o pipefail | ||||||
|  | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
|  | export PATH="/usr/local/etc/docker/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin" | ||||||
|  | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| # import the functions file | # import the functions file | ||||||
| if [ -f "/usr/local/etc/docker/functions/entrypoint.sh" ]; then | if [ -f "/usr/local/etc/docker/functions/entrypoint.sh" ]; then | ||||||
| 	. "/usr/local/etc/docker/functions/entrypoint.sh" | 	. "/usr/local/etc/docker/functions/entrypoint.sh" | ||||||
| fi | fi | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| # import variables | # import variables | ||||||
| for set_env in "/root/env.sh" "/usr/local/etc/docker/env"/*.sh "/config/env"/*.sh; do | for set_env in "/root/env.sh" "/usr/local/etc/docker/env"/*.sh "/config/env"/*.sh; do | ||||||
| 	[ -f "$set_env" ] && . "$set_env" | 	[ -f "$set_env" ] && . "$set_env" | ||||||
| done | done | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| printf '%s\n' "# - - - Initializing $SERVICE_NAME - - - #" | # 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" | ||||||
|  | 	__script_exit 1 | ||||||
|  | fi | ||||||
|  | # Clean up any stale PID file for this service on startup | ||||||
|  | if [ -n "$SERVICE_NAME" ] && [ -f "/run/init.d/$SERVICE_NAME.pid" ]; then | ||||||
|  | 	old_pid=$(cat "/run/init.d/$SERVICE_NAME.pid" 2>/dev/null) | ||||||
|  | 	if [ -n "$old_pid" ] && ! kill -0 "$old_pid" 2>/dev/null; then | ||||||
|  | 		echo "🧹 Removing stale PID file for $SERVICE_NAME" | ||||||
|  | 		rm -f "/run/init.d/$SERVICE_NAME.pid" | ||||||
|  | 	fi | ||||||
|  | fi | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| # Custom functions | # Custom functions | ||||||
|  |  | ||||||
|   | |||||||
| @@ -21,36 +21,58 @@ | |||||||
| # shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317,SC2329 | # shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317,SC2329 | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| # run trap command on exit | # run trap command on exit | ||||||
| trap 'retVal=$?;[ "$SERVICE_IS_RUNNING" != "yes" ] && [ -f "$SERVICE_PID_FILE" ] && rm -Rf "$SERVICE_PID_FILE";exit $retVal' SIGINT SIGTERM | trap 'retVal=$?; echo "❌ Fatal error occurred: Exit code $retVal at line $LINENO in command: $BASH_COMMAND"; kill -TERM 1' ERR | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | trap 'retVal=$?;if [ "$SERVICE_IS_RUNNING" != "yes" ] && [ -f "$SERVICE_PID_FILE" ]; then rm -Rf "$SERVICE_PID_FILE"; fi;exit $retVal' SIGINT SIGTERM SIGPWR | ||||||
| # 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:-}" |  | ||||||
| { [ "$DEBUGGER" = "on" ] || [ -f "/config/.debug" ]; } && echo "Enabling debugging" && set -xo pipefail -x$DEBUGGER_OPTIONS && export DEBUGGER="on" || set -o pipefail |  | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |  | ||||||
| export PATH="/usr/local/etc/docker/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin" |  | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| SCRIPT_FILE="$0" | SCRIPT_FILE="$0" | ||||||
| SERVICE_NAME="unbound" | SERVICE_NAME="unbound" | ||||||
| SCRIPT_NAME="$(basename -- "$SCRIPT_FILE" 2>/dev/null)" | SCRIPT_NAME="$(basename -- "$SCRIPT_FILE" 2>/dev/null)" | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| # exit if __start_init_scripts function hasn't been Initialized | # Function to exit appropriately based on context | ||||||
| if [ ! -f "/run/__start_init_scripts.pid" ]; then | __script_exit() { | ||||||
| 	echo "__start_init_scripts function hasn't been Initialized" >&2 | 	local exit_code="${1:-0}" | ||||||
| 	SERVICE_IS_RUNNING="no" | 	if [ "${BASH_SOURCE[0]}" != "${0}" ]; then | ||||||
| 	exit 1 | 		# Script is being sourced - use return | ||||||
|  | 		return "$exit_code" | ||||||
|  | 	else | ||||||
|  | 		# Script is being executed - use exit | ||||||
|  | 		exit "$exit_code" | ||||||
| 	fi | 	fi | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | } | ||||||
|  | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
|  | # Exit if service is disabled | ||||||
|  | [ -z "$TOR_UNBOUND_ENABLED" ] || if [ "$TOR_UNBOUND_ENABLED" != "yes" ]; then export SERVICE_DISABLED="$SERVICE_NAME" && __script_exit 0; fi | ||||||
|  | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
|  | # 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:-}" | ||||||
|  | { [ "$DEBUGGER" = "on" ] || [ -f "/config/.debug" ]; } && echo "Enabling debugging" && set -xo pipefail -x$DEBUGGER_OPTIONS && export DEBUGGER="on" || set -o pipefail | ||||||
|  | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
|  | export PATH="/usr/local/etc/docker/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin" | ||||||
|  | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| # import the functions file | # import the functions file | ||||||
| if [ -f "/usr/local/etc/docker/functions/entrypoint.sh" ]; then | if [ -f "/usr/local/etc/docker/functions/entrypoint.sh" ]; then | ||||||
| 	. "/usr/local/etc/docker/functions/entrypoint.sh" | 	. "/usr/local/etc/docker/functions/entrypoint.sh" | ||||||
| fi | fi | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| # import variables | # import variables | ||||||
| for set_env in "/root/env.sh" "/usr/local/etc/docker/env"/*.sh "/config/env"/*.sh; do | for set_env in "/root/env.sh" "/usr/local/etc/docker/env"/*.sh "/config/env"/*.sh; do | ||||||
| 	[ -f "$set_env" ] && . "$set_env" | 	[ -f "$set_env" ] && . "$set_env" | ||||||
| done | done | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| printf '%s\n' "# - - - Initializing $SERVICE_NAME - - - #" | # 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" | ||||||
|  | 	__script_exit 1 | ||||||
|  | fi | ||||||
|  | # Clean up any stale PID file for this service on startup | ||||||
|  | if [ -n "$SERVICE_NAME" ] && [ -f "/run/init.d/$SERVICE_NAME.pid" ]; then | ||||||
|  | 	old_pid=$(cat "/run/init.d/$SERVICE_NAME.pid" 2>/dev/null) | ||||||
|  | 	if [ -n "$old_pid" ] && ! kill -0 "$old_pid" 2>/dev/null; then | ||||||
|  | 		echo "🧹 Removing stale PID file for $SERVICE_NAME" | ||||||
|  | 		rm -f "/run/init.d/$SERVICE_NAME.pid" | ||||||
|  | 	fi | ||||||
|  | fi | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| # Custom functions | # Custom functions | ||||||
|  |  | ||||||
|   | |||||||
| @@ -21,36 +21,60 @@ | |||||||
| # shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317,SC2329 | # shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317,SC2329 | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| # run trap command on exit | # run trap command on exit | ||||||
| trap 'retVal=$?;[ "$SERVICE_IS_RUNNING" != "yes" ] && [ -f "$SERVICE_PID_FILE" ] && rm -Rf "$SERVICE_PID_FILE";exit $retVal' SIGINT SIGTERM | trap 'retVal=$?; echo "❌ Fatal error occurred: Exit code $retVal at line $LINENO in command: $BASH_COMMAND"; kill -TERM 1' ERR | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | trap 'retVal=$?;if [ "$SERVICE_IS_RUNNING" != "yes" ] && [ -f "$SERVICE_PID_FILE" ]; then rm -Rf "$SERVICE_PID_FILE"; fi;exit $retVal' SIGINT SIGTERM SIGPWR | ||||||
| # 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:-}" |  | ||||||
| { [ "$DEBUGGER" = "on" ] || [ -f "/config/.debug" ]; } && echo "Enabling debugging" && set -xo pipefail -x$DEBUGGER_OPTIONS && export DEBUGGER="on" || set -o pipefail |  | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| export PATH="/usr/local/etc/docker/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin" | export PATH="/usr/local/etc/docker/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin" | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| SCRIPT_FILE="$0" | SCRIPT_FILE="$0" | ||||||
| SERVICE_NAME="privoxy" | SERVICE_NAME="privoxy" | ||||||
| SCRIPT_NAME="$(basename -- "$SCRIPT_FILE" 2>/dev/null)" | SCRIPT_NAME="$(basename -- "$SCRIPT_FILE" 2>/dev/null)" | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| # exit if __start_init_scripts function hasn't been Initialized | # Function to exit appropriately based on context | ||||||
| if [ ! -f "/run/__start_init_scripts.pid" ]; then | __script_exit() { | ||||||
| 	echo "__start_init_scripts function hasn't been Initialized" >&2 | 	local exit_code="${1:-0}" | ||||||
| 	SERVICE_IS_RUNNING="no" | 	if [ "${BASH_SOURCE[0]}" != "${0}" ]; then | ||||||
| 	exit 1 | 		# Script is being sourced - use return | ||||||
|  | 		return "$exit_code" | ||||||
|  | 	else | ||||||
|  | 		# Script is being executed - use exit | ||||||
|  | 		exit "$exit_code" | ||||||
| 	fi | 	fi | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | } | ||||||
|  | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
|  | # Exit if service is disabled | ||||||
|  | [ -z "$TOR_PRIVOXY_ENABLED" ] || if [ "$TOR_PRIVOXY_ENABLED" != "yes" ]; then export SERVICE_DISABLED="$SERVICE_NAME" && __script_exit 0; fi | ||||||
|  | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
|  | # 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:-}" | ||||||
|  | { [ "$DEBUGGER" = "on" ] || [ -f "/config/.debug" ]; } && echo "Enabling debugging" && set -xo pipefail -x$DEBUGGER_OPTIONS && export DEBUGGER="on" || set -o pipefail | ||||||
|  | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
|  | export PATH="/usr/local/etc/docker/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin" | ||||||
|  | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| # import the functions file | # import the functions file | ||||||
| if [ -f "/usr/local/etc/docker/functions/entrypoint.sh" ]; then | if [ -f "/usr/local/etc/docker/functions/entrypoint.sh" ]; then | ||||||
| 	. "/usr/local/etc/docker/functions/entrypoint.sh" | 	. "/usr/local/etc/docker/functions/entrypoint.sh" | ||||||
| fi | fi | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| # import variables | # import variables | ||||||
| for set_env in "/root/env.sh" "/usr/local/etc/docker/env"/*.sh "/config/env"/*.sh; do | for set_env in "/root/env.sh" "/usr/local/etc/docker/env"/*.sh "/config/env"/*.sh; do | ||||||
| 	[ -f "$set_env" ] && . "$set_env" | 	[ -f "$set_env" ] && . "$set_env" | ||||||
| done | done | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| printf '%s\n' "# - - - Initializing $SERVICE_NAME - - - #" | # 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" | ||||||
|  | 	__script_exit 1 | ||||||
|  | fi | ||||||
|  | # Clean up any stale PID file for this service on startup | ||||||
|  | if [ -n "$SERVICE_NAME" ] && [ -f "/run/init.d/$SERVICE_NAME.pid" ]; then | ||||||
|  | 	old_pid=$(cat "/run/init.d/$SERVICE_NAME.pid" 2>/dev/null) | ||||||
|  | 	if [ -n "$old_pid" ] && ! kill -0 "$old_pid" 2>/dev/null; then | ||||||
|  | 		echo "🧹 Removing stale PID file for $SERVICE_NAME" | ||||||
|  | 		rm -f "/run/init.d/$SERVICE_NAME.pid" | ||||||
|  | 	fi | ||||||
|  | fi | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| # Custom functions | # Custom functions | ||||||
|  |  | ||||||
|   | |||||||
| @@ -21,36 +21,58 @@ | |||||||
| # shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317,SC2329 | # shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317,SC2329 | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| # run trap command on exit | # run trap command on exit | ||||||
| trap 'retVal=$?;[ "$SERVICE_IS_RUNNING" != "yes" ] && [ -f "$SERVICE_PID_FILE" ] && rm -Rf "$SERVICE_PID_FILE";exit $retVal' SIGINT SIGTERM | trap 'retVal=$?; echo "❌ Fatal error occurred: Exit code $retVal at line $LINENO in command: $BASH_COMMAND"; kill -TERM 1' ERR | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | trap 'retVal=$?;if [ "$SERVICE_IS_RUNNING" != "yes" ] && [ -f "$SERVICE_PID_FILE" ]; then rm -Rf "$SERVICE_PID_FILE"; fi;exit $retVal' SIGINT SIGTERM SIGPWR | ||||||
| # 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:-}" |  | ||||||
| { [ "$DEBUGGER" = "on" ] || [ -f "/config/.debug" ]; } && echo "Enabling debugging" && set -xo pipefail -x$DEBUGGER_OPTIONS && export DEBUGGER="on" || set -o pipefail |  | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |  | ||||||
| export PATH="/usr/local/etc/docker/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin" |  | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| SCRIPT_FILE="$0" | SCRIPT_FILE="$0" | ||||||
| SERVICE_NAME="nginx" | SERVICE_NAME="nginx" | ||||||
| SCRIPT_NAME="$(basename -- "$SCRIPT_FILE" 2>/dev/null)" | SCRIPT_NAME="$(basename -- "$SCRIPT_FILE" 2>/dev/null)" | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| # exit if __start_init_scripts function hasn't been Initialized | # Function to exit appropriately based on context | ||||||
| if [ ! -f "/run/__start_init_scripts.pid" ]; then | __script_exit() { | ||||||
| 	echo "__start_init_scripts function hasn't been Initialized" >&2 | 	local exit_code="${1:-0}" | ||||||
| 	SERVICE_IS_RUNNING="no" | 	if [ "${BASH_SOURCE[0]}" != "${0}" ]; then | ||||||
| 	exit 1 | 		# Script is being sourced - use return | ||||||
|  | 		return "$exit_code" | ||||||
|  | 	else | ||||||
|  | 		# Script is being executed - use exit | ||||||
|  | 		exit "$exit_code" | ||||||
| 	fi | 	fi | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | } | ||||||
|  | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
|  | # Exit if service is disabled | ||||||
|  | [ -z "$TOR_NGINX_ENABLED" ] || if [ "$TOR_NGINX_ENABLED" != "yes" ]; then export SERVICE_DISABLED="$SERVICE_NAME" && __script_exit 0; fi | ||||||
|  | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
|  | # 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:-}" | ||||||
|  | { [ "$DEBUGGER" = "on" ] || [ -f "/config/.debug" ]; } && echo "Enabling debugging" && set -xo pipefail -x$DEBUGGER_OPTIONS && export DEBUGGER="on" || set -o pipefail | ||||||
|  | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
|  | export PATH="/usr/local/etc/docker/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin" | ||||||
|  | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| # import the functions file | # import the functions file | ||||||
| if [ -f "/usr/local/etc/docker/functions/entrypoint.sh" ]; then | if [ -f "/usr/local/etc/docker/functions/entrypoint.sh" ]; then | ||||||
| 	. "/usr/local/etc/docker/functions/entrypoint.sh" | 	. "/usr/local/etc/docker/functions/entrypoint.sh" | ||||||
| fi | fi | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| # import variables | # import variables | ||||||
| for set_env in "/root/env.sh" "/usr/local/etc/docker/env"/*.sh "/config/env"/*.sh; do | for set_env in "/root/env.sh" "/usr/local/etc/docker/env"/*.sh "/config/env"/*.sh; do | ||||||
| 	[ -f "$set_env" ] && . "$set_env" | 	[ -f "$set_env" ] && . "$set_env" | ||||||
| done | done | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| printf '%s\n' "# - - - Initializing $SERVICE_NAME - - - #" | # 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" | ||||||
|  | 	__script_exit 1 | ||||||
|  | fi | ||||||
|  | # Clean up any stale PID file for this service on startup | ||||||
|  | if [ -n "$SERVICE_NAME" ] && [ -f "/run/init.d/$SERVICE_NAME.pid" ]; then | ||||||
|  | 	old_pid=$(cat "/run/init.d/$SERVICE_NAME.pid" 2>/dev/null) | ||||||
|  | 	if [ -n "$old_pid" ] && ! kill -0 "$old_pid" 2>/dev/null; then | ||||||
|  | 		echo "🧹 Removing stale PID file for $SERVICE_NAME" | ||||||
|  | 		rm -f "/run/init.d/$SERVICE_NAME.pid" | ||||||
|  | 	fi | ||||||
|  | fi | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| # Custom functions | # Custom functions | ||||||
| __onion_site_dir_is_empty() { [ "$(ls -A "/data/htdocs/onions/${1:-$onion_site}" 2>/dev/null | wc -l)" -eq 0 ] || return 1; } | __onion_site_dir_is_empty() { [ "$(ls -A "/data/htdocs/onions/${1:-$onion_site}" 2>/dev/null | wc -l)" -eq 0 ] || return 1; } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user