Hello community, here is the log from the commit of package opensuse-mariadb-image for openSUSE:Factory checked in at 2019-10-31 22:17:53 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/opensuse-mariadb-image (Old) and /work/SRC/openSUSE:Factory/.opensuse-mariadb-image.new.2990 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "opensuse-mariadb-image" Thu Oct 31 22:17:53 2019 rev:4 rq:744258 version:1.0.0 Changes: -------- --- /work/SRC/openSUSE:Factory/opensuse-mariadb-image/opensuse-mariadb-image.changes 2019-10-22 15:46:51.749817273 +0200 +++ /work/SRC/openSUSE:Factory/.opensuse-mariadb-image.new.2990/opensuse-mariadb-image.changes 2019-10-31 22:17:54.611722974 +0100 @@ -1,0 +2,5 @@ +Wed Oct 30 15:01:07 CET 2019 - ku...@suse.de + +- Read environmenn files before switching to mariadb user + +------------------------------------------------------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ entrypoint.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usr/local/bin/entrypoint.sh new/usr/local/bin/entrypoint.sh --- old/usr/local/bin/entrypoint.sh 2019-10-10 18:49:44.791769360 +0200 +++ new/usr/local/bin/entrypoint.sh 2019-10-30 14:37:04.959985381 +0100 @@ -68,6 +68,23 @@ "$@" --verbose --help --log-bin-index="$(mktemp -u)" 2>/dev/null | awk '$1 == "'"$conf"'" { print $2; exit }' } +# Read environment files, we may not be allowed to do that after +# switching the user anymore +if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then + # still need to check config, container may have started with --user + _check_config "$@" + # Get config + DATADIR="$(_get_config 'datadir' "$@")" + + if [ ! -d "$DATADIR/mysql" ]; then + file_env 'MYSQL_ROOT_PASSWORD' + file_env 'MYSQL_ROOT_HOST' '%' + file_env 'MYSQL_DATABASE' + file_env 'MYSQL_USER' + file_env 'MYSQL_PASSWORD' + fi +fi + # allow the container to be started with `--user` if [ "$1" = 'mysqld' -a -z "$wantHelp" -a "$(id -u)" = '0' ]; then _check_config "$@" @@ -86,7 +103,6 @@ DATADIR="$(_get_config 'datadir' "$@")" if [ ! -d "$DATADIR/mysql" ]; then - file_env 'MYSQL_ROOT_PASSWORD' if [ -z "$MYSQL_ROOT_PASSWORD" -a -z "$MYSQL_ALLOW_EMPTY_PASSWORD" -a -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then echo >&2 'error: database is uninitialized and password option is not specified ' echo >&2 ' You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD' @@ -130,7 +146,6 @@ rootCreate= # default root to listen for connections from anywhere - file_env 'MYSQL_ROOT_HOST' '%' if [ ! -z "$MYSQL_ROOT_HOST" -a "$MYSQL_ROOT_HOST" != 'localhost' ]; then # no, we don't care if read finds a terminating character in this heredoc # https://unix.stackexchange.com/questions/265149/why-is-set-o-errexit-breaking-this-read-heredoc-expression/265151#265151 @@ -157,14 +172,11 @@ mysql+=( -p"${MYSQL_ROOT_PASSWORD}" ) fi - file_env 'MYSQL_DATABASE' if [ "$MYSQL_DATABASE" ]; then echo "CREATE DATABASE IF NOT EXISTS \`$MYSQL_DATABASE\` ;" | "${mysql[@]}" mysql+=( "$MYSQL_DATABASE" ) fi - file_env 'MYSQL_USER' - file_env 'MYSQL_PASSWORD' if [ "$MYSQL_USER" -a "$MYSQL_PASSWORD" ]; then echo "CREATE USER '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_PASSWORD' ;" | "${mysql[@]}"