Rebase templates on the latest version rather than earliest

Correct healthcheck.sh comments.

Few minor errors in later versions corrected.

11.6 upgrade file corrected.

More resiliant to version changes.

Remove mysql/mariadb safe.cnf file that isn't distributed
from Dockerfile.
This commit is contained in:
Daniel Black 2024-06-20 18:00:53 +10:00
parent 6d6407c8d9
commit aecdf2e613
24 changed files with 114 additions and 109 deletions

View File

@ -10,8 +10,8 @@
# the --replication option. This allows a different set of replication checks
# on different connections.
#
# --su{=|-mariadb} is option to run the healthcheck as a different unix user.
# Useful if mariadb@localhost user exists with unix socket authentication
# --su{=|-mysql} is option to run the healthcheck as a different unix user.
# Useful if mysql@localhost user exists with unix socket authentication
# Using this option disregards previous options set, so should usually be the
# first option.
#

View File

@ -10,8 +10,8 @@
# the --replication option. This allows a different set of replication checks
# on different connections.
#
# --su{=|-mariadb} is option to run the healthcheck as a different unix user.
# Useful if mariadb@localhost user exists with unix socket authentication
# --su{=|-mysql} is option to run the healthcheck as a different unix user.
# Useful if mysql@localhost user exists with unix socket authentication
# Using this option disregards previous options set, so should usually be the
# first option.
#

View File

@ -221,16 +221,16 @@ docker_init_database_dir() {
installArgs=( --datadir="$DATADIR" --rpm --auth-root-authentication-method=normal )
# "Other options are passed to mysqld." (so we pass all "mysqld" arguments directly here)
local mariadbdArgs=()
local mysqldArgs=()
for arg in "${@:2}"; do
# Check if the argument contains whitespace
if [[ "$arg" =~ [[:space:]] ]]; then
mysql_warn "Not passing argument \'$arg\' to mariadb-install-db because mariadb-install-db does not support arguments with whitespace."
mysql_warn "Not passing argument \'$arg\' to mysql_install_db because mysql_install_db does not support arguments with whitespace."
else
mariadbdArgs+=("$arg")
mysqldArgs+=("$arg")
fi
done
mysql_install_db "${installArgs[@]}" "${mariadbdArgs[@]}" \
mysql_install_db "${installArgs[@]}" "${mysqldArgs[@]}" \
--skip-test-db \
--default-time-zone=SYSTEM --enforce-storage-engine= \
--skip-log-bin \

View File

@ -26,7 +26,7 @@
# replication REPLICATION_CLIENT (<10.5)or REPLICA MONITOR (10.5+)
# mariadbupgrade none, however unix user permissions on datadir
#
# The SQL user used is the default for the mysql client. This can be the unix user
# The SQL user used is the default for the mariadb client. This can be the unix user
# if no user(or password) is set in the [mariadb-client] section of a configuration
# file. --defaults-{file,extra-file,group-suffix} can specify a file/configuration
# different from elsewhere.

View File

@ -10,8 +10,8 @@
# the --replication option. This allows a different set of replication checks
# on different connections.
#
# --su{=|-mariadb} is option to run the healthcheck as a different unix user.
# Useful if mariadb@localhost user exists with unix socket authentication
# --su{=|-mysql} is option to run the healthcheck as a different unix user.
# Useful if mysql@localhost user exists with unix socket authentication
# Using this option disregards previous options set, so should usually be the
# first option.
#

View File

@ -10,8 +10,8 @@
# the --replication option. This allows a different set of replication checks
# on different connections.
#
# --su{=|-mariadb} is option to run the healthcheck as a different unix user.
# Useful if mariadb@localhost user exists with unix socket authentication
# --su{=|-mysql} is option to run the healthcheck as a different unix user.
# Useful if mysql@localhost user exists with unix socket authentication
# Using this option disregards previous options set, so should usually be the
# first option.
#

View File

@ -10,8 +10,8 @@
# the --replication option. This allows a different set of replication checks
# on different connections.
#
# --su{=|-mariadb} is option to run the healthcheck as a different unix user.
# Useful if mariadb@localhost user exists with unix socket authentication
# --su{=|-mysql} is option to run the healthcheck as a different unix user.
# Useful if mysql@localhost user exists with unix socket authentication
# Using this option disregards previous options set, so should usually be the
# first option.
#

View File

@ -114,7 +114,7 @@ RUN set -ex; \
; \
rm -rf /var/lib/apt/lists/*; \
# purge and re-create /var/lib/mysql with appropriate ownership
rm -rf /var/lib/mysql /etc/mysql/mariadb.conf.d/50-mysqld_safe.cnf; \
rm -rf /var/lib/mysql; \
mkdir -p /var/lib/mysql /run/mysqld; \
chown -R mysql:mysql /var/lib/mysql /run/mysqld; \
# ensure that /run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime

View File

@ -10,8 +10,8 @@
# the --replication option. This allows a different set of replication checks
# on different connections.
#
# --su{=|-mariadb} is option to run the healthcheck as a different unix user.
# Useful if mariadb@localhost user exists with unix socket authentication
# --su{=|-mysql} is option to run the healthcheck as a different unix user.
# Useful if mysql@localhost user exists with unix socket authentication
# Using this option disregards previous options set, so should usually be the
# first option.
#

View File

@ -10,8 +10,8 @@
# the --replication option. This allows a different set of replication checks
# on different connections.
#
# --su{=|-mariadb} is option to run the healthcheck as a different unix user.
# Useful if mariadb@localhost user exists with unix socket authentication
# --su{=|-mysql} is option to run the healthcheck as a different unix user.
# Useful if mysql@localhost user exists with unix socket authentication
# Using this option disregards previous options set, so should usually be the
# first option.
#

View File

@ -114,7 +114,7 @@ RUN set -ex; \
; \
rm -rf /var/lib/apt/lists/*; \
# purge and re-create /var/lib/mysql with appropriate ownership
rm -rf /var/lib/mysql /etc/mysql/mariadb.conf.d/50-mysqld_safe.cnf; \
rm -rf /var/lib/mysql; \
mkdir -p /var/lib/mysql /run/mysqld; \
chown -R mysql:mysql /var/lib/mysql /run/mysqld; \
# ensure that /run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime

View File

@ -10,8 +10,8 @@
# the --replication option. This allows a different set of replication checks
# on different connections.
#
# --su{=|-mariadb} is option to run the healthcheck as a different unix user.
# Useful if mariadb@localhost user exists with unix socket authentication
# --su{=|-mysql} is option to run the healthcheck as a different unix user.
# Useful if mysql@localhost user exists with unix socket authentication
# Using this option disregards previous options set, so should usually be the
# first option.
#

View File

@ -10,8 +10,8 @@
# the --replication option. This allows a different set of replication checks
# on different connections.
#
# --su{=|-mariadb} is option to run the healthcheck as a different unix user.
# Useful if mariadb@localhost user exists with unix socket authentication
# --su{=|-mysql} is option to run the healthcheck as a different unix user.
# Useful if mysql@localhost user exists with unix socket authentication
# Using this option disregards previous options set, so should usually be the
# first option.
#

View File

@ -114,7 +114,7 @@ RUN set -ex; \
; \
rm -rf /var/lib/apt/lists/*; \
# purge and re-create /var/lib/mysql with appropriate ownership
rm -rf /var/lib/mysql /etc/mysql/mariadb.conf.d/50-mysqld_safe.cnf; \
rm -rf /var/lib/mysql; \
mkdir -p /var/lib/mysql /run/mysqld; \
chown -R mysql:mysql /var/lib/mysql /run/mysqld; \
# ensure that /run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime

View File

@ -10,8 +10,8 @@
# the --replication option. This allows a different set of replication checks
# on different connections.
#
# --su{=|-mariadb} is option to run the healthcheck as a different unix user.
# Useful if mariadb@localhost user exists with unix socket authentication
# --su{=|-mysql} is option to run the healthcheck as a different unix user.
# Useful if mysql@localhost user exists with unix socket authentication
# Using this option disregards previous options set, so should usually be the
# first option.
#

View File

@ -573,8 +573,8 @@ docker_mariadb_backup_system()
fi
local backup_db="system_mysql_backup_unknown_version.sql.zst"
local oldfullversion="unknown_version"
if [ -r "$DATADIR"/mysql_upgrade_info ]; then
read -r -d '' oldfullversion < "$DATADIR"/mysql_upgrade_info || true
if [ -r "$DATADIR"/mariadb_upgrade_info ]; then
read -r -d '' oldfullversion < "$DATADIR"/mariadb_upgrade_info || true
if [ -n "$oldfullversion" ]; then
backup_db="system_mysql_backup_${oldfullversion}.sql.zst"
fi
@ -641,14 +641,14 @@ EOSQL
_check_if_upgrade_is_needed() {
if [ ! -f "$DATADIR"/mysql_upgrade_info ]; then
if [ ! -f "$DATADIR"/mariadb_upgrade_info ]; then
mysql_note "MariaDB upgrade information missing, assuming required"
return 0
fi
local mariadbVersion
mariadbVersion="$(_mariadb_version)"
IFS='.-' read -ra newversion <<<"$mariadbVersion"
IFS='.-' read -ra oldversion < "$DATADIR"/mysql_upgrade_info || true
IFS='.-' read -ra oldversion < "$DATADIR"/mariadb_upgrade_info || true
if [[ ${#newversion[@]} -lt 2 ]] || [[ ${#oldversion[@]} -lt 2 ]] \
|| [[ ${oldversion[0]} -lt ${newversion[0]} ]] \

View File

@ -10,8 +10,8 @@
# the --replication option. This allows a different set of replication checks
# on different connections.
#
# --su{=|-mariadb} is option to run the healthcheck as a different unix user.
# Useful if mariadb@localhost user exists with unix socket authentication
# --su{=|-mysql} is option to run the healthcheck as a different unix user.
# Useful if mysql@localhost user exists with unix socket authentication
# Using this option disregards previous options set, so should usually be the
# first option.
#
@ -201,11 +201,11 @@ replication()
# mariadbupgrade
#
# Test the lock on the file $datadir/mysql_upgrade_info
# Test the lock on the file $datadir/mariadb_upgrade_info
# https://jira.mariadb.org/browse/MDEV-27068
mariadbupgrade()
{
local f="$datadir/mysql_upgrade_info"
local f="$datadir/mariadb_upgrade_info"
if [ -r "$f" ]; then
flock --exclusive --nonblock -n 9 9<"$f"
return $?

View File

@ -114,7 +114,7 @@ RUN set -ex; \
; \
rm -rf /var/lib/apt/lists/*; \
# purge and re-create /var/lib/mysql with appropriate ownership
rm -rf /var/lib/mysql /etc/mysql/mariadb.conf.d/50-mysqld_safe.cnf; \
rm -rf /var/lib/mysql; \
mkdir -p /var/lib/mysql /run/mysqld; \
chown -R mysql:mysql /var/lib/mysql /run/mysqld; \
# ensure that /run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime

View File

@ -573,8 +573,8 @@ docker_mariadb_backup_system()
fi
local backup_db="system_mysql_backup_unknown_version.sql.zst"
local oldfullversion="unknown_version"
if [ -r "$DATADIR"/mysql_upgrade_info ]; then
read -r -d '' oldfullversion < "$DATADIR"/mysql_upgrade_info || true
if [ -r "$DATADIR"/mariadb_upgrade_info ]; then
read -r -d '' oldfullversion < "$DATADIR"/mariadb_upgrade_info || true
if [ -n "$oldfullversion" ]; then
backup_db="system_mysql_backup_${oldfullversion}.sql.zst"
fi
@ -641,14 +641,14 @@ EOSQL
_check_if_upgrade_is_needed() {
if [ ! -f "$DATADIR"/mysql_upgrade_info ]; then
if [ ! -f "$DATADIR"/mariadb_upgrade_info ]; then
mysql_note "MariaDB upgrade information missing, assuming required"
return 0
fi
local mariadbVersion
mariadbVersion="$(_mariadb_version)"
IFS='.-' read -ra newversion <<<"$mariadbVersion"
IFS='.-' read -ra oldversion < "$DATADIR"/mysql_upgrade_info || true
IFS='.-' read -ra oldversion < "$DATADIR"/mariadb_upgrade_info || true
if [[ ${#newversion[@]} -lt 2 ]] || [[ ${#oldversion[@]} -lt 2 ]] \
|| [[ ${oldversion[0]} -lt ${newversion[0]} ]] \

View File

@ -10,8 +10,8 @@
# the --replication option. This allows a different set of replication checks
# on different connections.
#
# --su{=|-mariadb} is option to run the healthcheck as a different unix user.
# Useful if mariadb@localhost user exists with unix socket authentication
# --su{=|-mysql} is option to run the healthcheck as a different unix user.
# Useful if mysql@localhost user exists with unix socket authentication
# Using this option disregards previous options set, so should usually be the
# first option.
#
@ -201,11 +201,11 @@ replication()
# mariadbupgrade
#
# Test the lock on the file $datadir/mysql_upgrade_info
# Test the lock on the file $datadir/mariadb_upgrade_info
# https://jira.mariadb.org/browse/MDEV-27068
mariadbupgrade()
{
local f="$datadir/mysql_upgrade_info"
local f="$datadir/mariadb_upgrade_info"
if [ -r "$f" ]; then
flock --exclusive --nonblock -n 9 9<"$f"
return $?

View File

@ -138,8 +138,7 @@ VOLUME /var/lib/mysql
COPY healthcheck.sh /usr/local/bin/healthcheck.sh
COPY docker-entrypoint.sh /usr/local/bin/
RUN ln -s usr/local/bin/docker-entrypoint.sh / # backwards compat
ENTRYPOINT ["docker-entrypoint.sh"]
EXPOSE 3306
CMD ["mysqld"]
CMD ["mariadbd"]

View File

@ -95,7 +95,7 @@ docker_process_init_files() {
done
}
# arguments necessary to run "mysqld --verbose --help" successfully (used for testing configuration validity and for extracting default/configured values)
# arguments necessary to run "mariadbd --verbose --help" successfully (used for testing configuration validity and for extracting default/configured values)
_verboseHelpArgs=(
--verbose --help
)
@ -103,12 +103,12 @@ _verboseHelpArgs=(
mysql_check_config() {
local toRun=( "$@" "${_verboseHelpArgs[@]}" ) errors
if ! errors="$("${toRun[@]}" 2>&1 >/dev/null)"; then
mysql_error $'mysqld failed while attempting to check config\n\tcommand was: '"${toRun[*]}"$'\n\t'"$errors"
mysql_error $'mariadbd failed while attempting to check config\n\tcommand was: '"${toRun[*]}"$'\n\t'"$errors"
fi
}
# Fetch value from server config
# We use mysqld --verbose --help instead of my_print_defaults because the
# We use mariadbd --verbose --help instead of my_print_defaults because the
# latter only show values present in config files, and not server defaults
mysql_get_config() {
local conf="$1"; shift
@ -147,7 +147,7 @@ docker_temp_server_start() {
fi
}
# Stop the server. When using a local socket file mysqladmin will block until
# Stop the server. When using a local socket file mariadb-admin will block until
# the shutdown is complete.
docker_temp_server_stop() {
kill "$MARIADB_PID"
@ -229,7 +229,7 @@ _mariadb_version() {
docker_init_database_dir() {
mysql_note "Initializing database files"
installArgs=( --datadir="$DATADIR" --rpm --auth-root-authentication-method=normal )
# "Other options are passed to mysqld." (so we pass all "mysqld" arguments directly here)
# "Other options are passed to mariadbd." (so we pass all "mariadbd" arguments directly here)
local mariadbdArgs=()
for arg in "${@:2}"; do
@ -240,7 +240,7 @@ docker_init_database_dir() {
mariadbdArgs+=("$arg")
fi
done
mysql_install_db "${installArgs[@]}" "${mariadbdArgs[@]}" \
mariadb-install-db "${installArgs[@]}" "${mariadbdArgs[@]}" \
--skip-test-db \
--old-mode='UTF8_IS_UTF8MB3' \
--default-time-zone=SYSTEM --enforce-storage-engine= \
@ -298,7 +298,7 @@ docker_exec_client() {
if [ -n "$MYSQL_DATABASE" ]; then
set -- --database="$MYSQL_DATABASE" "$@"
fi
mysql --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" "$@"
mariadb --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" "$@"
}
# Execute sql script, passed via stdin
@ -366,7 +366,7 @@ docker_setup_db() {
# --skip-write-binlog usefully disables binary logging
# but also outputs LOCK TABLES to improve the IO of
# Aria (MDEV-23326) for 10.4+.
mysql_tzinfo_to_sql --skip-write-binlog /usr/share/zoneinfo \
mariadb-tzinfo-to-sql --skip-write-binlog /usr/share/zoneinfo \
| docker_process_sql --dont-use-mysql-root-password --database=mysql
# tell docker_process_sql to not use MYSQL_ROOT_PASSWORD since it is not set yet
fi
@ -523,7 +523,7 @@ docker_mariadb_init()
if [ -f "$DATADIR/.init/backup-my.cnf" ]; then
mv "$DATADIR/.init/backup-my.cnf" "$DATADIR/.my.cnf"
mysql_note "Adding startup configuration:"
my_print_defaults --defaults-file="$DATADIR/.my.cnf" --mysqld
my_print_defaults --defaults-file="$DATADIR/.my.cnf" --mariadbd
fi
rm -rf "$DATADIR"/.init "$DATADIR"/.restore
if [ "$(id -u)" = "0" ]; then
@ -573,15 +573,15 @@ docker_mariadb_backup_system()
fi
local backup_db="system_mysql_backup_unknown_version.sql.zst"
local oldfullversion="unknown_version"
if [ -r "$DATADIR"/mysql_upgrade_info ]; then
read -r -d '' oldfullversion < "$DATADIR"/mysql_upgrade_info || true
if [ -r "$DATADIR"/mariadb_upgrade_info ]; then
read -r -d '' oldfullversion < "$DATADIR"/mariadb_upgrade_info || true
if [ -n "$oldfullversion" ]; then
backup_db="system_mysql_backup_${oldfullversion}.sql.zst"
fi
fi
mysql_note "Backing up system database to $backup_db"
if ! mysqldump --skip-lock-tables --replace --databases mysql --socket="${SOCKET}" | zstd > "${DATADIR}/${backup_db}"; then
if ! mariadb-dump --skip-lock-tables --replace --databases mysql --socket="${SOCKET}" | zstd > "${DATADIR}/${backup_db}"; then
mysql_error "Unable backup system database for upgrade from $oldfullversion."
fi
mysql_note "Backing up complete"
@ -592,7 +592,7 @@ docker_mariadb_backup_system()
docker_mariadb_upgrade() {
if [ -z "$MARIADB_AUTO_UPGRADE" ] \
|| [ "$MARIADB_AUTO_UPGRADE" = 0 ]; then
mysql_note "MariaDB upgrade (mysql_upgrade or creating healthcheck users) required, but skipped due to \$MARIADB_AUTO_UPGRADE setting"
mysql_note "MariaDB upgrade (mariadb-upgrade or creating healthcheck users) required, but skipped due to \$MARIADB_AUTO_UPGRADE setting"
return
fi
mysql_note "Starting temporary server"
@ -631,7 +631,7 @@ EOSQL
fi
mysql_note "Starting mariadb-upgrade"
mysql_upgrade --upgrade-system-tables
mariadb-upgrade --upgrade-system-tables
mysql_note "Finished mariadb-upgrade"
mysql_note "Stopping temporary server"
@ -641,14 +641,14 @@ EOSQL
_check_if_upgrade_is_needed() {
if [ ! -f "$DATADIR"/mysql_upgrade_info ]; then
if [ ! -f "$DATADIR"/mariadb_upgrade_info ]; then
mysql_note "MariaDB upgrade information missing, assuming required"
return 0
fi
local mariadbVersion
mariadbVersion="$(_mariadb_version)"
IFS='.-' read -ra newversion <<<"$mariadbVersion"
IFS='.-' read -ra oldversion < "$DATADIR"/mysql_upgrade_info || true
IFS='.-' read -ra oldversion < "$DATADIR"/mariadb_upgrade_info || true
if [[ ${#newversion[@]} -lt 2 ]] || [[ ${#oldversion[@]} -lt 2 ]] \
|| [[ ${oldversion[0]} -lt ${newversion[0]} ]] \
@ -663,7 +663,7 @@ _check_if_upgrade_is_needed() {
return 1
}
# check arguments for an option that would cause mysqld to stop
# check arguments for an option that would cause mariadbd to stop
# return true if there is one
_mysql_want_help() {
local arg
@ -678,9 +678,9 @@ _mysql_want_help() {
}
_main() {
# if command starts with an option, prepend mysqld
# if command starts with an option, prepend mariadbd
if [ "${1:0:1}" = '-' ]; then
set -- mysqld "$@"
set -- mariadbd "$@"
fi
#ENDOFSUBSTITUTIONS
@ -705,7 +705,7 @@ _main() {
docker_mariadb_init "$@"
# MDEV-27636 mariadb_upgrade --check-if-upgrade-is-needed cannot be run offline
#elif mysql_upgrade --check-if-upgrade-is-needed; then
#elif mariadb-upgrade --check-if-upgrade-is-needed; then
elif _check_if_upgrade_is_needed; then
docker_mariadb_upgrade "$@"
fi

View File

@ -26,7 +26,7 @@
# replication REPLICATION_CLIENT (<10.5)or REPLICA MONITOR (10.5+)
# mariadbupgrade none, however unix user permissions on datadir
#
# The SQL user used is the default for the mysql client. This can be the unix user
# The SQL user used is the default for the mariadb client. This can be the unix user
# if no user(or password) is set in the [mariadb-client] section of a configuration
# file. --defaults-{file,extra-file,group-suffix} can specify a file/configuration
# different from elsewhere.
@ -38,7 +38,7 @@ set -eo pipefail
_process_sql()
{
mysql ${nodefaults:+--no-defaults} \
mariadb ${nodefaults:+--no-defaults} \
${def['file']:+--defaults-file=${def['file']}} \
${def['extra_file']:+--defaults-extra-file=${def['extra_file']}} \
${def['group_suffix']:+--defaults-group-suffix=${def['group_suffix']}} \
@ -59,7 +59,7 @@ connect()
set +e +o pipefail
# (on second extra_file)
# shellcheck disable=SC2086
mysql ${nodefaults:+--no-defaults} \
mariadb ${nodefaults:+--no-defaults} \
${def['file']:+--defaults-file=${def['file']}} \
${def['extra_file']:+--defaults-extra-file=${def['extra_file']}} \
${def['group_suffix']:+--defaults-group-suffix=${def['group_suffix']}} \
@ -201,11 +201,11 @@ replication()
# mariadbupgrade
#
# Test the lock on the file $datadir/mysql_upgrade_info
# Test the lock on the file $datadir/mariadb_upgrade_info
# https://jira.mariadb.org/browse/MDEV-27068
mariadbupgrade()
{
local f="$datadir/mysql_upgrade_info"
local f="$datadir/mariadb_upgrade_info"
if [ -r "$f" ]; then
flock --exclusive --nonblock -n 9 9<"$f"
return $?

View File

@ -94,49 +94,55 @@ update_version()
10.5)
sed -i -e '/--old-mode/d' \
-e '/--skip-ssl/d' \
-e 's/mariadb-upgrade\([^_"]\)/mysql_upgrade\1/' \
-e 's/mariadb-dump/mysqldump/' \
-e 's/mariadb-admin/mysqladmin/' \
-e 's/\bmariadb --protocol\b/mysql --protocol/' \
-e 's/mariadb-install-db/mysql_install_db/g' \
-e 's/--mariadbd/--mysqld/' \
-e 's/mariadb-tzinfo-to-sql/mysql_tzinfo_to_sql/' \
-e '0,/#ENDOFSUBSTITUTIONS/s/mariadbd/mysqld/g' \
-e '/memory\.pressure/,+7d' "$dir/docker-entrypoint.sh"
sed -i '/backwards compat/d' "$dir/Dockerfile"
sed -i -e '/--skip-ssl/d' \
"$dir"/healthcheck.sh
-e '0,/#ENDOFSUBSTITUTIONS/s/\tmariadb/\tmysql/' "$dir/healthcheck.sh"
sed -i -e '/^CMD/s/mariadbd/mysqld/' "$dir/Dockerfile"
sed -i -e 's/mariadb_upgrade_info/mysql_upgrade_info/' \
"$dir/docker-entrypoint.sh" "$dir/healthcheck.sh"
;;
10.6)
sed -i -e '/memory\.pressure/,+7d' \
-e 's/--mariadbd/--mysqld/' \
"$dir/docker-entrypoint.sh"
sed -i -e '/--skip-ssl/d' "$dir/docker-entrypoint.sh" "$dir/healthcheck.sh"
sed -i -e 's/mariadb_upgrade_info/mysql_upgrade_info/' \
"$dir/docker-entrypoint.sh" "$dir/healthcheck.sh"
;;
10.11)
sed -i -e 's/mariadb_upgrade_info/mysql_upgrade_info/' \
-e '/--skip-ssl/d' \
"$dir/docker-entrypoint.sh" "$dir/healthcheck.sh"
# quoted $ intentional
# shellcheck disable=SC2016
sed -i -e '/^ARG MARIADB_MAJOR/d' \
-e '/^ENV MARIADB_MAJOR/d' \
-e 's/-\$MARIADB_MAJOR//' \
"$dir/Dockerfile"
;;
*)
sed -i -e '/^CMD/s/mysqld/mariadbd/' \
-e '/backwards compat/d' "$dir/Dockerfile"
sed -i -e 's/mysql_upgrade\([^_]\)/mariadb-upgrade\1/' \
-e 's/mysqldump/mariadb-dump/' \
-e 's/mysqladmin/mariadb-admin/' \
-e 's/\bmysql --protocol\b/mariadb --protocol/' \
-e 's/mysql_install_db/mariadb-install-db/' \
-e 's/mysql_tzinfo_to_sql/mariadb-tzinfo-to-sql/' \
"$dir/docker-entrypoint.sh"
if [ "$vmin" = 10.6 ]; then
# my_print_defaults didn't recognise --mysqld until 10.11
sed -i -e '0,/#ENDOFSUBSTITUTIONS/s/\([^-]\)mysqld/\1mariadbd/g' \
"$dir/docker-entrypoint.sh"
else
sed -i -e '0,/#ENDOFSUBSTITUTIONS/s/\mysqld/mariadbd/g' \
"$dir/docker-entrypoint.sh"
# quoted $ intentional
# shellcheck disable=SC2016
sed -i -e '/^ARG MARIADB_MAJOR/d' \
-e '/^ENV MARIADB_MAJOR/d' \
-e 's/-\$MARIADB_MAJOR//' \
"$dir/Dockerfile"
if [[ $vmin =~ 11.[12] ]]; then
sed -i -e '/--skip-ssl/d' \
"$dir/docker-entrypoint.sh" "$dir/healthcheck.sh"
fi
sed -i -e '0,/#ENDOFSUBSTITUTIONS/s/\bmysql\b/mariadb/' "$dir/healthcheck.sh"
if [[ ! "${vmin}" =~ 10.[678] ]]; then
# quoted $ intentional
# shellcheck disable=SC2016
sed -i -e '/^ARG MARIADB_MAJOR/d' \
-e '/^ENV MARIADB_MAJOR/d' \
-e 's/-\$MARIADB_MAJOR//' \
"$dir/Dockerfile"
else
sed -i -e '/memory\.pressure/,+7d' "$dir/docker-entrypoint.sh"
fi
if [[ $vmin = 10.* || $vmin =~ 11.[12] ]]; then
sed -i -e '/--skip-ssl/d' "$dir/docker-entrypoint.sh" "$dir/healthcheck.sh"
fi
if [[ $vmin =~ 11.[012345] ]]; then
sed -i -e 's/mysql_upgrade_info/mariadb_upgrade_info/' \
"$dir/docker-entrypoint.sh" "$dir/healthcheck.sh"
fi
if [[ $vmin =~ 11.[01] ]]; then
if [ "$vmin" == 11.1 ]; then
sed -i -e 's/50-mysqld_safe.cnf/50-mariadb_safe.cnf/' "$dir/Dockerfile"
else
sed -i -e 's/ \/[^ ]*50-mysqld_safe.cnf//' "$dir/Dockerfile"
fi
;&
esac