Loading docker-entrypoint.sh 0 → 100644 +13 −0 Original line number Diff line number Diff line #!/bin/sh . /lib/docker-init.sh # Source environment variables from /etc/environment.d/ source_each /etc/environment.d/* # Run all setup scripts in /etc/init.d/ run_all /etc/init.d/* # Run the given command or a shell [ -n "$1" ] || set ${SHELL:=/bin/sh} exec "$@" docker-init.sh 0 → 100644 +63 −0 Original line number Diff line number Diff line # Usage: die <MESSAGE> # # Print the exit message prefixed with "CRITICAL" to stderr and exit the script # with and error exit code. # # Args: # $1: Exit error message # # Vars: # EXIT_CODE: # An integer greater than 0 to use as the exit code. If unset the exit # code of the last command will be used. If invalid the default value of 1 # is used. die() { [ ${EXIT_CODE:=$?} -gt 0 ] || EXIT_CODE=1 echo "FATAL: $*" >&2 exit $EXIT_CODE } # Usage: warn <MESSAGE> # # Print the warning prefixed with "WARNING" to stderr # # Args: # $1: Warning message warn() { echo "WARNING: $*" >&2 } # Usage: source_each <PATH> [<PATH> ...] # # Source each file listed (if it exists). A typical usage is: # source_each /etc/environment.d/* # # Args: # $*: File names source_each() { for file in "$@"; do . "$file" done } # Usage: exec_each <PATH> [<PATH> ...] # # Run each file if it exists and is executable. A typical usage is: # exec_each /etc/init.d/* # # Args: # $*: Executable names exec_each() { for file in "$@"; do [ -x "$file" ] || continue "$file" done } Loading
docker-entrypoint.sh 0 → 100644 +13 −0 Original line number Diff line number Diff line #!/bin/sh . /lib/docker-init.sh # Source environment variables from /etc/environment.d/ source_each /etc/environment.d/* # Run all setup scripts in /etc/init.d/ run_all /etc/init.d/* # Run the given command or a shell [ -n "$1" ] || set ${SHELL:=/bin/sh} exec "$@"
docker-init.sh 0 → 100644 +63 −0 Original line number Diff line number Diff line # Usage: die <MESSAGE> # # Print the exit message prefixed with "CRITICAL" to stderr and exit the script # with and error exit code. # # Args: # $1: Exit error message # # Vars: # EXIT_CODE: # An integer greater than 0 to use as the exit code. If unset the exit # code of the last command will be used. If invalid the default value of 1 # is used. die() { [ ${EXIT_CODE:=$?} -gt 0 ] || EXIT_CODE=1 echo "FATAL: $*" >&2 exit $EXIT_CODE } # Usage: warn <MESSAGE> # # Print the warning prefixed with "WARNING" to stderr # # Args: # $1: Warning message warn() { echo "WARNING: $*" >&2 } # Usage: source_each <PATH> [<PATH> ...] # # Source each file listed (if it exists). A typical usage is: # source_each /etc/environment.d/* # # Args: # $*: File names source_each() { for file in "$@"; do . "$file" done } # Usage: exec_each <PATH> [<PATH> ...] # # Run each file if it exists and is executable. A typical usage is: # exec_each /etc/init.d/* # # Args: # $*: Executable names exec_each() { for file in "$@"; do [ -x "$file" ] || continue "$file" done }