File tree Expand file tree Collapse file tree 13 files changed +78
-91
lines changed Expand file tree Collapse file tree 13 files changed +78
-91
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ _is_sourced() {
3434
3535# used to create initial posgres directories and if run as root, ensure ownership to the "postgres" user
3636docker_create_db_directories () {
37- local user=" $( id -u) "
37+ local user; user =" $( id -u) "
3838
3939 mkdir -p " $PGDATA "
4040 chmod 700 " $PGDATA "
@@ -46,7 +46,9 @@ docker_create_db_directories() {
4646 # Create the transaction log directory before initdb is run so the directory is owned by the correct user
4747 if [ " $POSTGRES_INITDB_WALDIR " ]; then
4848 mkdir -p " $POSTGRES_INITDB_WALDIR "
49- [ " $user " = ' 0' ] && find " $POSTGRES_INITDB_WALDIR " \! -user postgres - exec chown postgres ' {}' +
49+ if [ " $user " = ' 0' ]; then
50+ find " $POSTGRES_INITDB_WALDIR " \! -user postgres -exec chown postgres ' {}' +
51+ fi
5052 chmod 700 " $POSTGRES_INITDB_WALDIR "
5153 fi
5254
@@ -193,10 +195,8 @@ docker_setup_env() {
193195
194196# append md5 or trust auth to pg_hba.conf based on existence of POSTGRES_PASSWORD
195197pg_setup_hba_conf () {
196- local authMethod
197- if [ " $POSTGRES_PASSWORD " ]; then
198- authMethod=' md5'
199- else
198+ local authMethod=' md5'
199+ if [ -z " $POSTGRES_PASSWORD " ]; then
200200 authMethod=' trust'
201201 fi
202202
@@ -232,7 +232,6 @@ _main() {
232232 set -- postgres " $@ "
233233 fi
234234
235-
236235 if [ " $1 " = ' postgres' ]; then
237236 docker_setup_env
238237 # setup data directories and permissions (when run as root)
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ _is_sourced() {
3434
3535# used to create initial posgres directories and if run as root, ensure ownership to the "postgres" user
3636docker_create_db_directories () {
37- local user=" $( id -u) "
37+ local user; user =" $( id -u) "
3838
3939 mkdir -p " $PGDATA "
4040 chmod 700 " $PGDATA "
@@ -46,7 +46,9 @@ docker_create_db_directories() {
4646 # Create the transaction log directory before initdb is run so the directory is owned by the correct user
4747 if [ " $POSTGRES_INITDB_WALDIR " ]; then
4848 mkdir -p " $POSTGRES_INITDB_WALDIR "
49- [ " $user " = ' 0' ] && find " $POSTGRES_INITDB_WALDIR " \! -user postgres - exec chown postgres ' {}' +
49+ if [ " $user " = ' 0' ]; then
50+ find " $POSTGRES_INITDB_WALDIR " \! -user postgres -exec chown postgres ' {}' +
51+ fi
5052 chmod 700 " $POSTGRES_INITDB_WALDIR "
5153 fi
5254
@@ -193,10 +195,8 @@ docker_setup_env() {
193195
194196# append md5 or trust auth to pg_hba.conf based on existence of POSTGRES_PASSWORD
195197pg_setup_hba_conf () {
196- local authMethod
197- if [ " $POSTGRES_PASSWORD " ]; then
198- authMethod=' md5'
199- else
198+ local authMethod=' md5'
199+ if [ -z " $POSTGRES_PASSWORD " ]; then
200200 authMethod=' trust'
201201 fi
202202
@@ -232,7 +232,6 @@ _main() {
232232 set -- postgres " $@ "
233233 fi
234234
235-
236235 if [ " $1 " = ' postgres' ]; then
237236 docker_setup_env
238237 # setup data directories and permissions (when run as root)
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ _is_sourced() {
3434
3535# used to create initial posgres directories and if run as root, ensure ownership to the "postgres" user
3636docker_create_db_directories () {
37- local user=" $( id -u) "
37+ local user; user =" $( id -u) "
3838
3939 mkdir -p " $PGDATA "
4040 chmod 700 " $PGDATA "
@@ -46,7 +46,9 @@ docker_create_db_directories() {
4646 # Create the transaction log directory before initdb is run so the directory is owned by the correct user
4747 if [ " $POSTGRES_INITDB_WALDIR " ]; then
4848 mkdir -p " $POSTGRES_INITDB_WALDIR "
49- [ " $user " = ' 0' ] && find " $POSTGRES_INITDB_WALDIR " \! -user postgres - exec chown postgres ' {}' +
49+ if [ " $user " = ' 0' ]; then
50+ find " $POSTGRES_INITDB_WALDIR " \! -user postgres -exec chown postgres ' {}' +
51+ fi
5052 chmod 700 " $POSTGRES_INITDB_WALDIR "
5153 fi
5254
@@ -193,10 +195,8 @@ docker_setup_env() {
193195
194196# append md5 or trust auth to pg_hba.conf based on existence of POSTGRES_PASSWORD
195197pg_setup_hba_conf () {
196- local authMethod
197- if [ " $POSTGRES_PASSWORD " ]; then
198- authMethod=' md5'
199- else
198+ local authMethod=' md5'
199+ if [ -z " $POSTGRES_PASSWORD " ]; then
200200 authMethod=' trust'
201201 fi
202202
@@ -232,7 +232,6 @@ _main() {
232232 set -- postgres " $@ "
233233 fi
234234
235-
236235 if [ " $1 " = ' postgres' ]; then
237236 docker_setup_env
238237 # setup data directories and permissions (when run as root)
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ _is_sourced() {
3434
3535# used to create initial posgres directories and if run as root, ensure ownership to the "postgres" user
3636docker_create_db_directories () {
37- local user=" $( id -u) "
37+ local user; user =" $( id -u) "
3838
3939 mkdir -p " $PGDATA "
4040 chmod 700 " $PGDATA "
@@ -46,7 +46,9 @@ docker_create_db_directories() {
4646 # Create the transaction log directory before initdb is run so the directory is owned by the correct user
4747 if [ " $POSTGRES_INITDB_WALDIR " ]; then
4848 mkdir -p " $POSTGRES_INITDB_WALDIR "
49- [ " $user " = ' 0' ] && find " $POSTGRES_INITDB_WALDIR " \! -user postgres - exec chown postgres ' {}' +
49+ if [ " $user " = ' 0' ]; then
50+ find " $POSTGRES_INITDB_WALDIR " \! -user postgres -exec chown postgres ' {}' +
51+ fi
5052 chmod 700 " $POSTGRES_INITDB_WALDIR "
5153 fi
5254
@@ -193,10 +195,8 @@ docker_setup_env() {
193195
194196# append md5 or trust auth to pg_hba.conf based on existence of POSTGRES_PASSWORD
195197pg_setup_hba_conf () {
196- local authMethod
197- if [ " $POSTGRES_PASSWORD " ]; then
198- authMethod=' md5'
199- else
198+ local authMethod=' md5'
199+ if [ -z " $POSTGRES_PASSWORD " ]; then
200200 authMethod=' trust'
201201 fi
202202
@@ -232,7 +232,6 @@ _main() {
232232 set -- postgres " $@ "
233233 fi
234234
235-
236235 if [ " $1 " = ' postgres' ]; then
237236 docker_setup_env
238237 # setup data directories and permissions (when run as root)
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ _is_sourced() {
3434
3535# used to create initial posgres directories and if run as root, ensure ownership to the "postgres" user
3636docker_create_db_directories () {
37- local user=" $( id -u) "
37+ local user; user =" $( id -u) "
3838
3939 mkdir -p " $PGDATA "
4040 chmod 700 " $PGDATA "
@@ -46,7 +46,9 @@ docker_create_db_directories() {
4646 # Create the transaction log directory before initdb is run so the directory is owned by the correct user
4747 if [ " $POSTGRES_INITDB_WALDIR " ]; then
4848 mkdir -p " $POSTGRES_INITDB_WALDIR "
49- [ " $user " = ' 0' ] && find " $POSTGRES_INITDB_WALDIR " \! -user postgres - exec chown postgres ' {}' +
49+ if [ " $user " = ' 0' ]; then
50+ find " $POSTGRES_INITDB_WALDIR " \! -user postgres -exec chown postgres ' {}' +
51+ fi
5052 chmod 700 " $POSTGRES_INITDB_WALDIR "
5153 fi
5254
@@ -193,10 +195,8 @@ docker_setup_env() {
193195
194196# append md5 or trust auth to pg_hba.conf based on existence of POSTGRES_PASSWORD
195197pg_setup_hba_conf () {
196- local authMethod
197- if [ " $POSTGRES_PASSWORD " ]; then
198- authMethod=' md5'
199- else
198+ local authMethod=' md5'
199+ if [ -z " $POSTGRES_PASSWORD " ]; then
200200 authMethod=' trust'
201201 fi
202202
@@ -232,7 +232,6 @@ _main() {
232232 set -- postgres " $@ "
233233 fi
234234
235-
236235 if [ " $1 " = ' postgres' ]; then
237236 docker_setup_env
238237 # setup data directories and permissions (when run as root)
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ _is_sourced() {
3434
3535# used to create initial posgres directories and if run as root, ensure ownership to the "postgres" user
3636docker_create_db_directories () {
37- local user=" $( id -u) "
37+ local user; user =" $( id -u) "
3838
3939 mkdir -p " $PGDATA "
4040 chmod 700 " $PGDATA "
@@ -46,7 +46,9 @@ docker_create_db_directories() {
4646 # Create the transaction log directory before initdb is run so the directory is owned by the correct user
4747 if [ " $POSTGRES_INITDB_WALDIR " ]; then
4848 mkdir -p " $POSTGRES_INITDB_WALDIR "
49- [ " $user " = ' 0' ] && find " $POSTGRES_INITDB_WALDIR " \! -user postgres - exec chown postgres ' {}' +
49+ if [ " $user " = ' 0' ]; then
50+ find " $POSTGRES_INITDB_WALDIR " \! -user postgres -exec chown postgres ' {}' +
51+ fi
5052 chmod 700 " $POSTGRES_INITDB_WALDIR "
5153 fi
5254
@@ -193,10 +195,8 @@ docker_setup_env() {
193195
194196# append md5 or trust auth to pg_hba.conf based on existence of POSTGRES_PASSWORD
195197pg_setup_hba_conf () {
196- local authMethod
197- if [ " $POSTGRES_PASSWORD " ]; then
198- authMethod=' md5'
199- else
198+ local authMethod=' md5'
199+ if [ -z " $POSTGRES_PASSWORD " ]; then
200200 authMethod=' trust'
201201 fi
202202
@@ -232,7 +232,6 @@ _main() {
232232 set -- postgres " $@ "
233233 fi
234234
235-
236235 if [ " $1 " = ' postgres' ]; then
237236 docker_setup_env
238237 # setup data directories and permissions (when run as root)
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ _is_sourced() {
3434
3535# used to create initial posgres directories and if run as root, ensure ownership to the "postgres" user
3636docker_create_db_directories () {
37- local user=" $( id -u) "
37+ local user; user =" $( id -u) "
3838
3939 mkdir -p " $PGDATA "
4040 chmod 700 " $PGDATA "
@@ -46,7 +46,9 @@ docker_create_db_directories() {
4646 # Create the transaction log directory before initdb is run so the directory is owned by the correct user
4747 if [ " $POSTGRES_INITDB_XLOGDIR " ]; then
4848 mkdir -p " $POSTGRES_INITDB_XLOGDIR "
49- [ " $user " = ' 0' ] && find " $POSTGRES_INITDB_XLOGDIR " \! -user postgres - exec chown postgres ' {}' +
49+ if [ " $user " = ' 0' ]; then
50+ find " $POSTGRES_INITDB_XLOGDIR " \! -user postgres -exec chown postgres ' {}' +
51+ fi
5052 chmod 700 " $POSTGRES_INITDB_XLOGDIR "
5153 fi
5254
@@ -193,10 +195,8 @@ docker_setup_env() {
193195
194196# append md5 or trust auth to pg_hba.conf based on existence of POSTGRES_PASSWORD
195197pg_setup_hba_conf () {
196- local authMethod
197- if [ " $POSTGRES_PASSWORD " ]; then
198- authMethod=' md5'
199- else
198+ local authMethod=' md5'
199+ if [ -z " $POSTGRES_PASSWORD " ]; then
200200 authMethod=' trust'
201201 fi
202202
@@ -232,7 +232,6 @@ _main() {
232232 set -- postgres " $@ "
233233 fi
234234
235-
236235 if [ " $1 " = ' postgres' ]; then
237236 docker_setup_env
238237 # setup data directories and permissions (when run as root)
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ _is_sourced() {
3434
3535# used to create initial posgres directories and if run as root, ensure ownership to the "postgres" user
3636docker_create_db_directories () {
37- local user=" $( id -u) "
37+ local user; user =" $( id -u) "
3838
3939 mkdir -p " $PGDATA "
4040 chmod 700 " $PGDATA "
@@ -46,7 +46,9 @@ docker_create_db_directories() {
4646 # Create the transaction log directory before initdb is run so the directory is owned by the correct user
4747 if [ " $POSTGRES_INITDB_XLOGDIR " ]; then
4848 mkdir -p " $POSTGRES_INITDB_XLOGDIR "
49- [ " $user " = ' 0' ] && find " $POSTGRES_INITDB_XLOGDIR " \! -user postgres - exec chown postgres ' {}' +
49+ if [ " $user " = ' 0' ]; then
50+ find " $POSTGRES_INITDB_XLOGDIR " \! -user postgres -exec chown postgres ' {}' +
51+ fi
5052 chmod 700 " $POSTGRES_INITDB_XLOGDIR "
5153 fi
5254
@@ -193,10 +195,8 @@ docker_setup_env() {
193195
194196# append md5 or trust auth to pg_hba.conf based on existence of POSTGRES_PASSWORD
195197pg_setup_hba_conf () {
196- local authMethod
197- if [ " $POSTGRES_PASSWORD " ]; then
198- authMethod=' md5'
199- else
198+ local authMethod=' md5'
199+ if [ -z " $POSTGRES_PASSWORD " ]; then
200200 authMethod=' trust'
201201 fi
202202
@@ -232,7 +232,6 @@ _main() {
232232 set -- postgres " $@ "
233233 fi
234234
235-
236235 if [ " $1 " = ' postgres' ]; then
237236 docker_setup_env
238237 # setup data directories and permissions (when run as root)
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ _is_sourced() {
3434
3535# used to create initial posgres directories and if run as root, ensure ownership to the "postgres" user
3636docker_create_db_directories () {
37- local user=" $( id -u) "
37+ local user; user =" $( id -u) "
3838
3939 mkdir -p " $PGDATA "
4040 chmod 700 " $PGDATA "
@@ -46,7 +46,9 @@ docker_create_db_directories() {
4646 # Create the transaction log directory before initdb is run so the directory is owned by the correct user
4747 if [ " $POSTGRES_INITDB_XLOGDIR " ]; then
4848 mkdir -p " $POSTGRES_INITDB_XLOGDIR "
49- [ " $user " = ' 0' ] && find " $POSTGRES_INITDB_XLOGDIR " \! -user postgres - exec chown postgres ' {}' +
49+ if [ " $user " = ' 0' ]; then
50+ find " $POSTGRES_INITDB_XLOGDIR " \! -user postgres -exec chown postgres ' {}' +
51+ fi
5052 chmod 700 " $POSTGRES_INITDB_XLOGDIR "
5153 fi
5254
@@ -193,10 +195,8 @@ docker_setup_env() {
193195
194196# append md5 or trust auth to pg_hba.conf based on existence of POSTGRES_PASSWORD
195197pg_setup_hba_conf () {
196- local authMethod
197- if [ " $POSTGRES_PASSWORD " ]; then
198- authMethod=' md5'
199- else
198+ local authMethod=' md5'
199+ if [ -z " $POSTGRES_PASSWORD " ]; then
200200 authMethod=' trust'
201201 fi
202202
@@ -232,7 +232,6 @@ _main() {
232232 set -- postgres " $@ "
233233 fi
234234
235-
236235 if [ " $1 " = ' postgres' ]; then
237236 docker_setup_env
238237 # setup data directories and permissions (when run as root)
You can’t perform that action at this time.
0 commit comments