summaryrefslogtreecommitdiff
path: root/dev-db/mysql-init-scripts
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2019-03-19 11:37:34 +0000
committerV3n3RiX <venerix@redcorelinux.org>2019-03-19 11:37:34 +0000
commitb7b97785ebbb2f11d24d14dab8b81ed274f4ce6a (patch)
tree9fd110f9fc996e8a4213eeda994a8c112491b86d /dev-db/mysql-init-scripts
parent066d27181e9a797ad9f8fc43b49fc9a10ff2f707 (diff)
gentoo resync : 19.03.2019
Diffstat (limited to 'dev-db/mysql-init-scripts')
-rw-r--r--dev-db/mysql-init-scripts/Manifest5
-rw-r--r--dev-db/mysql-init-scripts/files/init.d-2.3194
-rw-r--r--dev-db/mysql-init-scripts/files/init.d-s6-2.3163
-rw-r--r--dev-db/mysql-init-scripts/files/init.d-supervise-2.3180
-rw-r--r--dev-db/mysql-init-scripts/files/logrotate.mysql-2.314
-rw-r--r--dev-db/mysql-init-scripts/mysql-init-scripts-2.3.ebuild67
6 files changed, 623 insertions, 0 deletions
diff --git a/dev-db/mysql-init-scripts/Manifest b/dev-db/mysql-init-scripts/Manifest
index 6a6bda0bde78..53fdcc8e2d87 100644
--- a/dev-db/mysql-init-scripts/Manifest
+++ b/dev-db/mysql-init-scripts/Manifest
@@ -1,9 +1,13 @@
AUX conf.d-2.0 2944 BLAKE2B 94b94868e840267c5bf604226af11a4c806f48111472e417d725b51f48e38b8a4bd0dbbe8f9dba95c2250590c23bc0f9bc301203fdf399cd141055e54fa9a067 SHA512 2781e2caefed0c8be9c612f92cecf5a572dc17b97519034637a2b3f98a88af02dd8973f6c6b2af524d235067df6866409d1fe9d56740bfd0efb09948073c8d3b
AUX init.d-2.2 5720 BLAKE2B 6d81ee1275439e59926ac0f2dbaa2f4b1ceed130f9047d7f6c19d27927fb0432701121554a77205f6f803c9f4e6e0ffdbf96ac8d6ff2f7ca149637585b859df4 SHA512 df1c85d527ec1805bf5ca22f5db37714ace6c55e4095ecf2e4cc1c4dad8a4aa6539282b11cb9c6a85b72e2412e1fbae90d85a8dfcda077bedb667bf784e4c613
+AUX init.d-2.3 5722 BLAKE2B 63653c5f09312899e81502aeaddc3e19cd8813ed0735baccc8c9d42b344a668dfa745366bcab24bce9b0c137c44db3052b95c5f767dd16ce22cd272417319655 SHA512 7c160885a6240be789d15f0fc257d90db3edaeb50e3695c3ae3c040c1a485367e7f72749ce5f86832b683e611eaf5c012353d58fb2382ed7e37d96c7a28d815f
AUX init.d-s6-2.2 4978 BLAKE2B bdda1ecc926a5236be865487cca01974865c7d0c8e115b0bf4e5f791293ffd3be3976730fc21d3a4f2f81389d88c40d6b427d67dfeaa694ba8487e19f03b0aa1 SHA512 77d3691837a08d117dbaa8252368ab54f1bbd5969189261e498e57cacd158b87e5600b3c2ce62b25f72b8bf5b9a08f26d56fe93b6e2e96bc58c208d92ef1befc
+AUX init.d-s6-2.3 4980 BLAKE2B b165f6a87cc3570ef6aa28d82dedbd0bc5e151c73e7a97bca62e474af15ae9cb91869f1f2d0a12618c972aa8d4b2100202671b736b6b184c6d9ad644f5955fe8 SHA512 61bfffb8a7af2fa5f2cd0f9e21930e5a2527bd9f2ada617d1b1c06110e247c78b4889f3a80d426eb2b9fcf0c312c6d0cbdc4b501690219f35b9b10d693f538a9
AUX init.d-supervise 5303 BLAKE2B ae0b30000d74028866512156e6d565e1bc4456680521e7af9195ffed2a7b75b0504c313b78d3629d0d2894c0ea980e8d8049624862200e64e82087e37bbb8d53 SHA512 149710600ca4780434e07101aa164e84d7decd86fdc4c2a8c5c37d2a965aff4626408885f98456773c6f8fb27eeeb5ab7028ccf73088739368c45f8ad9d587c4
+AUX init.d-supervise-2.3 5305 BLAKE2B 17f8b752f9cb073a4ac246e8e23c23bf2fbd4a6164c897e1598d39e8670b67f61d99b5a52f12e97e6edc984b48ac06787245c4569508984da84ab193c7c3a904 SHA512 232af963b96ce93c3628bfc154db7a495eae93595b9a720cf6f0c65100a18fa1e128affed9a6cf73ba2f6fe3344356661e8c8e4cbb55c6ed1a6e548c267e47c7
AUX log-s6 373 BLAKE2B e4579d7288c7e05c1abba55c29759eb3b0b49153c7b134e28b7308ba83e33c409d82ddc2e9794d0a398330b5b72ac33d165c6140259857ce3204928b20c2f6ac SHA512 e686bc0a4d9d5daf263c5a5f6bb883da1495feb9910f93c791af2d858b2adbf7cfc785c336ce470609f3f7bd12dabb97b470453bd67316feef5ed4df9ee9307d
AUX logrotate.mysql 368 BLAKE2B 0eb2411785e53e4ec521139943633bf7f765df532e89d626bf2387c9bc8012c4caba019615feb13eeef48e8ace55207b5d93469b323488a93f24f62a3ba32ac0 SHA512 71e6aeec21e220157fb07a609475c626e0698f556db20f5e2876117d1d46a2f297520b2124458e8b8077f9a128e27540ffa1b77cadc5eb372a502edfb804fed1
+AUX logrotate.mysql-2.3 384 BLAKE2B f7d8dae2b35283b5a7cd47418c4f43343549750a9146c522af3e093274acb24389d7ed997a20e78cbba60ccedcf9ddc667014062dd9e5a0665a61f4e3c4e1ecc SHA512 f682919b9f82649ff9fbe21287c93f0f0c434f64907476674c95dcf85bc19b9328cef1924da8247148e6424eefd4957ae86b5238f3200c71584347fe95709b53
AUX mysql.conf 37 BLAKE2B 66f792ee51ca18e692e069a2627dd3a122dadbd0cf9097857da049ade3cc21fdc45bd7725c68def448a2763e5688ade468c17f53776b780be6f6d2a0245b1b7c SHA512 7b4940666d21f09fda47e2b24bd252c83af4372f34f1b3410c59d8f439fb7c0166d5a1b8d857bf67f2263f15d95a0fa0b67f225152a18c180b67d28f4ceb5f00
AUX mysqld-v2.service 1208 BLAKE2B 9dad4cfa0a102fe7705f4d1db042d0c65d66e669b51b8536f0dbdc1ca3d149076ee71a373efc0cfa3ca900e87c8ccb91aa0beeb10bf8634553ddc3309ba3b2c9 SHA512 2016ea7d9c8fe9447675ec9612655f1b955a3f04ce417ebb1c7a8a86a29ef176a5737a9bd3bc5e45508e2e23a764a763897881b511f65635193291e212fd58aa
AUX mysqld-wait-ready 1758 BLAKE2B 2a6ccc105cedc78e4e8acf77fd13f8083af80b3488572079bd063fac263382cd37a85cf40c02ffa8a9a047f146402dc2f7bfef91d47487003b64c84cdc8196c9 SHA512 ad4a850d045149df156c8236ae114e94887626e3ca803dea9bcc3909349043b51357a71ac17d694e0217f7856e076a0736267fc1ea3dedbef8a319fc9014c01b
@@ -11,4 +15,5 @@ AUX mysqld_at-v2.service 1170 BLAKE2B d02f7ee3549d273d309e8e6e5cd8c2f987c6feab42
AUX run-s6 268 BLAKE2B ebc9c74527257e1a35a4671afe2d34d9ed9868db0e0f33eebe655b31317a4ceeb02affe471ad49007534a9ce0a9399d9f14af664488ae753e207cf97d467107b SHA512 82be247195f6d9d230b063e9bda393bab8855382c2f3e5eb4d427fc1eb7e23dbd8c90939224ff2b5e4116a5c9d3f26ebdc9b9f548cde91e7c1217f4f8500c0d3
EBUILD mysql-init-scripts-2.2-r3.ebuild 1899 BLAKE2B c7406995ab4a0ecdb9bcd20a9384e269e4dbd55d87c21674cd7b4c31d937468448818bd9c06286b5595fe138b2fb5d6cd2faeec0276e08e0e0f24a6b8b96426a SHA512 2b2873467515d34b6afb03b06f73d8420b5228924362866ab3ba0353ff59509b4aa37db0cc3ccb5f6529a8a732b1a3a405f0b4d30bd288bf518a899884146c2a
EBUILD mysql-init-scripts-2.2-r4.ebuild 1983 BLAKE2B d322fc4243b6ac3c4540c1f0f312d5baf8658234e3182ff52cbb2442f59d4052ccf662d337780ac0a77611e846ac03b9da116f6e294f4cede62694c1fc2e6d52 SHA512 ac578f3ea527efe1e5b233a075d83e5e1f49785c23c3d5e6557123859d81adef4a5ca51d91fb70f1320bceb4f9fbe2cada8334d831961061a9bba216ce55306f
+EBUILD mysql-init-scripts-2.3.ebuild 1988 BLAKE2B cc676a418285d581c4e1422073e4063b87f544e401f3825622befb6b971ebb68b29ac1d741ae908dbbc4816948644744d1c2f5c63266c3b0ac5c63fd0dd9c6d9 SHA512 568b832d444cfad9b6457c7e9b4add14f0bd5d29a009c78b37591a6b1a84b07b632c4756cbaeb6ca76cd33f057c766ea590b7ae1ec9aebd165f7d35daafdcf81
MISC metadata.xml 243 BLAKE2B f247f748a23e4cda2f518ad7e4e53b9027ff08ec62289010e6dfc8cd2ad49412430c4095e80f2156c8e6f1226bcda0163b4faae83759550f79e9998928398713 SHA512 7c227a1fadd8d61aae9baabeb5d964c93fe0c4d82fb838c83fe0360cf38b24bebf51037726f13188ecd8f52c335368a693b81e74d79ba949576a6dbcb54887a9
diff --git a/dev-db/mysql-init-scripts/files/init.d-2.3 b/dev-db/mysql-init-scripts/files/init.d-2.3
new file mode 100644
index 000000000000..f587e26f7322
--- /dev/null
+++ b/dev-db/mysql-init-scripts/files/init.d-2.3
@@ -0,0 +1,194 @@
+#!/sbin/openrc-run
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+extra_commands="checkconfig"
+extra_stopped_commands="bootstrap_galera"
+
+description_checkconfig="Verify the server's configuration"
+description_boostrap_galera="Start a new Galera cluster with this server as the initial node"
+
+depend() {
+ use net.lo
+ # localmount needed for $basedir
+ need localmount
+ # This service has its own timeout and may need to wait for repairs
+ # or remote synchronization
+ keyword -timeout
+}
+
+get_config() {
+ my_print_defaults --defaults-file="$1" mysqld server mariadb |
+ sed -n -e "s/^--$2=//p"
+}
+
+mysql_svcname() {
+ local ebextra=
+ case "${SVCNAME}" in
+ mysql*) ;;
+ *) ebextra=" (mysql)" ;;
+ esac
+ echo "${SVCNAME}${ebextra}"
+}
+
+stringContain() { [ -z "${2##*$1*}" ] && [ -z "$1" -o -n "$2" ]; }
+
+bootstrap_galera() {
+ MY_ARGS="--wsrep-new-cluster ${MY_ARGS}"
+ mark_service_starting
+ if start ; then
+ mark_service_started
+ return 0
+ else
+ mark_service_stopped
+ return 1
+ fi
+}
+
+start() {
+ # Check for old conf.d variables that mean migration was not yet done.
+ set | egrep -sq '^(mysql_slot_|MYSQL_BLOG_PID_FILE|STOPTIMEOUT)'
+ rc=$?
+ # Yes, MYSQL_INIT_I_KNOW_WHAT_I_AM_DOING is a hidden variable.
+ # It does have a use in testing, as it is possible to build a config file
+ # that works with both the old and new init scripts simulateously.
+ if [ "${rc}" = 0 -a -z "${MYSQL_INIT_I_KNOW_WHAT_I_AM_DOING}" ]; then
+ eerror "You have not updated your conf.d for the new mysql-init-scripts-2 revamp."
+ eerror "Not proceeding because it may be dangerous."
+ return 1
+ fi
+
+ # Check the config or die
+ if [ ${RC_CMD} != "restart" ] ; then
+ checkconfig || return 1
+ fi
+
+ # Now we can startup
+ ebegin "Starting $(mysql_svcname)"
+
+ MY_CNF="${MY_CNF:-/etc/${SVCNAME}/my.cnf}"
+
+ if [ ! -r "${MY_CNF}" ] ; then
+ eerror "Cannot read the configuration file \`${MY_CNF}'"
+ return 1
+ fi
+
+ # tail -n1 is critical as these we only want the last instance of the option
+ local basedir=$(get_config "${MY_CNF}" basedir | tail -n1)
+ local pidfile=$(get_config "${MY_CNF}" 'pid[_-]file' | tail -n1)
+ local socket=$(get_config "${MY_CNF}" socket | tail -n1)
+ local chroot=$(get_config "${MY_CNF}" chroot | tail -n1)
+ local wsrep="$(get_config "${MY_CNF}" 'wsrep[_-]on' | tail -n1 | awk '{print tolower($0)}')"
+ local wsrep_new=$(get_config "${MY_CNF}" 'wsrep-new-cluster' | tail -n1)
+
+ if [ -n "${chroot}" ] ; then
+ socket="${chroot}/${socket}"
+ pidfile="${chroot}/${pidfile}"
+ fi
+
+ # Galera: Only check datadir if not starting a new cluster and galera is enabled
+ # wsrep_on is not on or wsrep-new-cluster exists in the config or MY_ARGS
+ [ "${wsrep}" = "1" ] && wsrep="on"
+ if [ "${wsrep}" != "on" ] || [ -n "${wsrep_new}" ] || stringContain 'wsrep-new-cluster' "${MY_ARGS}" ; then
+
+ local datadir=$(get_config "${MY_CNF}" datadir | tail -n1)
+ if [ ! -d "${datadir}" ] ; then
+ eerror "MySQL datadir \`${datadir}' is empty or invalid"
+ eerror "Please check your config file \`${MY_CNF}'"
+ return 1
+ fi
+
+ if [ ! -d "${datadir}"/mysql ] ; then
+ # find which package is installed to report an error
+ local EROOT=$(portageq envvar EROOT)
+ local DBPKG_P=$(portageq match ${EROOT} $(portageq expand_virtual ${EROOT} virtual/mysql | head -n1))
+ if [ -z ${DBPKG_P} ] ; then
+ eerror "You don't appear to have a server package installed yet."
+ else
+ eerror "You don't appear to have the mysql database installed yet."
+ eerror "Please run \`emerge --config =${DBPKG_P}\` to have this done..."
+ fi
+ return 1
+ fi
+ fi
+
+ local piddir="${pidfile%/*}"
+ checkpath -d --owner mysql:mysql --mode 0755 "$piddir"
+ rc=$?
+ if [ $rc -ne 0 ]; then
+ eerror "Directory $piddir for pidfile does not exist and cannot be created"
+ return 1
+ fi
+
+ local startup_timeout=${STARTUP_TIMEOUT:-900}
+ local startup_early_timeout=${STARTUP_EARLY_TIMEOUT:-1000}
+ local tmpnice="${NICE:+"--nicelevel "}${NICE}"
+ local tmpionice="${IONICE:+"--ionice "}${IONICE}"
+ start-stop-daemon \
+ ${DEBUG:+"--verbose"} \
+ --start \
+ --exec "${basedir}"/sbin/mysqld \
+ --pidfile "${pidfile}" \
+ --background \
+ --wait ${startup_early_timeout} \
+ ${tmpnice} \
+ ${tmpionice} \
+ -- --defaults-file="${MY_CNF}" ${MY_ARGS}
+ local ret=$?
+ if [ ${ret} -ne 0 ] ; then
+ eend ${ret}
+ return ${ret}
+ fi
+
+ ewaitfile ${startup_timeout} "${socket}"
+ eend $? || return 1
+
+ save_options pidfile "${pidfile}"
+ save_options basedir "${basedir}"
+}
+
+stop() {
+ if [ ${RC_CMD} = "restart" ] ; then
+ checkconfig || return 1
+ fi
+
+ ebegin "Stopping $(mysql_svcname)"
+
+ local pidfile="$(get_options pidfile)"
+ local basedir="$(get_options basedir)"
+ local stop_timeout=${STOP_TIMEOUT:-120}
+
+ start-stop-daemon \
+ ${DEBUG:+"--verbose"} \
+ --stop \
+ --exec "${basedir}"/sbin/mysqld \
+ --pidfile "${pidfile}" \
+ --retry ${stop_timeout}
+ eend $?
+}
+
+checkconfig() {
+ local my_cnf="${MY_CNF:-/etc/${SVCNAME}/my.cnf}"
+ local basedir=$(get_config "${my_cnf}" basedir | tail -n1)
+ local svc_name=$(mysql_svcname)
+ ebegin "Checking mysqld configuration for ${svc_name}"
+
+ if [ ${RC_CMD} = "checkconfig" ] ; then
+ # We are calling checkconfig specifically. Print warnings regardless.
+ "${basedir}"/sbin/mysqld --defaults-file="${my_cnf}" --help --verbose > /dev/null
+ else
+ # Suppress output to check the return value
+ "${basedir}"/sbin/mysqld --defaults-file="${my_cnf}" --help --verbose > /dev/null 2>&1
+
+ # If the above command does not return 0,
+ # then there is an error to echo to the user
+ if [ $? -ne 0 ] ; then
+ "${basedir}"/sbin/mysqld --defaults-file="${my_cnf}" --help --verbose > /dev/null
+ fi
+ fi
+
+ eend $? "${svc_name} config check failed"
+}
+
+# vim: filetype=gentoo-init-d sw=2 ts=2 sts=2 noet:
+
diff --git a/dev-db/mysql-init-scripts/files/init.d-s6-2.3 b/dev-db/mysql-init-scripts/files/init.d-s6-2.3
new file mode 100644
index 000000000000..5bf62e3ef937
--- /dev/null
+++ b/dev-db/mysql-init-scripts/files/init.d-s6-2.3
@@ -0,0 +1,163 @@
+#!/sbin/openrc-run
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ use net.lo
+ # localmount needed for $basedir
+ need localmount s6-svscan
+}
+
+get_config() {
+ my_print_defaults --defaults-file="$1" mysqld server mariadb |
+ sed -n -e "s/^--$2=//p"
+}
+
+mysql_svcname() {
+ local ebextra=
+ case "${svc_name}" in
+ mysql*) ;;
+ *) ebextra=" (mysql)" ;;
+ esac
+ echo "${svc_name}${ebextra}"
+}
+
+stringContain() { [ -z "${2##*$1*}" ] && [ -z "$1" -o -n "$2" ]; }
+
+bootstrap_galera() {
+ MY_ARGS="--wsrep-new-cluster ${MY_ARGS}"
+ mark_service_starting
+ if start_pre && start ; then
+ mark_service_started
+ return 0
+ else
+ mark_service_stopped
+ return 1
+ fi
+}
+
+
+extra_commands="checkconfig"
+extra_stopped_commands="bootstrap_galera"
+
+description_checkconfig="Verify the server's configuration"
+description_boostrap_galera="Start a new Galera cluster with this server as the initial node"
+supervisor=s6
+name=$(mysql_svcname)
+s6_service_timeout_stop="$((1000*${STOP_TIMEOUT:-120}))"
+#s6_svwait_options_start="-U -t $((1000*${STARTUP_EARLY_TIMEOUT:-1000}))"
+svc_name=${RC_SVCNAME%-s6}
+s6_service_path=/var/svc.d/${svc_name}
+
+start_pre() {
+ # Check the config or die
+ if [ ${RC_CMD} != "restart" ] ; then
+ checkconfig || return 1
+ fi
+
+ MY_CNF="${MY_CNF:-/etc/${svc_name}/my.cnf}"
+
+ if [ ! -r "${MY_CNF}" ] ; then
+ eerror "Cannot read the configuration file \`${MY_CNF}'"
+ return 1
+ fi
+
+ # tail -n1 is critical as these we only want the last instance of the option
+ local basedir=$(get_config "${MY_CNF}" basedir | tail -n1)
+ local pidfile=$(get_config "${MY_CNF}" 'pid[_-]file' | tail -n1)
+ local socket=$(get_config "${MY_CNF}" socket | tail -n1)
+ local chroot=$(get_config "${MY_CNF}" chroot | tail -n1)
+ local wsrep="$(get_config "${MY_CNF}" 'wsrep[_-]on' | tail -n1 | awk '{print tolower($0)}')"
+ local wsrep_new=$(get_config "${MY_CNF}" 'wsrep-new-cluster' | tail -n1)
+
+ if [ -n "${chroot}" ] ; then
+ socket="${chroot}/${socket}"
+ pidfile="${chroot}/${pidfile}"
+ fi
+
+ # Galera: Only check datadir if not starting a new cluster and galera is enabled
+ # wsrep_on is not on or wsrep-new-cluster exists in the config or MY_ARGS
+ [ "${wsrep}" = "1" ] && wsrep="on"
+ if [ "${wsrep}" != "on" ] || [ -n "${wsrep_new}" ] || stringContain 'wsrep-new-cluster' "${MY_ARGS}" ; then
+
+ local datadir=$(get_config "${MY_CNF}" datadir | tail -n1)
+ if [ ! -d "${datadir}" ] ; then
+ eerror "MySQL datadir \`${datadir}' is empty or invalid"
+ eerror "Please check your config file \`${MY_CNF}'"
+ return 1
+ fi
+
+ if [ ! -d "${datadir}"/mysql ] ; then
+ # find which package is installed to report an error
+ local EROOT=$(portageq envvar EROOT)
+ local DBPKG_P=$(portageq match ${EROOT} $(portageq expand_virtual ${EROOT} virtual/mysql | head -n1))
+ if [ -z ${DBPKG_P} ] ; then
+ eerror "You don't appear to have a server package installed yet."
+ else
+ eerror "You don't appear to have the mysql database installed yet."
+ eerror "Please run \`emerge --config =${DBPKG_P}\` to have this done..."
+ fi
+ return 1
+ fi
+ fi
+
+ local piddir="${pidfile%/*}"
+ checkpath -d --owner mysql:mysql --mode 0755 "$piddir"
+ rc=$?
+ if [ $rc -ne 0 ]; then
+ eerror "Directory $piddir for pidfile does not exist and cannot be created"
+ return 1
+ fi
+
+ # Prepare env files to source
+ mkdir -p "/var/svc.d/${svc_name}"
+ echo "MY_CNF=\"${MY_CNF}\"" > "/var/svc.d/${svc_name}/env"
+ echo "MY_ARGS=\"${MY_ARGS}\"" >> "/var/svc.d/${svc_name}/env"
+ echo "basedir=\"${basedir}\"" >> "/var/svc.d/${svc_name}/env"
+ mkdir -p "/var/svc.d/${svc_name}/log"
+ echo "SVCNAME=\"${svc_name}\"" > "/var/svc.d/${svc_name}/log/env"
+ echo "S6_LOG_OPTIONS=\"${S6_LOG_OPTIONS}\"" > "/var/svc.d/${svc_name}/log/env"
+}
+
+start_post() {
+ local socket=$(get_config "${MY_CNF}" socket | tail -n1)
+ local chroot=$(get_config "${MY_CNF}" chroot | tail -n1)
+ local startup_timeout=${STARTUP_TIMEOUT:-900}
+
+ if [ -n "${chroot}" ] ; then
+ socket="${chroot}/${socket}"
+ fi
+ ewaitfile ${startup_timeout} "${socket}"
+}
+
+checkconfig() {
+ local my_cnf="${MY_CNF:-/etc/${svc_name}/my.cnf}"
+ local basedir=$(get_config "${my_cnf}" basedir | tail -n1)
+ local svc_name=$(mysql_svcname)
+ ebegin "Checking mysqld configuration for ${svc_name}"
+
+ if [ ${RC_CMD} = "checkconfig" ] ; then
+ # We are calling checkconfig specifically. Print warnings regardless.
+ "${basedir}"/sbin/mysqld --defaults-file="${my_cnf}" --help --verbose > /dev/null
+ else
+ # Suppress output to check the return value
+ "${basedir}"/sbin/mysqld --defaults-file="${my_cnf}" --help --verbose > /dev/null 2>&1
+
+ # If the above command does not return 0,
+ # then there is an error to echo to the user
+ if [ $? -ne 0 ] ; then
+ "${basedir}"/sbin/mysqld --defaults-file="${my_cnf}" --help --verbose > /dev/null
+ fi
+ fi
+
+ eend $? "${svc_name} config check failed"
+}
+
+stop_pre() {
+ if [ ${RC_CMD} = "restart" ] ; then
+ checkconfig || return 1
+ fi
+}
+
+# vim: filetype=gentoo-init-d sw=2 ts=2 sts=2 noet:
+
diff --git a/dev-db/mysql-init-scripts/files/init.d-supervise-2.3 b/dev-db/mysql-init-scripts/files/init.d-supervise-2.3
new file mode 100644
index 000000000000..e611995b9a04
--- /dev/null
+++ b/dev-db/mysql-init-scripts/files/init.d-supervise-2.3
@@ -0,0 +1,180 @@
+#!/sbin/openrc-run
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+extra_commands="checkconfig"
+extra_stopped_commands="boostrap_galera"
+
+description_checkconfig="Verify the server's configuration"
+description_boostrap_galera="Start a new Galera cluster with this server as the initial node"
+
+depend() {
+ use net.lo
+ # localmount needed for $basedir
+ need localmount
+}
+
+get_config() {
+ my_print_defaults --defaults-file="$1" mysqld server mariadb |
+ sed -n -e "s/^--$2=//p"
+}
+
+mysql_svcname() {
+ local ebextra=
+ case "${SVCNAME}" in
+ mysql*) ;;
+ *) ebextra=" (mysql)" ;;
+ esac
+ echo "${SVCNAME}${ebextra}"
+}
+
+stringContain() { [ -z "${2##*$1*}" ] && [ -z "$1" -o -n "$2" ]; }
+
+bootstrap_galera() {
+ MY_ARGS="--wsrep-new-cluster ${MY_ARGS}"
+ mark_service_starting
+ if start ; then
+ mark_service_started
+ return 0
+ else
+ mark_service_stopped
+ return 1
+ fi
+}
+
+start() {
+ # Check for old conf.d variables that mean migration was not yet done.
+ set | egrep -sq '^(mysql_slot_|MYSQL_BLOG_PID_FILE|STOPTIMEOUT)'
+ rc=$?
+ # Yes, MYSQL_INIT_I_KNOW_WHAT_I_AM_DOING is a hidden variable.
+ # It does have a use in testing, as it is possible to build a config file
+ # that works with both the old and new init scripts simulateously.
+ if [ "${rc}" = 0 -a -z "${MYSQL_INIT_I_KNOW_WHAT_I_AM_DOING}" ]; then
+ eerror "You have not updated your conf.d for the new mysql-init-scripts-2 revamp."
+ eerror "Not proceeding because it may be dangerous."
+ return 1
+ fi
+
+ # Check the config or die
+ if [ ${RC_CMD} != "restart" ] ; then
+ checkconfig || return 1
+ fi
+
+ # Now we can startup
+ ebegin "Starting $(mysql_svcname)"
+
+ MY_CNF="${MY_CNF:-/etc/${SVCNAME}/my.cnf}"
+
+ if [ ! -r "${MY_CNF}" ] ; then
+ eerror "Cannot read the configuration file \`${MY_CNF}'"
+ return 1
+ fi
+
+ # tail -n1 is critical as these we only want the last instance of the option
+ local basedir=$(get_config "${MY_CNF}" basedir | tail -n1)
+ local pidfile=$(get_config "${MY_CNF}" 'pid[_-]file' | tail -n1)
+ local socket=$(get_config "${MY_CNF}" socket | tail -n1)
+ local chroot=$(get_config "${MY_CNF}" chroot | tail -n1)
+ local wsrep="$(get_config "${MY_CNF}" 'wsrep[_-]on' | tail -n1 | awk '{print tolower($0)}')"
+ local wsrep_new=$(get_config "${MY_CNF}" 'wsrep-new-cluster' | tail -n1)
+
+ if [ -n "${chroot}" ] ; then
+ socket="${chroot}/${socket}"
+ pidfile="${chroot}/${pidfile}"
+ fi
+
+ # Galera: Only check datadir if not starting a new cluster and galera is enabled
+ # wsrep_on is not on or wsrep-new-cluster exists in the config or MY_ARGS
+ [ "${wsrep}" = "1" ] && wsrep="on"
+ if [ "${wsrep}" != "on" ] || [ -n "${wsrep_new}" ] || stringContain 'wsrep-new-cluster' "${MY_ARGS}" ; then
+
+ local datadir=$(get_config "${MY_CNF}" datadir | tail -n1)
+ if [ ! -d "${datadir}" ] ; then
+ eerror "MySQL datadir \`${datadir}' is empty or invalid"
+ eerror "Please check your config file \`${MY_CNF}'"
+ return 1
+ fi
+
+ if [ ! -d "${datadir}"/mysql ] ; then
+ # find which package is installed to report an error
+ local EROOT=$(portageq envvar EROOT)
+ local DBPKG_P=$(portageq match ${EROOT} $(portageq expand_virtual ${EROOT} virtual/mysql | head -n1))
+ if [ -z ${DBPKG_P} ] ; then
+ eerror "You don't appear to have a server package installed yet."
+ else
+ eerror "You don't appear to have the mysql database installed yet."
+ eerror "Please run \`emerge --config =${DBPKG_P}\` to have this done..."
+ fi
+ return 1
+ fi
+ fi
+
+ local piddir="${pidfile%/*}"
+ checkpath -d --owner mysql:mysql --mode 0755 "$piddir"
+ rc=$?
+ if [ $rc -ne 0 ]; then
+ eerror "Directory $piddir for pidfile does not exist and cannot be created"
+ return 1
+ fi
+
+ local startup_timeout=${STARTUP_TIMEOUT:-900}
+# local startup_early_timeout=${STARTUP_EARLY_TIMEOUT:-1000}
+ local tmpnice="${NICE:+"--nicelevel "}${NICE}"
+ local tmpionice="${IONICE:+"--ionice "}${IONICE}"
+ supervise-daemon \
+ ${DEBUG:+"--verbose"} \
+ --pidfile "/run/${SVCNAME}.pid" \
+ ${tmpnice} \
+ ${tmpionice} \
+ --start \
+ "${basedir}"/sbin/mysqld \
+ -- --defaults-file="${MY_CNF}" ${MY_ARGS}
+ local ret=$?
+ if [ ${ret} -ne 0 ] ; then
+ eend ${ret}
+ return ${ret}
+ fi
+
+ ewaitfile ${startup_timeout} "${socket}"
+ eend $? || return 1
+}
+
+stop() {
+ if [ ${RC_CMD} = "restart" ] ; then
+ checkconfig || return 1
+ fi
+
+ ebegin "Stopping $(mysql_svcname)"
+
+ supervise-daemon \
+ ${DEBUG:+"--verbose"} \
+ --stop \
+ --pidfile "/run/${SVCNAME}.pid"
+ eend $?
+}
+
+checkconfig() {
+ local my_cnf="${MY_CNF:-/etc/${SVCNAME}/my.cnf}"
+ local basedir=$(get_config "${my_cnf}" basedir | tail -n1)
+ local svc_name=$(mysql_svcname)
+ ebegin "Checking mysqld configuration for ${svc_name}"
+
+ if [ ${RC_CMD} = "checkconfig" ] ; then
+ # We are calling checkconfig specifically. Print warnings regardless.
+ "${basedir}"/sbin/mysqld --defaults-file="${my_cnf}" --help --verbose > /dev/null
+ else
+ # Suppress output to check the return value
+ "${basedir}"/sbin/mysqld --defaults-file="${my_cnf}" --help --verbose > /dev/null 2>&1
+
+ # If the above command does not return 0,
+ # then there is an error to echo to the user
+ if [ $? -ne 0 ] ; then
+ "${basedir}"/sbin/mysqld --defaults-file="${my_cnf}" --help --verbose > /dev/null
+ fi
+ fi
+
+ eend $? "${svc_name} config check failed"
+}
+
+# vim: filetype=gentoo-init-d sw=2 ts=2 sts=2 noet:
+
diff --git a/dev-db/mysql-init-scripts/files/logrotate.mysql-2.3 b/dev-db/mysql-init-scripts/files/logrotate.mysql-2.3
new file mode 100644
index 000000000000..6a3b9eeb2ca9
--- /dev/null
+++ b/dev-db/mysql-init-scripts/files/logrotate.mysql-2.3
@@ -0,0 +1,14 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+/var/log/mysql/mysql.err /var/log/mysql/mysql.log /var/log/mysql/mysqld.err {
+monthly
+create 660 mysql mysql
+notifempty
+size 5M
+sharedscripts
+missingok
+postrotate
+ /bin/kill -HUP $(cat $(my_print_defaults server mysqld mariadb | grep 'pid[_-]file' | cut -d = -f 2))
+endscript
+}
diff --git a/dev-db/mysql-init-scripts/mysql-init-scripts-2.3.ebuild b/dev-db/mysql-init-scripts/mysql-init-scripts-2.3.ebuild
new file mode 100644
index 000000000000..b3283cf3ba24
--- /dev/null
+++ b/dev-db/mysql-init-scripts/mysql-init-scripts-2.3.ebuild
@@ -0,0 +1,67 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit systemd s6 tmpfiles
+
+DESCRIPTION="Gentoo MySQL init scripts."
+HOMEPAGE="https://www.gentoo.org/"
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
+IUSE=""
+
+DEPEND=""
+# This _will_ break with MySQL 5.0, 4.x, 3.x
+# It also NEEDS openrc for the save_options/get_options builtins.
+# The s6 support was added after openrc 0.16.2
+# mysql-connector-c needed for my_print_defaults
+RDEPEND="
+ !<dev-db/mysql-5.1
+ !<sys-apps/openrc-0.16.2
+ dev-db/mysql-connector-c
+ "
+# Need to set S due to PMS saying we need it existing, but no SRC_URI
+S=${WORKDIR}
+
+src_install() {
+ newconfd "${FILESDIR}/conf.d-2.0" "mysql"
+
+ # s6 init scripts
+ if use amd64 || use x86 ; then
+ newconfd "${FILESDIR}/conf.d-2.0" "mysql-s6"
+ newinitd "${FILESDIR}/init.d-s6-2.3" "mysql-s6"
+ s6_install_service mysql "${FILESDIR}/run-s6"
+ s6_install_service mysql/log "${FILESDIR}/log-s6"
+ fi
+
+ newinitd "${FILESDIR}/init.d-2.3" "mysql"
+ newinitd "${FILESDIR}/init.d-supervise-2.3" "mysql-supervise"
+
+ # systemd unit installation
+ exeinto /usr/libexec
+ doexe "${FILESDIR}"/mysqld-wait-ready
+ systemd_newunit "${FILESDIR}/mysqld-v2.service" "mysqld.service"
+ systemd_newunit "${FILESDIR}/mysqld_at-v2.service" "mysqld@.service"
+ dotmpfiles "${FILESDIR}/mysql.conf"
+
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}/logrotate.mysql-2.3" "mysql"
+}
+
+pkg_postinst() {
+ tmpfiles_process mysql.conf
+ if use amd64 || use x86 ; then
+ elog ""
+ elog "To use the mysql-s6 script, you need to install the optional sys-apps/s6 package."
+ elog "If you wish to use s6 logging support, comment out the log-error setting in your my.cnf"
+ fi
+
+ elog ""
+ elog "Starting with version 10.1.8, MariaDB includes an improved systemd unit named mariadb.service"
+ elog "You should prefer that unit over this package's mysqld.service."
+ einfo ""
+}