dev-db/mysql-init-scripts: rev bump
authorThomas Deutschmann <whissi@gentoo.org>
Wed, 28 Aug 2019 14:17:49 +0000 (16:17 +0200)
committerThomas Deutschmann <whissi@gentoo.org>
Wed, 28 Aug 2019 14:43:21 +0000 (16:43 +0200)
- Move acct-* dependencies to RDEPEND to support binary packages.
  Note: According to devmanual there will be a problem once emerge
        will merge RDEPEND after the actual package.

- Handle the case when option is defined multiple times.

Closes: https://bugs.gentoo.org/693000
Closes: https://bugs.gentoo.org/686378
Package-Manager: Portage-2.3.72, Repoman-2.3.17
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
dev-db/mysql-init-scripts/files/logrotate.mysql-2.3
dev-db/mysql-init-scripts/mysql-init-scripts-2.3-r3.ebuild [new file with mode: 0644]

index 6a3b9eeb2ca9f22f28809cfb94e07ad89e4acdfc..6573671b2c7bfb44d027bdac8d59dd0463f85909 100644 (file)
@@ -9,6 +9,9 @@ size 5M
 sharedscripts
 missingok
 postrotate
-  /bin/kill -HUP $(cat $(my_print_defaults server mysqld mariadb | grep 'pid[_-]file' | cut -d = -f 2))
+       pidfile=$(my_print_defaults server mysqld mariadb | grep 'pid[_-]file' | tail -n 1 | cut -d = -f 2)
+       if [ -s "${pidfile}" ] ; then
+               /bin/kill -HUP $(cat "${pidfile}")
+       fi
 endscript
 }
diff --git a/dev-db/mysql-init-scripts/mysql-init-scripts-2.3-r3.ebuild b/dev-db/mysql-init-scripts/mysql-init-scripts-2.3-r3.ebuild
new file mode 100644 (file)
index 0000000..ddd4c18
--- /dev/null
@@ -0,0 +1,70 @@
+# 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
+       !prefix? (
+               acct-group/mysql acct-user/mysql
+       )
+       "
+# 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 ""
+}