Skip to content

Commit

Permalink
Regenerate scripts/doc
Browse files Browse the repository at this point in the history
  • Loading branch information
mscherer committed Mar 15, 2023
1 parent b8af762 commit 92b08cb
Show file tree
Hide file tree
Showing 11 changed files with 107 additions and 12 deletions.
7 changes: 7 additions & 0 deletions 10/root/usr/share/container-scripts/postgresql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ initialization by passing `-e VAR=VALUE` to the Docker run command.
**`POSTGRESQL_ADMIN_PASSWORD`**
Password for the `postgres` admin account (optional)

The following environment variables are optional, and only used when the database is initialzed

**`POSTGRESQL_ENCODING`**
Database encoding. Default to UTF8

**`POSTGRESQL_LOCALE`**
Database locale. Default to en_US

Alternatively, the following options are related to migration scenario:

Expand Down
16 changes: 14 additions & 2 deletions 10/root/usr/share/container-scripts/postgresql/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,10 @@ initdb_wrapper ()
# Initialize the database cluster with utf8 support enabled by default.
# This might affect performance, see:
# http://www.postgresql.org/docs/10/static/locale.html
LANG=${LANG:-en_US.utf8} "$@"
ENCODING=${POSTGRESQL_ENCODING:-UTF8}
LOCALE=${POSTGRESQL_LOCALE:-en_US}
if [ ${LOCALE} == "C" ] ; then LANG=C; fi
LANG=${LANG:-$LOCALE.$ENCODING} "$@" -E $ENCODING
}

function initialize_database() {
Expand Down Expand Up @@ -222,7 +225,16 @@ EOF
function create_users() {
if [[ ",$postinitdb_actions," = *,simple_db,* ]]; then
createuser "$POSTGRESQL_USER"
createdb --owner="$POSTGRESQL_USER" "$POSTGRESQL_DATABASE"

EXTRA_ARGS=""
if [ -v POSTGRESQL_ENCODING ]; then
EXTRA_ARGS="$EXTRA_ARGS -E $POSTGRESQL_ENCODING"
fi
if [ -v POSTGRESQL_LOCALE ]; then
EXTRA_ARGS="$EXTRA_ARGS -l $POSTGRESQL_LOCALE"
fi

createdb $EXTRA_ARGS --owner="$POSTGRESQL_USER" "$POSTGRESQL_DATABASE"
fi

if [ -v POSTGRESQL_MASTER_USER ]; then
Expand Down
7 changes: 7 additions & 0 deletions 12/root/usr/share/container-scripts/postgresql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ initialization by passing `-e VAR=VALUE` to the Docker run command.
**`POSTGRESQL_ADMIN_PASSWORD`**
Password for the `postgres` admin account (optional)

The following environment variables are optional, and only used when the database is initialzed

**`POSTGRESQL_ENCODING`**
Database encoding. Default to UTF8

**`POSTGRESQL_LOCALE`**
Database locale. Default to en_US

Alternatively, the following options are related to migration scenario:

Expand Down
16 changes: 14 additions & 2 deletions 12/root/usr/share/container-scripts/postgresql/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,10 @@ initdb_wrapper ()
# Initialize the database cluster with utf8 support enabled by default.
# This might affect performance, see:
# http://www.postgresql.org/docs/12/static/locale.html
LANG=${LANG:-en_US.utf8} "$@"
ENCODING=${POSTGRESQL_ENCODING:-UTF8}
LOCALE=${POSTGRESQL_LOCALE:-en_US}
if [ ${LOCALE} == "C" ] ; then LANG=C; fi
LANG=${LANG:-$LOCALE.$ENCODING} "$@" -E $ENCODING
}

function initialize_database() {
Expand Down Expand Up @@ -222,7 +225,16 @@ EOF
function create_users() {
if [[ ",$postinitdb_actions," = *,simple_db,* ]]; then
createuser "$POSTGRESQL_USER"
createdb --owner="$POSTGRESQL_USER" "$POSTGRESQL_DATABASE"

EXTRA_ARGS=""
if [ -v POSTGRESQL_ENCODING ]; then
EXTRA_ARGS="$EXTRA_ARGS -E $POSTGRESQL_ENCODING"
fi
if [ -v POSTGRESQL_LOCALE ]; then
EXTRA_ARGS="$EXTRA_ARGS -l $POSTGRESQL_LOCALE"
fi

createdb $EXTRA_ARGS --owner="$POSTGRESQL_USER" "$POSTGRESQL_DATABASE"
fi

if [ -v POSTGRESQL_MASTER_USER ]; then
Expand Down
7 changes: 7 additions & 0 deletions 13/root/usr/share/container-scripts/postgresql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ initialization by passing `-e VAR=VALUE` to the Docker run command.
**`POSTGRESQL_ADMIN_PASSWORD`**
Password for the `postgres` admin account (optional)

The following environment variables are optional, and only used when the database is initialzed

**`POSTGRESQL_ENCODING`**
Database encoding. Default to UTF8

**`POSTGRESQL_LOCALE`**
Database locale. Default to en_US

Alternatively, the following options are related to migration scenario:

Expand Down
16 changes: 14 additions & 2 deletions 13/root/usr/share/container-scripts/postgresql/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,10 @@ initdb_wrapper ()
# Initialize the database cluster with utf8 support enabled by default.
# This might affect performance, see:
# http://www.postgresql.org/docs/13/static/locale.html
LANG=${LANG:-en_US.utf8} "$@"
ENCODING=${POSTGRESQL_ENCODING:-UTF8}
LOCALE=${POSTGRESQL_LOCALE:-en_US}
if [ ${LOCALE} == "C" ] ; then LANG=C; fi
LANG=${LANG:-$LOCALE.$ENCODING} "$@" -E $ENCODING
}

function initialize_database() {
Expand Down Expand Up @@ -222,7 +225,16 @@ EOF
function create_users() {
if [[ ",$postinitdb_actions," = *,simple_db,* ]]; then
createuser "$POSTGRESQL_USER"
createdb --owner="$POSTGRESQL_USER" "$POSTGRESQL_DATABASE"

EXTRA_ARGS=""
if [ -v POSTGRESQL_ENCODING ]; then
EXTRA_ARGS="$EXTRA_ARGS -E $POSTGRESQL_ENCODING"
fi
if [ -v POSTGRESQL_LOCALE ]; then
EXTRA_ARGS="$EXTRA_ARGS -l $POSTGRESQL_LOCALE"
fi

createdb $EXTRA_ARGS --owner="$POSTGRESQL_USER" "$POSTGRESQL_DATABASE"
fi

if [ -v POSTGRESQL_MASTER_USER ]; then
Expand Down
7 changes: 7 additions & 0 deletions 14/root/usr/share/container-scripts/postgresql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ initialization by passing `-e VAR=VALUE` to the Docker run command.
**`POSTGRESQL_ADMIN_PASSWORD`**
Password for the `postgres` admin account (optional)

The following environment variables are optional, and only used when the database is initialzed

**`POSTGRESQL_ENCODING`**
Database encoding. Default to UTF8

**`POSTGRESQL_LOCALE`**
Database locale. Default to en_US

Alternatively, the following options are related to migration scenario:

Expand Down
18 changes: 15 additions & 3 deletions 14/root/usr/share/container-scripts/postgresql/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ function generate_postgresql_recovery_config() {
function generate_passwd_file() {
export USER_ID=$(id -u)
export GROUP_ID=$(id -g)
grep -v -e ^postgres -e ^$USER_ID /etc/passwd > "$HOME/passwd"
grep -v -e ^postgres -e ^$USER_ID -e ^$(id -un) /etc/passwd > "$HOME/passwd"
echo "postgres:x:${USER_ID}:${GROUP_ID}:PostgreSQL Server:${HOME}:/bin/bash" >> "$HOME/passwd"
export LD_PRELOAD=libnss_wrapper.so
export NSS_WRAPPER_PASSWD=${HOME}/passwd
Expand All @@ -189,7 +189,10 @@ initdb_wrapper ()
# Initialize the database cluster with utf8 support enabled by default.
# This might affect performance, see:
# http://www.postgresql.org/docs/14/static/locale.html
LANG=${LANG:-en_US.utf8} "$@"
ENCODING=${POSTGRESQL_ENCODING:-UTF8}
LOCALE=${POSTGRESQL_LOCALE:-en_US}
if [ ${LOCALE} == "C" ] ; then LANG=C; fi
LANG=${LANG:-$LOCALE.$ENCODING} "$@" -E $ENCODING
}

function initialize_database() {
Expand Down Expand Up @@ -222,7 +225,16 @@ EOF
function create_users() {
if [[ ",$postinitdb_actions," = *,simple_db,* ]]; then
createuser "$POSTGRESQL_USER"
createdb --owner="$POSTGRESQL_USER" "$POSTGRESQL_DATABASE"

EXTRA_ARGS=""
if [ -v POSTGRESQL_ENCODING ]; then
EXTRA_ARGS="$EXTRA_ARGS -E $POSTGRESQL_ENCODING"
fi
if [ -v POSTGRESQL_LOCALE ]; then
EXTRA_ARGS="$EXTRA_ARGS -l $POSTGRESQL_LOCALE"
fi

createdb $EXTRA_ARGS --owner="$POSTGRESQL_USER" "$POSTGRESQL_DATABASE"
fi

if [ -v POSTGRESQL_MASTER_USER ]; then
Expand Down
7 changes: 7 additions & 0 deletions 15/root/usr/share/container-scripts/postgresql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ initialization by passing `-e VAR=VALUE` to the Docker run command.
**`POSTGRESQL_ADMIN_PASSWORD`**
Password for the `postgres` admin account (optional)

The following environment variables are optional, and only used when the database is initialzed

**`POSTGRESQL_ENCODING`**
Database encoding. Default to UTF8

**`POSTGRESQL_LOCALE`**
Database locale. Default to en_US

Alternatively, the following options are related to migration scenario:

Expand Down
16 changes: 14 additions & 2 deletions 15/root/usr/share/container-scripts/postgresql/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,10 @@ initdb_wrapper ()
# Initialize the database cluster with utf8 support enabled by default.
# This might affect performance, see:
# http://www.postgresql.org/docs/15/static/locale.html
LANG=${LANG:-en_US.utf8} "$@"
ENCODING=${POSTGRESQL_ENCODING:-UTF8}
LOCALE=${POSTGRESQL_LOCALE:-en_US}
if [ ${LOCALE} == "C" ] ; then LANG=C; fi
LANG=${LANG:-$LOCALE.$ENCODING} "$@" -E $ENCODING
}

function initialize_database() {
Expand Down Expand Up @@ -222,7 +225,16 @@ EOF
function create_users() {
if [[ ",$postinitdb_actions," = *,simple_db,* ]]; then
createuser "$POSTGRESQL_USER"
createdb --owner="$POSTGRESQL_USER" "$POSTGRESQL_DATABASE"

EXTRA_ARGS=""
if [ -v POSTGRESQL_ENCODING ]; then
EXTRA_ARGS="$EXTRA_ARGS -E $POSTGRESQL_ENCODING"
fi
if [ -v POSTGRESQL_LOCALE ]; then
EXTRA_ARGS="$EXTRA_ARGS -l $POSTGRESQL_LOCALE"
fi

createdb $EXTRA_ARGS --owner="$POSTGRESQL_USER" "$POSTGRESQL_DATABASE"
fi

if [ -v POSTGRESQL_MASTER_USER ]; then
Expand Down
2 changes: 1 addition & 1 deletion common
Submodule common updated 3 files
+2 −5 build.sh
+2 −7 tag.sh
+1 −1 test-lib.sh

0 comments on commit 92b08cb

Please sign in to comment.