-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Update postgres #13785
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Update postgres #13785
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Changes: - docker-library/postgres@7a852f4: Merge pull request docker-library/postgres#1024 from infosiftr/no-echo - docker-library/postgres@7e5e7ec: Convert all entrypoint "echo"s to "printf" - docker-library/postgres@f8827c3: Update generated README
Diff for f6ad9fc:diff --git a/_bashbrew-cat b/_bashbrew-cat
index bce244c..0176ef5 100644
--- a/_bashbrew-cat
+++ b/_bashbrew-cat
@@ -3,50 +3,50 @@ GitRepo: https://github.com/docker-library/postgres.git
Tags: 11.18-alpine, 11-alpine, 11.18-alpine3.17, 11-alpine3.17
Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x
-GitCommit: a2d5beb991190467e462d6e151c98fafc338ce94
+GitCommit: 7e5e7ece73bf021d9b0797582648424d3a7deb87
Directory: 11/alpine
Tags: 11.18-bullseye, 11-bullseye
Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: 14022440352a9e24d86cae450600ea56969d234b
+GitCommit: 7e5e7ece73bf021d9b0797582648424d3a7deb87
Directory: 11/bullseye
Tags: 12.13, 12, 12.13-bullseye, 12-bullseye
Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: 5ca94d535d75308b16125d132048bf93172521db
+GitCommit: 7e5e7ece73bf021d9b0797582648424d3a7deb87
Directory: 12/bullseye
Tags: 12.13-alpine, 12-alpine, 12.13-alpine3.17, 12-alpine3.17
Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x
-GitCommit: a2d5beb991190467e462d6e151c98fafc338ce94
+GitCommit: 7e5e7ece73bf021d9b0797582648424d3a7deb87
Directory: 12/alpine
Tags: 13.9, 13, 13.9-bullseye, 13-bullseye
Architectu
10000
res: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: 883b1c3f7b485153ec5d841271801ee436ec3314
+GitCommit: 7e5e7ece73bf021d9b0797582648424d3a7deb87
Directory: 13/bullseye
Tags: 13.9-alpine, 13-alpine, 13.9-alpine3.17, 13-alpine3.17
Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x
-GitCommit: a2d5beb991190467e462d6e151c98fafc338ce94
+GitCommit: 7e5e7ece73bf021d9b0797582648424d3a7deb87
Directory: 13/alpine
Tags: 14.6, 14, 14.6-bullseye, 14-bullseye
Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: e8ba287990e5e312278fc59131f8a796953dc6c4
+GitCommit: 7e5e7ece73bf021d9b0797582648424d3a7deb87
Directory: 14/bullseye
Tags: 14.6-alpine, 14-alpine, 14.6-alpine3.17, 14-alpine3.17
Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x
-GitCommit: a2d5beb991190467e462d6e151c98fafc338ce94
+GitCommit: 7e5e7ece73bf021d9b0797582648424d3a7deb87
Directory: 14/alpine
Tags: 15.1, 15, latest, 15.1-bullseye, 15-bullseye, bullseye
Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: 75d0c1135e1cfd183bf7ee0970b7031986b0710d
+GitCommit: 7e5e7ece73bf021d9b0797582648424d3a7deb87
Directory: 15/bullseye
Tags: 15.1-alpine, 15-alpine, alpine, 15.1-alpine3.17, 15-alpine3.17, alpine3.17
Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x
-GitCommit: a2d5beb991190467e462d6e151c98fafc338ce94
+GitCommit: 7e5e7ece73bf021d9b0797582648424d3a7deb87
Directory: 15/alpine
diff --git a/postgres_11-alpine3.17/docker-entrypoint.sh b/postgres_11-alpine3.17/docker-entrypoint.sh
index 07b0cdc..ce794a2 100755
--- a/postgres_11-alpine3.17/docker-entrypoint.sh
+++ b/postgres_11-alpine3.17/docker-entrypoint.sh
@@ -11,7 +11,7 @@ file_env() {
local fileVar="${var}_FILE"
local def="${2:-}"
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
- echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
+ printf >&2 'error: both %s and %s are set (but are exclusive)\n' "$var" "$fileVar"
exit 1
fi
local val="$def"
@@ -77,8 +77,8 @@ docker_init_database_dir() {
NSS_WRAPPER_GROUP="$(mktemp)"
export LD_PRELOAD="$wrapper" NSS_WRAPPER_PASSWD NSS_WRAPPER_GROUP
local gid; gid="$(id -g)"
- echo "postgres:x:$uid:$gid:PostgreSQL:$PGDATA:/bin/false" > "$NSS_WRAPPER_PASSWD"
- echo "postgres:x:$gid:" > "$NSS_WRAPPER_GROUP"
+ printf 'postgres:x:%s:%s:PostgreSQL:%s:/bin/false\n' "$uid" "$gid" "$PGDATA" > "$NSS_WRAPPER_PASSWD"
+ printf 'postgres:x:%s:\n' "$gid" > "$NSS_WRAPPER_GROUP"
break
fi
done
@@ -88,7 +88,7 @@ docker_init_database_dir() {
set -- --waldir "$POSTGRES_INITDB_WALDIR" "$@"
fi
- eval 'initdb --username="$POSTGRES_USER" --pwfile=<(echo "$POSTGRES_PASSWORD") '"$POSTGRES_INITDB_ARGS"' "$@"'
+ eval 'initdb --username="$POSTGRES_USER" --pwfile=<(printf "%s" "$POSTGRES_PASSWORD") '"$POSTGRES_INITDB_ARGS"' "$@"'
# unset/cleanup "nss_wrapper" bits
if [[ "${LD_PRELOAD:-}" == */libnss_wrapper.so ]]; then
@@ -157,7 +157,7 @@ docker_process_init_files() {
# psql here for backwards compatibility "${psql[@]}"
psql=( docker_process_sql )
- echo
+ printf '\n'
local f
for f; do
case "$f" in
@@ -165,20 +165,20 @@ docker_process_init_files() {
# https://github.com/docker-library/postgres/issues/450#issuecomment-393167936
# https://github.com/docker-library/postgres/pull/452
if [ -x "$f" ]; then
- echo "$0: running $f"
+ printf '%s: running %s\n' "$0" "$f"
"$f"
else
- echo "$0: sourcing $f"
+ printf '%s: sourcing %s\n' "$0" "$f"
. "$f"
fi
;;
- *.sql) echo "$0: running $f"; docker_process_sql -f "$f"; echo ;;
- *.sql.gz) echo "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;;
- *.sql.xz) echo "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;;
- *.sql.zst) echo "$0: running $f"; zstd -dc "$f" | docker_process_sql; echo ;;
- *) echo "$0: ignoring $f" ;;
+ *.sql) printf '%s: running %s\n' "$0" "$f"; docker_process_sql -f "$f"; printf '\n' ;;
+ *.sql.gz) printf '%s: running %s\n' "$0" "$f"; gunzip -c "$f" | docker_process_sql; printf '\n' ;;
+ *.sql.xz) printf '%s: running %s\n' "$0" "$f"; xzcat "$f" | docker_process_sql; printf '\n' ;;
+ *.sql.zst) printf '%s: running %s\n' "$0" "$f"; zstd -dc "$f" | docker_process_sql; printf '\n' ;;
+ *) printf '%s: ignoring %s\n' "$0" "$f" ;;
esac
- echo
+ printf '\n'
done
}
@@ -209,7 +209,7 @@ docker_setup_db() {
POSTGRES_DB= docker_process_sql --dbname postgres --set db="$POSTGRES_DB" <<-'EOSQL'
CREATE DATABASE :"db" ;
EOSQL
- echo
+ printf '\n'
fi
}
@@ -243,12 +243,12 @@ pg_setup_hba_conf() {
auth="$(postgres -C password_encryption "$@")"
: "${POSTGRES_HOST_AUTH_METHOD:=$auth}"
{
- echo
+ printf '\n'
if [ 'trust' = "$POSTGRES_HOST_AUTH_METHOD" ]; then
- echo '# warning trust is enabled for all connections'
- echo '# see https://www.postgresql.org/docs/12/auth-trust.html'
+ printf '# warning trust is enabled for all connections\n'
+ printf '# see https://www.postgresql.org/docs/12/auth-trust.html\n'
fi
- echo "host all all all $POSTGRES_HOST_AUTH_METHOD"
+ printf 'host all all all %s\n' "$POSTGRES_HOST_AUTH_METHOD"
} >> "$PGDATA/pg_hba.conf"
}
@@ -328,13 +328,17 @@ _main() {
docker_temp_server_stop
unset PGPASSWORD
- echo
- echo 'PostgreSQL init process complete; ready for start up.'
- echo
+ cat <<-'EOM'
+
+ PostgreSQL init process complete; ready for start up.
+
+ EOM
else
- echo
- echo 'PostgreSQL Database directory appears to contain a database; Skipping initialization'
- echo
+ cat <<-'EOM'
+
+ PostgreSQL Database directory appears to contain a database; Skipping initialization
+
+ EOM
fi
fi
diff --git a/postgres_11-bullseye/docker-entrypoint.sh b/postgres_11-bullseye/docker-entrypoint.sh
index 1896cd8..7167ae3 100755
--- a/postgres_11-bullseye/docker-entrypoint.sh
+++ b/postgres_11-bullseye/docker-entrypoint.sh
@@ -11,7 +11,7 @@ file_env() {
local fileVar="${var}_FILE"
local def="${2:-}"
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
- echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
+ printf >&2 'error: both %s and %s are set (but are exclusive)\n' "$var" "$fileVar"
exit 1
fi
local val="$def"
@@ -77,8 +77,8 @@ docker_init_database_dir() {
NSS_WRAPPER_GROUP="$(mktemp)"
export LD_PRELOAD="$wrapper" NSS_WRAPPER_PASSWD NSS_WRAPPER_GROUP
local gid; gid="$(id -g)"
- echo "postgres:x:$uid:$gid:PostgreSQL:$PGDATA:/bin/false" > "$NSS_WRAPPER_PASSWD"
- echo "postgres:x:$gid:" > "$NSS_WRAPPER_GROUP"
+ printf 'postgres:x:%s:%s:PostgreSQL:%s:/bin/false\n' "$uid" "$gid" "$PGDATA" > "$NSS_WRAPPER_PASSWD"
+ printf 'postgres:x:%s:\n' "$gid" > "$NSS_WRAPPER_GROUP"
break
fi
done
@@ -88,7 +88,7 @@ docker_init_database_dir() {
set -- --waldir "$POSTGRES_INITDB_WALDIR" "$@"
fi
- eval 'initdb --username="$POSTGRES_USER" --pwfile=<(echo "$POSTGRES_PASSWORD") '"$POSTGRES_INITDB_ARGS"' "$@"'
+ eval 'initdb --username="$POSTGRES_USER" --pwfile=<(printf "%s" "$POSTGRES_PASSWORD") '"$POSTGRES_INITDB_ARGS"' "$@"'
# unset/cleanup "nss_wrapper" bits
if [[ "${LD_PRELOAD:-}" == */libnss_wrapper.so ]]; then
@@ -157,7 +157,7 @@ docker_process_init_files() {
# psql here for backwards compatibility "${psql[@]}"
psql=( docker_process_sql )
- echo
+ printf '\n'
local f
for f; do
case "$f" in
@@ -165,20 +165,20 @@ docker_process_init_files() {
# https://github.com/docker-library/postgres/issues/450#issuecomment-393167936
# https://github.com/docker-library/postgres/pull/452
if [ -x "$f" ]; then
- echo "$0: running $f"
+ printf '%s: running %s\n' "$0" "$f"
"$f"
else
- echo "$0: sourcing $f"
+ printf '%s: sourcing %s\n' "$0" "$f"
. "$f"
fi
;;
- *.sql) echo "$0: running $f"; docker_process_sql -f "$f"; echo ;;
- *.sql.gz) echo "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;;
- *.sql.xz) echo "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;;
- *.sql.zst) echo "$0: running $f"; zstd -dc "$f" | docker_process_sql; echo ;;
- *) echo "$0: ignoring $f" ;;
+ *.sql) printf '%s: running %s\n' "$0" "$f"; docker_process_sql -f "$f"; printf '\n' ;;
+ *.sql.gz) printf '%s: running %s\n' "$0" "$f"; gunzip -c "$f" | docker_process_sql; printf '\n' ;;
+ *.sql.xz) printf '%s: running %s\n' "$0" "$f"; xzcat "$f" | docker_process_sql; printf '\n' ;;
+ *.sql.zst) printf '%s: running %s\n' "$0" "$f"; zstd -dc "$f" | docker_process_sql; printf '\n' ;;
+ *) printf '%s: ignoring %s\n' "$0" "$f" ;;
esac
- echo
+ printf '\n'
done
}
@@ -209,7 +209,7 @@ docker_setup_db() {
POSTGRES_DB= docker_process_sql --dbname postgres --set db="$POSTGRES_DB" <<-'EOSQL'
CREATE DATABASE :"db" ;
EOSQL
- echo
+ printf '\n'
fi
}
@@ -243,12 +243,12 @@ pg_setup_hba_conf() {
auth="$(postgres -C password_encryption "$@")"
: "${POSTGRES_HOST_AUTH_METHOD:=$auth}"
{
- echo
+ printf '\n'
if [ 'trust' = "$POSTGRES_HOST_AUTH_METHOD" ]; then
- echo '# warning trust is enabled for all connections'
- echo '# see https://www.postgresql.org/docs/12/auth-trust.html'
+ printf '# warning trust is enabled for all connections\n'
+ printf '# see https://www.postgresql.org/docs/12/auth-trust.html\n'
fi
- echo "host all all all $POSTGRES_HOST_AUTH_METHOD"
+ printf 'host all all all %s\n' "$POSTGRES_HOST_AUTH_METHOD"
} >> "$PGDATA/pg_hba.conf"
}
@@ -328,13 +328,17 @@ _main() {
docker_temp_server_stop
unset PGPASSWORD
- echo
- echo 'PostgreSQL init process complete; ready for start up.'
- echo
+ cat <<-'EOM'
+
+ PostgreSQL init process complete; ready for start up.
+
+ EOM
else
- echo
- echo 'PostgreSQL Database directory appears to contain a database; Skipping initialization'
- echo
+ cat <<-'EOM'
+
+ PostgreSQL Database directory appears to contain a database; Skipping initialization
+
+ EOM
fi
fi
diff --git a/postgres_12-alpine3.17/docker-entrypoint.sh b/postgres_12-alpine3.17/docker-entrypoint.sh
index 07b0cdc..ce794a2 100755
--- a/postgres_12-alpine3.17/docker-entrypoint.sh
+++ b/postgres_12-alpine3.17/docker-entrypoint.sh
@@ -11,7 +11,7 @@ file_env() {
local fileVar="${var}_FILE"
local def="${2:-}"
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
- echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
+ printf >&2 'error: both %s and %s are set (but are exclusive)\n' "$var" "$fileVar"
exit 1
fi
local val="$def"
@@ -77,8 +77,8 @@ docker_init_database_dir() {
NSS_WRAPPER_GROUP="$(mktemp)"
export LD_PRELOAD="$wrapper" NSS_WRAPPER_PASSWD NSS_WRAPPER_GROUP
local gid; gid="$(id -g)"
- echo "postgres:x:$uid:$gid:PostgreSQL:$PGDATA:/bin/false" > "$NSS_WRAPPER_PASSWD"
- echo "postgres:x:$gid:" > "$NSS_WRAPPER_GROUP"
+ printf 'postgres:x:%s:%s:PostgreSQL:%s:/bin/false\n' "$uid" "$gid" "$PGDATA" > "$NSS_WRAPPER_PASSWD"
+ printf 'postgres:x:%s:\n' "$gid" > "$NSS_WRAPPER_GROUP"
break
fi
done
@@ -88,7 +88,7 @@ docker_init_database_dir() {
set -- --waldir "$POSTGRES_INITDB_WALDIR" "$@"
fi
- eval 'initdb --username="$POSTGRES_USER" --pwfile=<(echo "$POSTGRES_PASSWORD") '"$POSTGRES_INITDB_ARGS"' "$@"'
+ eval 'initdb --username="$POSTGRES_USER" --pwfile=<(printf "%s" "$POSTGRES_PASSWORD") '"$POSTGRES_INITDB_ARGS"' "$@"'
# unset/cleanup "nss_wrapper" bits
if [[ "${LD_PRELOAD:-}" == */libnss_wrapper.so ]]; then
@@ -157,7 +157,7 @@ docker_process_init_files() {
# psql here for backwards compatibility "${psql[@]}"
psql=( docker_process_sql )
- echo
+ printf '\n'
local f
for f; do
case "$f" in
@@ -165,20 +165,20 @@ docker_process_init_files() {
# https://github.com/docker-library/postgres/issues/450#issuecomment-393167936
# https://github.com/docker-library/postgres/pull/452
if [ -x "$f" ]; then
- echo "$0: running $f"
+ printf '%s: running %s\n' "$0" "$f"
"$f"
else
- echo "$0: sourcing $f"
+ printf '%s: sourcing %s\n' "$0" "$f"
. "$f"
fi
;;
- *.sql) echo "$0: running $f"; docker_process_sql -f "$f"; echo ;;
- *.sql.gz) echo "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;;
- *.sql.xz) echo "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;;
- *.sql.zst) echo "$0: running $f"; zstd -dc "$f" | docker_process_sql; echo ;;
- *) echo "$0: ignoring $f" ;;
+ *.sql) printf '%s: running %s\n' "$0" "$f"; docker_process_sql -f "$f"; printf '\n' ;;
+ *.sql.gz) printf '%s: running %s\n' "$0" "$f"; gunzip -c "$f" | docker_process_sql; printf '\n' ;;
+ *.sql.xz) printf '%s: running %s\n' "$0" "$f"; xzcat "$f" | docker_process_sql; printf '\n' ;;
+ *.sql.zst) printf '%s: running %s\n' "$0" "$f"; zstd -dc "$f" | docker_process_sql; printf '\n' ;;
+ *) printf '%s: ignoring %s\n' "$0" "$f" ;;
esac
- echo
+ printf '\n'
done
}
@@ -209,7 +209,7 @@ docker_setup_db() {
POSTGRES_DB= docker_process_sql --dbname postgres --set db="$POSTGRES_DB" <<-'EOSQL'
CREATE DATABASE :"db" ;
EOSQL
- echo
+ printf '\n'
fi
}
@@ -243,12 +243,12 @@ pg_setup_hba_conf() {
auth="$(postgres -C password_encryption "$@")"
: "${POSTGRES_HOST_AUTH_METHOD:=$auth}"
{
- echo
+ printf '\n'
if [ 'trust' = "$POSTGRES_HOST_AUTH_METHOD" ]; then
- echo '# warning trust is enabled for all connections'
- echo '# see https://www.postgresql.org/docs/12/auth-trust.html'
+ printf '# warning trust is enabled for all connections\n'
+ printf '# see https://www.postgresql.org/docs/12/auth-trust.html\n'
fi
- echo "host all all all $POSTGRES_HOST_AUTH_METHOD"
+ printf 'host all all all %s\n' "$POSTGRES_HOST_AUTH_METHOD"
} >> "$PGDATA/pg_hba.conf"
}
@@ -328,13 +328,17 @@ _main() {
docker_temp_server_stop
unset PGPASSWORD
- echo
- echo 'PostgreSQL init process complete; ready for start up.'
- echo
+ cat <<-'EOM'
+
+ PostgreSQL init process complete; ready for start up.
+
+ EOM
else
- echo
- echo 'PostgreSQL Database directory appears to contain a database; Skipping initialization'
- echo
+ cat <<-'EOM'
+
+ PostgreSQL Database directory appears to contain a database; Skipping initialization
+
+ EOM
fi
fi
diff --git a/postgres_12-bullseye/docker-entrypoint.sh b/postgres_12-bullseye/docker-entrypoint.sh
index 1896cd8..7167ae3 100755
--- a/postgres_12-bullseye/docker-entrypoint.sh
+++ b/postgres_12-bullseye/docker-entrypoint.sh
@@ -11,7 +11,7 @@ file_env() {
local fileVar="${var}_FILE"
local def="${2:-}"
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
- echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
+ printf >&2 'error: both %s and %s are set (but are exclusive)\n' "$var" "$fileVar"
exit 1
fi
local val="$def"
@@ -77,8 +77,8 @@ docker_init_database_dir() {
NSS_WRAPPER_GROUP="$(mktemp)"
export LD_PRELOAD="$wrapper" NSS_WRAPPER_PASSWD NSS_WRAPPER_GROUP
local gid; gid="$(id -g)"
- echo "postgres:x:$uid:$gid:PostgreSQL:$PGDATA:/bin/false" > "$NSS_WRAPPER_PASSWD"
- echo "postgres:x:$gid:" > "$NSS_WRAPPER_GROUP"
+ printf 'postgres:x:%s:%s:PostgreSQL:%s:/bin/false\n' "$uid" "$gid" "$PGDATA" > "$NSS_WRAPPER_PASSWD"
+ printf 'postgres:x:%s:\n' "$gid" > "$NSS_WRAPPER_GROUP"
break
fi
done
@@ -88,7 +88,7 @@ docker_init_database_dir() {
set -- --waldir "$POSTGRES_INITDB_WALDIR" "$@"
fi
- eval 'initdb --username="$POSTGRES_USER" --pwfile=<(echo "$POSTGRES_PASSWORD") '"$POSTGRES_INITDB_ARGS"' "$@"'
+ eval 'initdb --username="$POSTGRES_USER" --pwfile=<(printf "%s" "$POSTGRES_PASSWORD") '"$POSTGRES_INITDB_ARGS"' "$@"'
# unset/cleanup "nss_wrapper" bits
if [[ "${LD_PRELOAD:-}" == */libnss_wrapper.so ]]; then
@@ -157,7 +157,7 @@ docker_process_init_files() {
# psql here for backwards compatibility "${psql[@]}"
psql=( docker_process_sql )
- echo
+ printf '\n'
local f
for f; do
case "$f" in
@@ -165,20 +165,20 @@ docker_process_init_files() {
# https://github.com/docker-library/postgres/issues/450#issuecomment-393167936
# https://github.com/docker-library/postgres/pull/452
if [ -x "$f" ]; then
- echo "$0: running $f"
+ printf '%s: running %s\n' "$0" "$f"
"$f"
else
- echo "$0: sourcing $f"
+ printf '%s: sourcing %s\n' "$0" "$f"
. "$f"
fi
;;
- *.sql) echo "$0: running $f"; docker_process_sql -f "$f"; echo ;;
- *.sql.gz) echo "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;;
- *.sql.xz) echo "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;;
- *.sql.zst) echo "$0: running $f"; zstd -dc "$f" | docker_process_sql; echo ;;
- *) echo "$0: ignoring $f" ;;
+ *.sql) printf '%s: running %s\n' "$0" "$f"; docker_process_sql -f "$f"; printf '\n' ;;
+ *.sql.gz) printf '%s: running %s\n' "$0" "$f"; gunzip -c "$f" | docker_process_sql; printf '\n' ;;
+ *.sql.xz) printf '%s: running %s\n' "$0" "$f"; xzcat "$f" | docker_process_sql; printf '\n' ;;
+ *.sql.zst) printf '%s: running %s\n' "$0" "$f"; zstd -dc "$f" | docker_process_sql; printf '\n' ;;
+ *) printf '%s: ignoring %s\n' "$0" "$f" ;;
esac
- echo
+ printf '\n'
done
}
@@ -209,7 +209,7 @@ docker_setup_db() {
POSTGRES_DB= docker_process_sql --dbname postgres --set db="$POSTGRES_DB" <<-'EOSQL'
CREATE DATABASE :"db" ;
EOSQL
- echo
+ printf '\n'
fi
}
@@ -243,12 +243,12 @@ pg_setup_hba_conf() {
auth="$(postgres -C password_encryption "$@")"
: "${POSTGRES_HOST_AUTH_METHOD:=$auth}"
{
- echo
+ printf '\n'
if [ 'trust' = "$POSTGRES_HOST_AUTH_METHOD" ]; then
- echo '# warning trust is enabled for all connections'
- echo '# see https://www.postgresql.org/docs/12/auth-trust.html'
+ printf '# warning trust is enabled for all connections\n'
+ printf '# see https://www.postgresql.org/docs/12/auth-trust.html\n'
fi
- echo "host all all all $POSTGRES_HOST_AUTH_METHOD"
+ printf 'host all all all %s\n' "$POSTGRES_HOST_AUTH_METHOD"
} >> "$PGDATA/pg_hba.conf"
}
@@ -328,13 +328,17 @@ _main() {
docker_temp_server_stop
unset PGPASSWORD
- echo
- echo 'PostgreSQL init process complete; ready for start up.'
- echo
+ cat <<-'EOM'
+
+ PostgreSQL init process complete; ready for start up.
+
+ EOM
else
- echo
- echo 'PostgreSQL Database directory appears to contain a database; Skipping initialization'
- echo
+ cat <<-'EOM'
+
+ PostgreSQL Database directory appears to contain a database; Skipping initialization
+
+ EOM
fi
fi
diff --git a/postgres_13-alpine3.17/docker-entrypoint.sh b/postgres_13-alpine3.17/docker-entrypoint.sh
index 07b0cdc..ce794a2 100755
--- a/postgres_13-alpine3.17/docker-entrypoint.sh
+++ b/postgres_13-alpine3.17/docker-entrypoint.sh
@@ -11,7 +11,7 @@ file_env() {
local fileVar="${var}_FILE"
local def="${2:-}"
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
- echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
+ printf >&2 'error: both %s and %s are set (but are exclusive)\n' "$var" "$fileVar"
exit 1
fi
local val="$def"
@@ -77,8 +77,8 @@ docker_init_database_dir() {
NSS_WRAPPER_GROUP="$(mktemp)"
export LD_PRELOAD="$wrapper" NSS_WRAPPER_PASSWD NSS_WRAPPER_GROUP
local gid; gid="$(id -g)"
- echo "postgres:x:$uid:$gid:PostgreSQL:$PGDATA:/bin/false" > "$NSS_WRAPPER_PASSWD"
- echo "postgres:x:$gid:" > "$NSS_WRAPPER_GROUP"
+ printf 'postgres:x:%s:%s:PostgreSQL:%s:/bin/false\n' "$uid" "$gid" "$PGDATA" > "$NSS_WRAPPER_PASSWD"
+ printf 'postgres:x:%s:\n' "$gid" > "$NSS_WRAPPER_GROUP"
break
fi
done
@@ -88,7 +88,7 @@ docker_init_database_dir() {
set -- --waldir "$POSTGRES_INITDB_WALDIR" "$@"
fi
- eval 'initdb --username="$POSTGRES_USER" --pwfile=<(echo "$POSTGRES_PASSWORD") '"$POSTGRES_INITDB_ARGS"' "$@"'
+ eval 'initdb --username="$POSTGRES_USER" --pwfile=<(printf "%s" "$POSTGRES_PASSWORD") '"$POSTGRES_INITDB_ARGS"' "$@"'
# unset/cleanup "nss_wrapper" bits
if [[ "${LD_PRELOAD:-}" == */libnss_wrapper.so ]]; then
@@ -157,7 +157,7 @@ docker_process_init_files() {
# psql here for backwards compatibility "${psql[@]}"
psql=( docker_process_sql )
- echo
+ printf '\n'
local f
for f; do
case "$f" in
@@ -165,20 +165,20 @@ docker_process_init_files() {
# https://github.com/docker-library/postgres/issues/450#issuecomment-393167936
# https://github.com/docker-library/postgres/pull/452
if [ -x "$f" ]; then
- echo "$0: running $f"
+ printf '%s: running %s\n' "$0" "$f"
"$f"
else
- echo "$0: sourcing $f"
+ printf '%s: sourcing %s\n' "$0" "$f"
. "$f"
fi
;;
- *.sql) echo "$0: running $f"; docker_process_sql -f "$f"; echo ;;
- *.sql.gz) echo "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;;
- *.sql.xz) echo "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;;
- *.sql.zst) echo "$0: running $f"; zstd -dc "$f" | docker_process_sql; echo ;;
- *) echo "$0: ignoring $f" ;;
+ *.sql) printf '%s: running %s\n' "$0" "$f"; docker_process_sql -f "$f"; printf '\n' ;;
+ *.sql.gz) printf '%s: running %s\n' "$0" "$f"; gunzip -c "$f" | docker_process_sql; printf '\n' ;;
+ *.sql.xz) printf '%s: running %s\n' "$0" "$f"; xzcat "$f" | docker_process_sql; printf '\n' ;;
+ *.sql.zst) printf '%s: running %s\n' "$0" "$f"; zstd -dc "$f" | docker_process_sql; printf '\n' ;;
+ *) printf '%s: ignoring %s\n' "$0" "$f" ;;
esac
- echo
+ printf '\n'
done
}
@@ -209,7 +209,7 @@ docker_setup_db() {
POSTGRES_DB= docker_process_sql --dbname postgres --set db="$POSTGRES_DB" <<-'EOSQL'
CREATE DATABASE :"db" ;
EOSQL
- echo
+ printf '\n'
fi
}
@@ -243,12 +243,12 @@ pg_setup_hba_conf() {
auth="$(postgres -C password_encryption "$@")"
: "${POSTGRES_HOST_AUTH_METHOD:=$auth}"
{
- echo
+ printf '\n'
if [ 'trust' = "$POSTGRES_HOST_AUTH_METHOD" ]; then
- echo '# warning trust is enabled for all connections'
- echo '# see https://www.postgresql.org/docs/12/auth-trust.html'
+ printf '# warning trust is enabled for all connections\n'
+ printf '# see https://www.postgresql.org/docs/12/auth-trust.html\n'
fi
- echo "host all all all $POSTGRES_HOST_AUTH_METHOD"
+ printf 'host all all all %s\n' "$POSTGRES_HOST_AUTH_METHOD"
} >> "$PGDATA/pg_hba.conf"
}
@@ -328,13 +328,17 @@ _main() {
docker_temp_server_stop
unset PGPASSWORD
- echo
- echo 'PostgreSQL init process complete; ready for start up.'
- echo
+ cat <<-'EOM'
+
+ PostgreSQL init process complete; ready for start up.
+
+ EOM
else
- echo
- echo 'PostgreSQL Database directory appears to contain a database; Skipping initialization'
- echo
+ cat <<-'EOM'
+
+ PostgreSQL Database directory appears to contain a database; Skipping initialization
+
+ EOM
fi
fi
diff --git a/postgres_13-bullseye/docker-entrypoint.sh b/postgres_13-bullseye/docker-entrypoint.sh
index 1896cd8..7167ae3 100755
--- a/postgres_13-bullseye/docker-entrypoint.sh
+++ b/postgres_13-bullseye/docker-entrypoint.sh
@@ -11,7 +11,7 @@ file_env() {
local fileVar="${var}_FILE"
local def="${2:-}"
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
- echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
+ printf >&2 'error: both %s and %s are set (but are exclusive)\n' "$var" "$fileVar"
exit 1
fi
local val="$def"
@@ -77,8 +77,8 @@ docker_init_database_dir() {
NSS_WRAPPER_GROUP="$(mktemp)"
export LD_PRELOAD="$wrapper" NSS_WRAPPER_PASSWD NSS_WRAPPER_GROUP
local gid; gid="$(id -g)"
- echo "postgres:x:$uid:$gid:PostgreSQL:$PGDATA:/bin/false" > "$NSS_WRAPPER_PASSWD"
- echo "postgres:x:$gid:" > "$NSS_WRAPPER_GROUP"
+ printf 'postgres:x:%s:%s:PostgreSQL:%s:/bin/false\n' "$uid" "$gid" "$PGDATA" > "$NSS_WRAPPER_PASSWD"
+ printf 'postgres:x:%s:\n' "$gid" > "$NSS_WRAPPER_GROUP"
break
fi
done
@@ -88,7 +88,7 @@ docker_init_database_dir() {
set -- --waldir "$POSTGRES_INITDB_WALDIR" "$@"
fi
- eval 'initdb --username="$POSTGRES_USER" --pwfile=<(echo "$POSTGRES_PASSWORD") '"$POSTGRES_INITDB_ARGS"' "$@"'
+ eval 'initdb --username="$POSTGRES_USER" --pwfile=<(printf "%s" "$POSTGRES_PASSWORD") '"$POSTGRES_INITDB_ARGS"' "$@"'
# unset/cleanup "nss_wrapper" bits
if [[ "${LD_PRELOAD:-}" == */libnss_wrapper.so ]]; then
@@ -157,7 +157,7 @@ docker_process_init_files() {
# psql here for backwards compatibility "${psql[@]}"
psql=( docker_process_sql )
- echo
+ printf '\n'
local f
for f; do
case "$f" in
@@ -165,20 +165,20 @@ docker_process_init_files() {
# https://github.com/docker-library/postgres/issues/450#issuecomment-393167936
# https://github.com/docker-library/postgres/pull/452
if [ -x "$f" ]; then
- echo "$0: running $f"
+ printf '%s: running %s\n' "$0" "$f"
"$f"
else
- echo "$0: sourcing $f"
+ printf '%s: sourcing %s\n' "$0" "$f"
. "$f"
fi
;;
- *.sql) echo "$0: running $f"; docker_process_sql -f "$f"; echo ;;
- *.sql.gz) echo "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;;
- *.sql.xz) echo "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;;
- *.sql.zst) echo "$0: running $f"; zstd -dc "$f" | docker_process_sql; echo ;;
- *) echo "$0: ignoring $f" ;;
+ *.sql) printf '%s: running %s\n' "$0" "$f"; docker_process_sql -f "$f"; printf '\n' ;;
+ *.sql.gz) printf '%s: running %s\n' "$0" "$f"; gunzip -c "$f" | docker_process_sql; printf '\n' ;;
+ *.sql.xz) printf '%s: running %s\n' "$0" "$f"; xzcat "$f" | docker_process_sql; printf '\n' ;;
+ *.sql.zst) printf '%s: running %s\n' "$0" "$f"; zstd -dc "$f" | docker_process_sql; printf '\n' ;;
+ *) printf '%s: ignoring %s\n' "$0" "$f" ;;
esac
- echo
+ printf '\n'
done
}
@@ -209,7 +209,7 @@ docker_setup_db() {
POSTGRES_DB= docker_process_sql --dbname postgres --set db="$POSTGRES_DB" <<-'EOSQL'
CREATE DATABASE :"db" ;
EOSQL
- echo
+ printf '\n'
fi
}
@@ -243,12 +243,12 @@ pg_setup_hba_conf() {
auth="$(postgres -C password_encryption "$@")"
: "${POSTGRES_HOST_AUTH_METHOD:=$auth}"
{
- echo
+ printf '\n'
if [ 'trust' = "$POSTGRES_HOST_AUTH_METHOD" ]; then
- echo '# warning trust is enabled for all connections'
- echo '# see https://www.postgresql.org/docs/12/auth-trust.html'
+ printf '# warning trust is enabled for all connections\n'
+ printf '# see https://www.postgresql.org/docs/12/auth-trust.html\n'
fi
- echo "host all all all $POSTGRES_HOST_AUTH_METHOD"
+ printf 'host all all all %s\n' "$POSTGRES_HOST_AUTH_METHOD"
} >> "$PGDATA/pg_hba.conf"
}
@@ -328,13 +328,17 @@ _main() {
docker_temp_server_stop
unset PGPASSWORD
- echo
- echo 'PostgreSQL init process complete; ready for start up.'
- echo
+ cat <<-'EOM'
+
+ PostgreSQL init process complete; ready for start up.
+
+ EOM
else
- echo
- echo 'PostgreSQL Database directory appears to contain a database; Skipping initialization'
- echo
+ cat <<-'EOM'
+
+ PostgreSQL Database directory appears to contain a database; Skipping initialization
+
+ EOM
fi
fi
diff --git a/postgres_14-alpine3.17/docker-entrypoint.sh b/postgres_14-alpine3.17/docker-entrypoint.sh
index 07b0cdc..ce794a2 100755
--- a/postgres_14-alpine3.17/docker-entrypoint.sh
+++ b/postgres_14-alpine3.17/docker-entrypoint.sh
@@ -11,7 +11,7 @@ file_env() {
local fileVar="${var}_FILE"
local def="${2:-}"
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
- echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
+ printf >&2 'error: both %s and %s are set (but are exclusive)\n' "$var" "$fileVar"
exit 1
fi
local val="$def"
@@ -77,8 +77,8 @@ docker_init_database_dir() {
NSS_WRAPPER_GROUP="$(mktemp)"
export LD_PRELOAD="$wrapper" NSS_WRAPPER_PASSWD NSS_WRAPPER_GROUP
local gid; gid="$(id -g)"
- echo "postgres:x:$uid:$gid:PostgreSQL:$PGDATA:/bin/false" > "$NSS_WRAPPER_PASSWD"
- echo "postgres:x:$gid:" > "$NSS_WRAPPER_GROUP"
+ printf 'postgres:x:%s:%s:PostgreSQL:%s:/bin/false\n' "$uid" "$gid" "$PGDATA" > "$NSS_WRAPPER_PASSWD"
+ printf 'postgres:x:%s:\n' "$gid" > "$NSS_WRAPPER_GROUP"
break
fi
done
@@ -88,7 +88,7 @@ docker_init_database_dir() {
set -- --waldir "$POSTGRES_INITDB_WALDIR" "$@"
fi
- eval 'initdb --username="$POSTGRES_USER" --pwfile=<(echo "$POSTGRES_PASSWORD") '"$POSTGRES_INITDB_ARGS"' "$@"'
+ eval 'initdb --username="$POSTGRES_USER" --pwfile=<(printf "%s" "$POSTGRES_PASSWORD") '"$POSTGRES_INITDB_ARGS"' "$@"'
# unset/cleanup "nss_wrapper" bits
if [[ "${LD_PRELOAD:-}" == */libnss_wrapper.so ]]; then
@@ -157,7 +157,7 @@ docker_process_init_files() {
# psql here for backwards compatibility "${psql[@]}"
psql=( docker_process_sql )
- echo
+ printf '\n'
local f
for f; do
case "$f" in
@@ -165,20 +165,20 @@ docker_process_init_files() {
# https://github.com/docker-library/postgres/issues/450#issuecomment-393167936
# https://github.com/docker-library/postgres/pull/452
if [ -x "$f" ]; then
- echo "$0: running $f"
+ printf '%s: running %s\n' "$0" "$f"
"$f"
else
- echo "$0: sourcing $f"
+ printf '%s: sourcing %s\n' "$0" "$f"
. "$f"
fi
;;
- *.sql) echo "$0: running $f"; docker_process_sql -f "$f"; echo ;;
- *.sql.gz) echo "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;;
- *.sql.xz) echo "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;;
- *.sql.zst) echo "$0: running $f"; zstd -dc "$f" | docker_process_sql; echo ;;
- *) echo "$0: ignoring $f" ;;
+ *.sql) printf '%s: running %s\n' "$0" "$f"; docker_process_sql -f "$f"; printf '\n' ;;
+ *.sql.gz) printf '%s: running %s\n' "$0" "$f"; gunzip -c "$f" | docker_process_sql; printf '\n' ;;
+ *.sql.xz) printf '%s: running %s\n' "$0" "$f"; xzcat "$f" | docker_process_sql; printf '\n' ;;
+ *.sql.zst) printf '%s: running %s\n' "$0" "$f"; zstd -dc "$f" | docker_process_sql; printf '\n' ;;
+ *) printf '%s: ignoring %s\n' "$0" "$f" ;;
esac
- echo
+ printf '\n'
done
}
@@ -209,7 +209,7 @@ docker_setup_db() {
POSTGRES_DB= docker_process_sql --dbname postgres --set db="$POSTGRES_DB" <<-'EOSQL'
CREATE DATABASE :"db" ;
EOSQL
- echo
+ printf '\n'
fi
}
@@ -243,12 +243,12 @@ pg_setup_hba_conf() {
auth="$(postgres -C password_encryption "$@")"
: "${POSTGRES_HOST_AUTH_METHOD:=$auth}"
{
- echo
+ printf '\n'
if [ 'trust' = "$POSTGRES_HOST_AUTH_METHOD" ]; then
- echo '# warning trust is enabled for all connections'
- echo '# see https://www.postgresql.org/docs/12/auth-trust.html'
+ printf '# warning trust is enabled for all connections\n'
+ printf '# see https://www.postgresql.org/docs/12/auth-trust.html\n'
fi
- echo "host all all all $POSTGRES_HOST_AUTH_METHOD"
+ printf 'host all all all %s\n' "$POSTGRES_HOST_AUTH_METHOD"
} >> "$PGDATA/pg_hba.conf"
}
@@ -328,13 +328,17 @@ _main() {
docker_temp_server_stop
unset PGPASSWORD
- echo
- echo 'PostgreSQL init process complete; ready for start up.'
- echo
+ cat <<-'EOM'
+
+ PostgreSQL init process complete; ready for start up.
+
+ EOM
else
- echo
- echo 'PostgreSQL Database directory appears to contain a database; Skipping initialization'
- echo
+ cat <<-'EOM'
+
+ PostgreSQL Database directory appears to contain a database; Skipping initialization
+
+ EOM
fi
fi
diff --git a/postgres_14-bullseye/docker-entrypoint.sh b/postgres_14-bullseye/docker-entrypoint.sh
index 1896cd8..7167ae3 100755
--- a/postgres_14-bullseye/docker-entrypoint.sh
+++ b/postgres_14-bullseye/docker-entrypoint.sh
@@ -11,7 +11,7 @@ file_env() {
local fileVar="${var}_FILE"
local def="${2:-}"
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
- echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
+ printf >&2 'error: both %s and %s are set (but are exclusive)\n' "$var" "$fileVar"
exit 1
fi
local val="$def"
@@ -77,8 +77,8 @@ docker_init_database_dir() {
NSS_WRAPPER_GROUP="$(mktemp)"
export LD_PRELOAD="$wrapper" NSS_WRAPPER_PASSWD NSS_WRAPPER_GROUP
local gid; gid="$(id -g)"
- echo "postgres:x:$uid:$gid:PostgreSQL:$PGDATA:/bin/false" > "$NSS_WRAPPER_PASSWD"
- echo "postgres:x:$gid:" > "$NSS_WRAPPER_GROUP"
+ printf 'postgres:x:%s:%s:PostgreSQL:%s:/bin/false\n' "$uid" "$gid" "$PGDATA" > "$NSS_WRAPPER_PASSWD"
+ printf 'postgres:x:%s:\n' "$gid" > "$NSS_WRAPPER_GROUP"
break
fi
done
@@ -88,7 +88,7 @@ docker_init_database_dir() {
set -- --waldir "$POSTGRES_INITDB_WALDIR" "$@"
fi
- eval 'initdb --username="$POSTGRES_USER" --pwfile=<(echo "$POSTGRES_PASSWORD") '"$POSTGRES_INITDB_ARGS"' "$@"'
+ eval 'initdb --username="$POSTGRES_USER" --pwfile=<(printf "%s" "$POSTGRES_PASSWORD") '"$POSTGRES_INITDB_ARGS"' "$@"'
# unset/cleanup "nss_wrapper" bits
if [[ "${LD_PRELOAD:-}" == */libnss_wrapper.so ]]; then
@@ -157,7 +157,7 @@ docker_process_init_files() {
# psql here for backwards compatibility "${psql[@]}"
psql=( docker_process_sql )
- echo
+ printf '\n'
local f
for f; do
case "$f" in
@@ -165,20 +165,20 @@ docker_process_init_files() {
# https://github.com/docker-library/postgres/issues/450#issuecomment-393167936
# https://github.com/docker-library/postgres/pull/452
if [ -x "$f" ]; then
- echo "$0: running $f"
+ printf '%s: running %s\n' "$0" "$f"
"$f"
else
- echo "$0: sourcing $f"
+ printf '%s: sourcing %s\n' "$0" "$f"
. "$f"
fi
;;
- *.sql) echo "$0: running $f"; docker_process_sql -f "$f"; echo ;;
- *.sql.gz) echo "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;;
- *.sql.xz) echo "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;;
- *.sql.zst) echo "$0: running $f"; zstd -dc "$f" | docker_process_sql; echo ;;
- *) echo "$0: ignoring $f" ;;
+ *.sql) printf '%s: running %s\n' "$0" "$f"; docker_process_sql -f "$f"; printf '\n' ;;
+ *.sql.gz) printf '%s: running %s\n' "$0" "$f"; gunzip -c "$f" | docker_process_sql; printf '\n' ;;
+ *.sql.xz) printf '%s: running %s\n' "$0" "$f"; xzcat "$f" | docker_process_sql; printf '\n' ;;
+ *.sql.zst) printf '%s: running %s\n' "$0" "$f"; zstd -dc "$f" | docker_process_sql; printf '\n' ;;
+ *) printf '%s: ignoring %s\n' "$0" "$f" ;;
esac
- echo
+ printf '\n'
done
}
@@ -209,7 +209,7 @@ docker_setup_db() {
POSTGRES_DB= docker_process_sql --dbname postgres --set db="$POSTGRES_DB" <<-'EOSQL'
CREATE DATABASE :"db" ;
EOSQL
- echo
+ printf '\n'
fi
}
@@ -243,12 +243,12 @@ pg_setup_hba_conf() {
auth="$(postgres -C password_encryption "$@")"
: "${POSTGRES_HOST_AUTH_METHOD:=$auth}"
{
- echo
+ printf '\n'
if [ 'trust' = "$POSTGRES_HOST_AUTH_METHOD" ]; then
- echo '# warning trust is enabled for all connections'
- echo '# see https://www.postgresql.org/docs/12/auth-trust.html'
+ printf '# warning trust is enabled for all connections\n'
+ printf '# see https://www.postgresql.org/docs/12/auth-trust.html\n'
fi
- echo "host all all all $POSTGRES_HOST_AUTH_METHOD"
+ printf 'host all all all %s\n' "$POSTGRES_HOST_AUTH_METHOD"
} >> "$PGDATA/pg_hba.conf"
}
@@ -328,13 +328,17 @@ _main() {
docker_temp_server_stop
unset PGPASSWORD
- echo
- echo 'PostgreSQL init process complete; ready for start up.'
- echo
+ cat <<-'EOM'
+
+ PostgreSQL init process complete; ready for start up.
+
+ EOM
else
- echo
- echo 'PostgreSQL Database directory appears to contain a database; Skipping initialization'
- echo
+ cat <<-'EOM'
+
+ PostgreSQL Database directory appears to contain a database; Skipping initialization
+
+ EOM
fi
fi
diff --git a/postgres_alpine3.17/docker-entrypoint.sh b/postgres_alpine3.17/docker-entrypoint.sh
index 07b0cdc..ce794a2 100755
--- a/postgres_alpine3.17/docker-entrypoint.sh
+++ b/postgres_alpine3.17/docker-entrypoint.sh
@@ -11,7 +11,7 @@ file_env() {
local fileVar="${var}_FILE"
local def="${2:-}"
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
- echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
+ printf >&2 'error: both %s and %s are set (but are exclusive)\n' "$var" "$fileVar"
exit 1
fi
local val="$def"
@@ -77,8 +77,8 @@ docker_init_database_dir() {
NSS_WRAPPER_GROUP="$(mktemp)"
export LD_PRELOAD="$wrapper" NSS_WRAPPER_PASSWD NSS_WRAPPER_GROUP
local gid; gid="$(id -g)"
- echo "postgres:x:$uid:$gid:PostgreSQL:$PGDATA:/bin/false" > "$NSS_WRAPPER_PASSWD"
- echo "postgres:x:$gid:" > "$NSS_WRAPPER_GROUP"
+ printf 'postgres:x:%s:%s:PostgreSQL:%s:/bin/false\n' "$uid" "$gid" "$PGDATA" > "$NSS_WRAPPER_PASSWD"
+ printf 'postgres:x:%s:\n' "$gid" > "$NSS_WRAPPER_GROUP"
break
fi
done
@@ -88,7 +88,7 @@ docker_init_database_dir() {
set -- --waldir "$POSTGRES_INITDB_WALDIR" "$@"
fi
- eval 'initdb --username="$POSTGRES_USER" --pwfile=<(echo "$POSTGRES_PASSWORD") '"$POSTGRES_INITDB_ARGS"' "$@"'
+ eval 'initdb --username="$POSTGRES_USER" --pwfile=<(printf "%s" "$POSTGRES_PASSWORD") '"$POSTGRES_INITDB_ARGS"' "$@"'
# unset/cleanup "nss_wrapper" bits
if [[ "${LD_PRELOAD:-}" == */libnss_wrapper.so ]]; then
@@ -157,7 +157,7 @@ docker_process_init_files() {
# psql here for backwards compatibility "${psql[@]}"
psql=( docker_process_sql )
- echo
+ printf '\n'
local f
for f; do
case "$f" in
@@ -165,20 +165,20 @@ docker_process_init_files() {
# https://github.com/docker-library/postgres/issues/450#issuecomment-393167936
# https://github.com/docker-library/postgres/pull/452
if [ -x "$f" ]; then
- echo "$0: running $f"
+ printf '%s: running %s\n' "$0" "$f"
"$f"
else
-
B5CD
echo "$0: sourcing $f"
+ printf '%s: sourcing %s\n' "$0" "$f"
. "$f"
fi
;;
- *.sql) echo "$0: running $f"; docker_process_sql -f "$f"; echo ;;
- *.sql.gz) echo "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;;
- *.sql.xz) echo "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;;
- *.sql.zst) echo "$0: running $f"; zstd -dc "$f" | docker_process_sql; echo ;;
- *) echo "$0: ignoring $f" ;;
+ *.sql) printf '%s: running %s\n' "$0" "$f"; docker_process_sql -f "$f"; printf '\n' ;;
+ *.sql.gz) printf '%s: running %s\n' "$0" "$f"; gunzip -c "$f" | docker_process_sql; printf '\n' ;;
+ *.sql.xz) printf '%s: running %s\n' "$0" "$f"; xzcat "$f" | docker_process_sql; printf '\n' ;;
+ *.sql.zst) printf '%s: running %s\n' "$0" "$f"; zstd -dc "$f" | docker_process_sql; printf '\n' ;;
+ *) printf '%s: ignoring %s\n' "$0" "$f" ;;
esac
- echo
+ printf '\n'
done
}
@@ -209,7 +209,7 @@ docker_setup_db() {
POSTGRES_DB= docker_process_sql --dbname postgres --set db="$POSTGRES_DB" <<-'EOSQL'
CREATE DATABASE :"db" ;
EOSQL
- echo
+ printf '\n'
fi
}
@@ -243,12 +243,12 @@ pg_setup_hba_conf() {
auth="$(postgres -C password_encryption "$@")"
: "${POSTGRES_HOST_AUTH_METHOD:=$auth}"
{
- echo
+ printf '\n'
if [ 'trust' = "$POSTGRES_HOST_AUTH_METHOD" ]; then
- echo '# warning trust is enabled for all connections'
- echo '# see https://www.postgresql.org/docs/12/auth-trust.html'
+ printf '# warning trust is enabled for all connections\n'
+ printf '# see https://www.postgresql.org/docs/12/auth-trust.html\n'
fi
- echo "host all all all $POSTGRES_HOST_AUTH_METHOD"
+ printf 'host all all all %s\n' "$POSTGRES_HOST_AUTH_METHOD"
} >> "$PGDATA/pg_hba.conf"
}
@@ -328,13 +328,17 @@ _main() {
docker_temp_server_stop
unset PGPASSWORD
- echo
- echo 'PostgreSQL init process complete; ready for start up.'
- echo
+ cat <<-'EOM'
+
+ PostgreSQL init process complete; ready for start up.
+
+ EOM
else
- echo
- echo 'PostgreSQL Database directory appears to contain a database; Skipping initialization'
- echo
+ cat <<-'EOM'
+
+ PostgreSQL Database directory appears to contain a database; Skipping initialization
+
+ EOM
fi
fi
diff --git a/postgres_bullseye/docker-entrypoint.sh b/postgres_bullseye/docker-entrypoint.sh
index 1896cd8..7167ae3 100755
--- a/postgres_bullseye/docker-entrypoint.sh
+++ b/postgres_bullseye/docker-entrypoint.sh
@@ -11,7 +11,7 @@ file_env() {
local fileVar="${var}_FILE"
local def="${2:-}"
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
- echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
+ printf >&2 'error: both %s and %s are set (but are exclusive)\n' "$var" "$fileVar"
exit 1
fi
local val="$def"
@@ -77,8 +77,8 @@ docker_init_database_dir() {
NSS_WRAPPER_GROUP="$(mktemp)"
export LD_PRELOAD="$wrapper" NSS_WRAPPER_PASSWD NSS_WRAPPER_GROUP
local gid; gid="$(id -g)"
- echo "postgres:x:$uid:$gid:PostgreSQL:$PGDATA:/bin/false" > "$NSS_WRAPPER_PASSWD"
- echo "postgres:x:$gid:" > "$NSS_WRAPPER_GROUP"
+ printf 'postgres:x:%s:%s:PostgreSQL:%s:/bin/false\n' "$uid" "$gid" "$PGDATA" > "$NSS_WRAPPER_PASSWD"
+ printf 'postgres:x:%s:\n' "$gid" > "$NSS_WRAPPER_GROUP"
break
fi
done
@@ -88,7 +88,7 @@ docker_init_database_dir() {
set -- --waldir "$POSTGRES_INITDB_WALDIR" "$@"
fi
- eval 'initdb --username="$POSTGRES_USER" --pwfile=<(echo "$POSTGRES_PASSWORD") '"$POSTGRES_INITDB_ARGS"' "$@"'
+ eval 'initdb --username="$POSTGRES_USER" --pwfile=<(printf "%s" "$POSTGRES_PASSWORD") '"$POSTGRES_INITDB_ARGS"' "$@"'
# unset/cleanup "nss_wrapper" bits
if [[ "${LD_PRELOAD:-}" == */libnss_wrapper.so ]]; then
@@ -157,7 +157,7 @@ docker_process_init_files() {
# psql here for backwards compatibility "${psql[@]}"
psql=( docker_process_sql )
- echo
+ printf '\n'
local f
for f; do
case "$f" in
@@ -165,20 +165,20 @@ docker_process_init_files() {
# https://github.com/docker-library/postgres/issues/450#issuecomment-393167936
# https://github.com/docker-library/postgres/pull/452
if [ -x "$f" ]; then
- echo "$0: running $f"
+ printf '%s: running %s\n' "$0" "$f"
"$f"
else
- echo "$0: sourcing $f"
+ printf '%s: sourcing %s\n' "$0" "$f"
. "$f"
fi
;;
- *.sql) echo "$0: running $f"; docker_process_sql -f "$f"; echo ;;
- *.sql.gz) echo "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;;
- *.sql.xz) echo "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;;
- *.sql.zst) echo "$0: running $f"; zstd -dc "$f" | docker_process_sql; echo ;;
- *) echo "$0: ignoring $f" ;;
+ *.sql) printf '%s: running %s\n' "$0" "$f"; docker_process_sql -f "$f"; printf '\n' ;;
+ *.sql.gz) printf '%s: running %s\n' "$0" "$f"; gunzip -c "$f" | docker_process_sql; printf '\n' ;;
+ *.sql.xz) printf '%s: running %s\n' "$0" "$f"; xzcat "$f" | docker_process_sql; printf '\n' ;;
+ *.sql.zst) printf '%s: running %s\n' "$0" "$f"; zstd -dc "$f" | docker_process_sql; printf '\n' ;;
+ *) printf '%s: ignoring %s\n' "$0" "$f" ;;
esac
- echo
+ printf '\n'
done
}
@@ -209,7 +209,7 @@ docker_setup_db() {
POSTGRES_DB= docker_process_sql --dbname postgres --set db="$POSTGRES_DB" <<-'EOSQL'
CREATE DATABASE :"db" ;
EOSQL
- echo
+ printf '\n'
fi
}
@@ -243,12 +243,12 @@ pg_setup_hba_conf() {
auth="$(postgres -C password_encryption "$@")"
: "${POSTGRES_HOST_AUTH_METHOD:=$auth}"
{
- echo
+ printf '\n'
if [ 'trust' = "$POSTGRES_HOST_AUTH_METHOD" ]; then
- echo '# warning trust is enabled for all connections'
- echo '# see https://www.postgresql.org/docs/12/auth-trust.html'
+ printf '# warning trust is enabled for all connections\n'
+ printf '# see https://www.postgresql.org/docs/12/auth-trust.html\n'
fi
- echo "host all all all $POSTGRES_HOST_AUTH_METHOD"
+ printf 'host all all all %s\n' "$POSTGRES_HOST_AUTH_METHOD"
} >> "$PGDATA/pg_hba.conf"
}
@@ -328,13 +328,17 @@ _main() {
docker_temp_server_stop
unset PGPASSWORD
- echo
- echo 'PostgreSQL init process complete; ready for start up.'
- echo
+ cat <<-'EOM'
+
+ PostgreSQL init process complete; ready for start up.
+
+ EOM
else
- echo
- echo 'PostgreSQL Database directory appears to contain a database; Skipping initialization'
- echo
+ cat <<-'EOM'
+
+ PostgreSQL Database directory appears to contain a database; Skipping initialization
+
+ EOM
fi
fi Relevant Maintainers: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes: