You've already forked postgres
mirror of
https://github.com/docker-library/postgres.git
synced 2025-07-28 10:42:06 +03:00
Merge pull request #647 from infosiftr/help
Check for "help" to short circuit server starting (since they break when passed to pg_ctl)
This commit is contained in:
@ -229,13 +229,30 @@ docker_temp_server_stop() {
|
||||
pg_ctl -D "$PGDATA" -m fast -w stop
|
||||
}
|
||||
|
||||
# check arguments for an option that would cause postgres to stop
|
||||
# return true if there is one
|
||||
_pg_want_help() {
|
||||
local arg
|
||||
for arg; do
|
||||
case "$arg" in
|
||||
# postgres --help | grep 'then exit'
|
||||
# leaving out -C on purpose since it always fails and is unhelpful:
|
||||
# postgres: could not access the server configuration file "/var/lib/postgresql/data/postgresql.conf": No such file or directory
|
||||
-'?'|--help|--describe-config|-V|--version)
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
_main() {
|
||||
# if first arg looks like a flag, assume we want to run postgres server
|
||||
if [ "${1:0:1}" = '-' ]; then
|
||||
set -- postgres "$@"
|
||||
fi
|
||||
|
||||
if [ "$1" = 'postgres' ]; then
|
||||
if [ "$1" = 'postgres' ] && ! _pg_want_help "$@"; then
|
||||
docker_setup_env
|
||||
# setup data directories and permissions (when run as root)
|
||||
docker_create_db_directories
|
||||
|
Reference in New Issue
Block a user