Subject: [alpine-aports] [PATCH] main/mariadb: upgrade to stable 10.1.8

From: Valery Kartel <[email-masked]>
Date: Mon, 19 Oct 2015 03:05:09 +0300

---
 main/mariadb/APKBUILD      | 19 +++++++-------
 main/mariadb/mariadb.initd | 63 +++++++++++++---------------------------------
 2 files changed, 27 insertions(+), 55 deletions(-)

diff --git a/main/mariadb/APKBUILD b/main/mariadb/APKBUILD
index 67c6239..7015b78 100644
--- a/main/mariadb/APKBUILD
+++ b/main/mariadb/APKBUILD
@@ -3,8 +3,8 @@
 # Maintainer: Natanael Copa <[email-masked]>
 
 pkgname=mariadb
-pkgver=10.0.21
-pkgrel=2
+pkgver=10.1.8
+pkgrel=0
 pkgdesc="A fast SQL database server"
 url="http://www.mariadb.org"
 pkgusers="mysql"
@@ -84,11 +84,10 @@ package() {
 		"$pkgdir"/etc/init.d/$pkgname || return 1
 
 	# use small example config as default, which has tcp disabled
-	install -D  "$pkgdir"/usr/share/mysql/my-medium.cnf \
+	install -Dm 640 -o mysql  "$pkgdir"/usr/share/mysql/my-medium.cnf \
 		"$pkgdir"/etc/mysql/my.cnf || return 1
 
 	install -dDo mysql "$pkgdir"/var/log/mysql || return 1
-	install -dDo mysql "$pkgdir"/var/run/mysqld || return 1
 
 	# libmysqlclient_r is no more.  Upstream tries to replace it with
 	# symlinks but that really doesn't work (wrong soname in particular).
@@ -180,18 +179,18 @@ mysql() { _compat mysql mariadb; }
 _compat_client() { _compat mysql-client mariadb-client; }
 _compat_bench() { _compat mysql-bench mariadb-client; }
 
-md5sums="956561f3798d1fe8dfbe4b665287a87a  mariadb-10.0.21.tar.gz
-62fb1ce5bad87bb15cf8e289ce686885  mariadb.initd
+md5sums="9ba0aaabba40153d83e70edcc1aa43a8  mariadb-10.1.8.tar.gz
+2cf887d864e05947f5b831bd7ca06b74  mariadb.initd
 bcaee4dbbf77f4432ecd9796714be75b  fix-mysql-install-db-path.patch
 14adb188bde2359d94a5d661ab793cee  musl-fix-inttype.patch
 b32eed97ab575140685eeae4a56205a2  0001-Fix-segfault-with-musl-libc-due-to-bad-use-of-strerr.patch"
-sha256sums="4b9a32e15ceadefdb1057a02eb3e0addf702b75aef631a3c9194b832ecfa3545  mariadb-10.0.21.tar.gz
-696fa87b87f37b6c310da6c1ef5f8759bd5b4b1654fbcf0561c9f0592bfa8dd9  mariadb.initd
+sha256sums="7cbf6a4649aa6dc9cd1dc24424ade7b994de78582ce4d47ca0f4cd1c4c003bfa  mariadb-10.1.8.tar.gz
+49bab0ec69432d5c56c53ff83488bfa5eb2859bc95a12e8fc7f12d1f0403f0c6  mariadb.initd
 52e3827529b53c02a9ba263bd395bde773d2666853b252a131e824bb256f36d5  fix-mysql-install-db-path.patch
 2a66efddb9c5e8076da3d9c602bbfb9413917ab4b5d1015459f550da8ac10c87  musl-fix-inttype.patch
 2253fa4b0470d4bcfb183967f7658f04867a31b3ce1ffbe22926a52bf595c616  0001-Fix-segfault-with-musl-libc-due-to-bad-use-of-strerr.patch"
-sha512sums="75aa4b019f3432a61483bb325a0f088ea92d6fede44d7a300c15659411c8927fa2a0586182226315b6d6796641ca1d8746f7fd49e21fe21505adec1fc38ae32f  mariadb-10.0.21.tar.gz
-510207ba29ef40e017840fb39bc51285374d2e2ed0d70eb65916e5415e6a993af19b4fd3b579af89173b1e3b0d7c5115d8f43b22c16596b4a83a9f8353154400  mariadb.initd
+sha512sums="6bb282f814a0d7a6d8e06feb11a819bf9fc6f240428e4a03716a50f2291e070d789224e7f88b4b9b33a160424c4cc0b9deef96c280dcc900476ffc9888dccb45  mariadb-10.1.8.tar.gz
+53d28d688fc9b45684f8368971c01424e5388d39dfaad8b2c432c54d5fabadf2388786303e92c5ca734cb95b4618863c23f7be2a618efc97854536c3a9dc1240  mariadb.initd
 4aca6e42f4dec9d7122388b1d1bc40762a4677a1beafcf448b900d443a2f778a8fd52bc7f1b5c9697e0ad13473e6d01eb29607a40de195ac07857cd4dfc2a1fe  fix-mysql-install-db-path.patch
 17ee255222ec9d7601554e607586ac1d0a0b818a4547e30a2739e7163df0439357b011f6848fbff4d28e93830256165a29ce8b20f25256d493d4605f253061ef  musl-fix-inttype.patch
 ff1390b4718cfa6cd02947a82a404ea51483678a5cb52651c3b9d243dbc17c3b37df1013aeab618fa1077f930e75ac104168d7853880b0e2e95a32a9bcd5a2f2  0001-Fix-segfault-with-musl-libc-due-to-bad-use-of-strerr.patch"
diff --git a/main/mariadb/mariadb.initd b/main/mariadb/mariadb.initd
index 8409bad..cb2a388 100644
--- a/main/mariadb/mariadb.initd
+++ b/main/mariadb/mariadb.initd
@@ -1,15 +1,19 @@
 #!/sbin/openrc-run
-# Copyright 1999-2004 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/dev-db/mysql/files/mysql.init,v 1.7 2004/07/14 21:41:15 agriffis Exp $
 
+getconf() {
+	v=$(my_print_defaults --mysqld | grep ^--$1)
+	[ -z $v ] && echo $2 || echo ${v#*=}
+}
+
+retry="60"
+pidfile=$(getconf pid-file "/run/mysqld/mysqld.pid")
 extra_stopped_commands="setup"
-pidfile=/var/run/mysqld/mysqld.pid
+command="/usr/bin/mysqld_safe"
+command_args="--pid-file=$pidfile --syslog --nowatch"
 
 depend() {
-	need net
-	after firewall
-	use dns
+	use net
+	need localmount
 }
 
 setup() {
@@ -18,45 +22,14 @@ setup() {
 	eend $?
 }
 
-checkconfig() {
-	if [ ! -f /etc/mysql/my.cnf ] ; then
-		eerror "No /etc/mysql/my.cnf file exists!"
-	fi
-
-	dir=`my_print_defaults mysqld | grep -- --datadir | sed -e "s|^.*=\(.*\)|\1|"`
-
-	dir=${dir:-/var/lib/mysql}
-	[ -d ${dir}/mysql ] && return 0
-
-	if [ -z "$AUTO_SETUP" ] ; then
-		eerror "Database not found in $dir"
-		eerror "You can run '/etc/init.d/mariadb setup' to setup a new database."
-		return 1
+start_pre() {
+	required_dirs=$(getconf datadir "/var/lib/mysql")
+	if [ ! -d $required_dirs/mysql ]; then
+		eerror "Datadir '$required_dirs' is empty or invalid."
+		eerror "Run '/etc/init.d/mariadb setup' to create new database."
 	fi
-	setup
 }
 
-start() {
-	checkconfig || return 1
-	ebegin "Starting mysqld"
-	if start-stop-daemon --pidfile $pidfile \
-		--start \
-		--background \
-		--stdout /dev/null \
-		--stderr /dev/null \
-		-- \
-		/usr/bin/mysqld_safe --pid-file=$pidfile; then
-
-		ewaitfile 10 /run/mysqld/mysqld.sock
-		eend 0
-	else
-		eend $?
-	fi
-}
-
-stop () {
-	ebegin "Stopping mysqld"
-	start-stop-daemon --stop --quiet \
-		--pidfile $pidfile --retry 20
-	eend $?
+start_post() {
+	ewaitfile 10 $(getconf socket "/run/mysqld/mysqld.sock")
 }
-- 
2.6.1

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---

---

From: Natanael Copa <[email-masked]>
Date: Tue, 15 Dec 2015 09:34:18 +0100

Valery,

I have a question on a change that was not clearly explained in the
commit message.

On Mon, 19 Oct 2015 03:05:09 +0300

> +++ b/main/mariadb/APKBUILD

...

> +++ b/main/mariadb/mariadb.initd

Why do we accept that mariadb may be started before the firewall? Isn't
that a potensial risk? What was the reason for this change?

Why do we remove the 'use dns'? Did it create problems? Did you
investigate why it was added in first place?

-nc

---

---

From: Valery Kartel <[email-masked]>
Date: Tue, 15 Dec 2015 13:05:33 +0200

Hi,

Don't know why I do that. Maybe because I use mysql on loopback interface
only and if I need to make it visible outide, I wrote DNAT iptables rule.
So in my case it doesn't need firewall or dns.
And you are right. In general purpose it uses dns and must be started after
firewall.

It was a mistake to implement my own IMHO to init-script.

2015-12-15 10:34 GMT+02:00 Natanael Copa <[email-masked]>:

> >  main/mariadb/mariadb.initd | 63
> +++++++++++++---------------------------------