File tree 13 files changed +234
-13
lines changed
13 files changed +234
-13
lines changed Original file line number Diff line number Diff line change @@ -229,13 +229,30 @@ docker_temp_server_stop() {
229
229
pg_ctl -D " $PGDATA " -m fast -w stop
230
230
}
231
231
232
+ # check arguments for an option that would cause postgres to stop
233
+ # return true if there is one
234
+ _pg_want_help () {
235
+ local arg
236
+ for arg; do
237
+ case " $arg " in
238
+ # postgres --help | grep 'then exit'
239
+ # leaving out -C on purpose since it always fails and is unhelpful:
240
+ # postgres: could not access the server configuration file "/var/lib/postgresql/data/postgresql.conf": No such file or directory
241
+ -' ?' |--help|--describe-config|-V|--version)
242
+ return 0
243
+ ;;
244
+ esac
245
+ done
246
+ return 1
247
+ }
248
+
232
249
_main () {
233
250
# if first arg looks like a flag, assume we want to run postgres server
234
251
if [ " ${1: 0: 1} " = ' -' ]; then
235
252
set -- postgres " $@ "
236
253
fi
237
254
238
- if [ " $1 " = ' postgres' ]; then
255
+ if [ " $1 " = ' postgres' ] && ! _pg_want_help " $@ " ; then
239
256
docker_setup_env
240
257
# setup data directories and permissions (when run as root)
241
258
docker_create_db_directories
Original file line number Diff line number Diff line change @@ -229,13 +229,30 @@ docker_temp_server_stop() {
229
229
pg_ctl -D " $PGDATA " -m fast -w stop
230
230
}
231
231
232
+ # check arguments for an option that would cause postgres to stop
233
+ # return true if there is one
234
+ _pg_want_help () {
235
+ local arg
236
+ for arg; do
237
+ case " $arg " in
238
+ # postgres --help | grep 'then exit'
239
+ # leaving out -C on purpose since it always fails and is unhelpful:
240
+ # postgres: could not access the server configuration file "/var/lib/postgresql/data/postgresql.conf": No such file or directory
241
+ -' ?' |--help|--describe-config|-V|--version)
242
+ return 0
243
+ ;;
244
+ esac
245
+ done
246
+ return 1
247
+ }
248
+
232
249
_main () {
233
250
# if first arg looks like a flag, assume we want to run postgres server
234
251
if [ " ${1: 0: 1} " = ' -' ]; then
235
252
set -- postgres " $@ "
236
253
fi
237
254
238
- if [ " $1 " = ' postgres' ]; then
255
+ if [ " $1 " = ' postgres' ] && ! _pg_want_help " $@ " ; then
239
256
docker_setup_env
240
257
# setup data directories and permissions (when run as root)
241
258
docker_create_db_directories
Original file line number Diff line number Diff line change @@ -229,13 +229,30 @@ docker_temp_server_stop() {
229
229
pg_ctl -D " $PGDATA " -m fast -w stop
230
230
}
231
231
232
+ # check arguments for an option that would cause postgres to stop
233
+ # return true if there is one
234
+ _pg_want_help () {
235
+ local arg
236
+ for arg; do
237
+ case " $arg " in
238
+ # postgres --help | grep 'then exit'
239
+ # leaving out -C on purpose since it always fails and is unhelpful:
240
+ # postgres: could not access the server configuration file "/var/lib/postgresql/data/postgresql.conf": No such file or directory
241
+ -' ?' |--help|--describe-config|-V|--version)
242
+ return 0
243
+ ;;
244
+ esac
245
+ done
246
+ return 1
247
+ }
248
+
232
249
_main () {
233
250
# if first arg looks like a flag, assume we want to run postgres server
234
251
if [ " ${1: 0: 1} " = ' -' ]; then
235
252
set -- postgres " $@ "
236
253
fi
237
254
238
- if [ " $1 " = ' postgres' ]; then
255
+ if [ " $1 " = ' postgres' ] && ! _pg_want_help " $@ " ; then
239
256
docker_setup_env
240
257
# setup data directories and permissions (when run as root)
241
258
docker_create_db_directories
Original file line number Diff line number Diff line change @@ -229,13 +229,30 @@ docker_temp_server_stop() {
229
229
pg_ctl -D " $PGDATA " -m fast -w stop
230
230
}
231
231
232
+ # check arguments for an option that would cause postgres to stop
233
+ # return true if there is one
234
+ _pg_want_help () {
235
+ local arg
236
+ for arg; do
237
+ case " $arg " in
238
+ # postgres --help | grep 'then exit'
239
+ # leaving out -C on purpose since it always fails and is unhelpful:
240
+ # postgres: could not access the server configuration file "/var/lib/postgresql/data/postgresql.conf": No such file or directory
241
+ -' ?' |--help|--describe-config|-V|--version)
242
+ return 0
243
+ ;;
244
+ esac
245
+ done
246
+ return 1
247
+ }
248
+
232
249
_main () {
233
250
# if first arg looks like a flag, assume we want to run postgres server
234
251
if [ " ${1: 0: 1} " = ' -' ]; then
235
252
set -- postgres " $@ "
236
253
fi
237
254
238
- if [ " $1 " = ' postgres' ]; then
255
+ if [ " $1 " = ' postgres' ] && ! _pg_want_help " $@ " ; then
239
256
docker_setup_env
240
257
# setup data directories and permissions (when run as root)
241
258
docker_create_db_directories
Original file line number Diff line number Diff line change @@ -229,13 +229,30 @@ docker_temp_server_stop() {
229
229
pg_ctl -D " $PGDATA " -m fast -w stop
230
230
}
231
231
232
+ # check arguments for an option that would cause postgres to stop
233
+ # return true if there is one
234
+ _pg_want_help () {
235
+ local arg
236
+ for arg; do
237
+ case " $arg " in
238
+ # postgres --help | grep 'then exit'
239
+ # leaving out -C on purpose since it always fails and is unhelpful:
240
+ # postgres: could not access the server configuration file "/var/lib/postgresql/data/postgresql.conf": No such file or directory
241
+ -' ?' |--help|--describe-config|-V|--version)
242
+ return 0
243
+ ;;
244
+ esac
245
+ done
246
+ return 1
247
+ }
248
+
232
249
_main () {
233
250
# if first arg looks like a flag, assume we want to run postgres server
234
251
if [ " ${1: 0: 1} " = ' -' ]; then
235
252
set -- postgres " $@ "
236
253
fi
237
254
238
- if [ " $1 " = ' postgres' ]; then
255
+ if [ " $1 " = ' postgres' ] && ! _pg_want_help " $@ " ; then
239
256
docker_setup_env
240
257
# setup data directories and permissions (when run as root)
241
258
docker_create_db_directories
Original file line number Diff line number Diff line change @@ -229,13 +229,30 @@ docker_temp_server_stop() {
229
229
pg_ctl -D " $PGDATA " -m fast -w stop
230
230
}
231
231
232
+ # check arguments for an option that would cause postgres to stop
233
+ # return true if there is one
234
+ _pg_want_help () {
235
+ local arg
236
+ for arg; do
237
+ case " $arg " in
238
+ # postgres --help | grep 'then exit'
239
+ # leaving out -C on purpose since it always fails and is unhelpful:
240
+ # postgres: could not access the server configuration file "/var/lib/postgresql/data/postgresql.conf": No such file or directory
241
+ -' ?' |--help|--describe-config|-V|--version)
242
+ return 0
243
+ ;;
244
+ esac
245
+ done
246
+ return 1
247
+ }
248
+
232
249
_main () {
233
250
# if first arg looks like a flag, assume we want to run postgres server
234
251
if [ " ${1: 0: 1} " = ' -' ]; then
235
252
set -- postgres " $@ "
236
253
fi
237
254
238
- if [ " $1 " = ' postgres' ]; then
255
+ if [ " $1 " = ' postgres' ] && ! _pg_want_help " $@ " ; then
239
256
docker_setup_env
240
257
# setup data directories and permissions (when run as root)
241
258
docker_create_db_directories
Original file line number Diff line number Diff line change @@ -229,13 +229,30 @@ docker_temp_server_stop() {
229
229
pg_ctl -D " $PGDATA " -m fast -w stop
230
230
}
231
231
232
+ # check arguments for an option that would cause postgres to stop
233
+ # return true if there is one
234
+ _pg_want_help () {
235
+ local arg
236
+ for arg; do
237
+ case " $arg " in
238
+ # postgres --help | grep 'then exit'
239
+ # leaving out -C on purpose since it always fails and is unhelpful:
240
+ # postgres: could not access the server configuration file "/var/lib/postgresql/data/postgresql.conf": No such file or directory
241
+ -' ?' |--help|--describe-config|-V|--version)
242
+ return 0
243
+ ;;
244
+ esac
245
+ done
246
+ return 1
247
+ }
248
+
232
249
_main () {
233
250
# if first arg looks like a flag, assume we want to run postgres server
234
251
if [ " ${1: 0: 1} " = ' -' ]; then
235
252
set -- postgres " $@ "
236
253
fi
237
254
238
- if [ " $1 " = ' postgres' ]; then
255
+ if [ " $1 " = ' postgres' ] && ! _pg_want_help " $@ " ; then
239
256
docker_setup_env
240
257
# setup data directories and permissions (when run as root)
241
258
docker_create_db_directories
Original file line number Diff line number Diff line change @@ -229,13 +229,30 @@ docker_temp_server_stop() {
229
229
pg_ctl -D " $PGDATA " -m fast -w stop
230
230
}
231
231
232
+ # check arguments for an option that would cause postgres to stop
233
+ # return true if there is one
234
+ _pg_want_help () {
235
+ local arg
236
+ for arg; do
237
+ case " $arg " in
238
+ # postgres --help | grep 'then exit'
239
+ # leaving out -C on purpose since it always fails and is unhelpful:
240
+ # postgres: could not access the server configuration file "/var/lib/postgresql/data/postgresql.conf": No such file or directory
241
+ -' ?' |--help|--describe-config|-V|--version)
242
+ return 0
243
+ ;;
244
+ esac
245
+ done
246
+ return 1
247
+ }
248
+
232
249
_main () {
233
250
# if first arg looks like a flag, assume we want to run postgres server
234
251
if [ " ${1: 0: 1} " = ' -' ]; then
235
252
set -- postgres " $@ "
236
253
fi
237
254
238
- if [ " $1 " = ' postgres' ]; then
255
+ if [ " $1 " = ' postgres' ] && ! _pg_want_help " $@ " ; then
239
256
docker_setup_env
240
257
# setup data directories and permissions (when run as root)
241
258
docker_create_db_directories
Original file line number Diff line number Diff line change @@ -229,13 +229,30 @@ docker_temp_server_stop() {
229
229
pg_ctl -D " $PGDATA " -m fast -w stop
230
230
}
231
231
232
+ # check arguments for an option that would cause postgres to stop
233
+ # return true if there is one
234
+ _pg_want_help () {
235
+ local arg
236
+ for arg; do
237
+ case " $arg " in
238
+ # postgres --help | grep 'then exit'
239
+ # leaving out -C on purpose since it always fails and is unhelpful:
240
+ # postgres: could not access the server configuration file "/var/lib/postgresql/data/postgresql.conf": No such file or directory
241
+ -' ?' |--help|--describe-config|-V|--version)
242
+ return 0
243
+ ;;
244
+ esac
245
+ done
246
+ return 1
247
+ }
248
+
232
249
_main () {
233
250
# if first arg looks like a flag, assume we want to run postgres server
234
251
if [ " ${1: 0: 1} " = ' -' ]; then
235
252
set -- postgres " $@ "
236
253
fi
237
254
238
- if [ " $1 " = ' postgres' ]; then
255
+ if [ " $1 " = ' postgres' ] && ! _pg_want_help " $@ " ; then
239
256
docker_setup_env
240
257
# setup data directories and permissions (when run as root)
241
258
docker_create_db_directories
Original file line number Diff line number Diff line change @@ -229,13 +229,30 @@ docker_temp_server_stop() {
229
229
pg_ctl -D " $PGDATA " -m fast -w stop
230
230
}
231
231
232
+ # check arguments for an option that would cause postgres to stop
233
+ # return true if there is one
234
+ _pg_want_help () {
235
+ local arg
236
+ for arg; do
237
+ case " $arg " in
238
+ # postgres --help | grep 'then exit'
239
+ # leaving out -C on purpose since it always fails and is unhelpful:
240
+ # postgres: could not access the server configuration file "/var/lib/postgresql/data/postgresql.conf": No such file or directory
241
+ -' ?' |--help|--describe-config|-V|--version)
242
+ return 0
243
+ ;;
244
+ esac
245
+ done
246
+ return 1
247
+ }
248
+
232
249
_main () {
233
250
# if first arg looks like a flag, assume we want to run postgres server
234
251
if [ " ${1: 0: 1} " = ' -' ]; then
235
252
set -- postgres " $@ "
236
253
fi
237
254
238
- if [ " $1 " = ' postgres' ]; then
255
+ if [ " $1 " = ' postgres' ] && ! _pg_want_help " $@ " ; then
239
256
docker_setup_env
240
257
# setup data directories and permissions (when run as root)
241
258
docker_create_db_directories
Original file line number Diff line number Diff line change @@ -229,13 +229,30 @@ docker_temp_server_stop() {
229
229
pg_ctl -D " $PGDATA " -m fast -w stop
230
230
}
231
231
232
+ # check arguments for an option that would cause postgres to stop
233
+ # return true if there is one
234
+ _pg_want_help () {
235
+ local arg
236
+ for arg; do
237
+ case " $arg " in
238
+ # postgres --help | grep 'then exit'
239
+ # leaving out -C on purpose since it always fails and is unhelpful:
240
+ # postgres: could not access the server configuration file "/var/lib/postgresql/data/postgresql.conf": No such file or directory
241
+ -' ?' |--help|--describe-config|-V|--version)
242
+ return 0
243
+ ;;
244
+ esac
245
+ done
246
+ return 1
247
+ }
248
+
232
249
_main () {
233
250
# if first arg looks like a flag, assume we want to run postgres server
234
251
if [ " ${1: 0: 1} " = ' -' ]; then
235
252
set -- postgres " $@ "
236
253
fi
237
254
238
- if [ " $1 " = ' postgres' ]; then
255
+ if [ " $1 " = ' postgres' ] && ! _pg_want_help " $@ " ; then
239
256
docker_setup_env
240
257
# setup data directories and permissions (when run as root)
241
258
docker_create_db_directories
Original file line number Diff line number Diff line change @@ -229,13 +229,30 @@ docker_temp_server_stop() {
229
229
pg_ctl -D " $PGDATA " -m fast -w stop
230
230
}
231
231
232
+ # check arguments for an option that would cause postgres to stop
233
+ # return true if there is one
234
+ _pg_want_help () {
235
+ local arg
236
+ for arg; do
237
+ case " $arg " in
238
+ # postgres --help | grep 'then exit'
239
+ # leaving out -C on purpose since it always fails and is unhelpful:
240
+ # postgres: could not access the server configuration file "/var/lib/postgresql/data/postgresql.conf": No such file or directory
241
+ -' ?' |--help|--describe-config|-V|--version)
242
+ return 0
243
+ ;;
244
+ esac
245
+ done
246
+ return 1
247
+ }
248
+
232
249
_main () {
233
250
# if first arg looks like a flag, assume we want to run postgres server
234
251
if [ " ${1: 0: 1} " = ' -' ]; then
235
252
set -- postgres " $@ "
236
253
fi
237
254
238
- if [ " $1 " = ' postgres' ]; then
255
+ if [ " $1 " = ' postgres' ] && ! _pg_want_help " $@ " ; then
239
256
docker_setup_env
240
257
# setup data directories and permissions (when run as root)
241
258
docker_create_db_directories
You can’t perform that action at this time.
0 commit comments