aboutsummaryrefslogtreecommitdiffstats
path: root/main/mariadb/mariadb.initd
diff options
context:
space:
mode:
authorValery Kartel <valery.kartel@gmail.com>2015-10-19 03:05:09 +0300
committerNatanael Copa <ncopa@alpinelinux.org>2015-10-21 05:59:15 +0000
commit3b88157511585b012b9b698fe3a7f3f607a1cfa2 (patch)
treedf3f325d75ed8e36616b99d27cb8012198bdc4d6 /main/mariadb/mariadb.initd
parent187fbc6e852cba0a52399adce59d8aaeff8e9283 (diff)
main/mariadb: upgrade to stable 10.1.8
Diffstat (limited to 'main/mariadb/mariadb.initd')
-rw-r--r--main/mariadb/mariadb.initd63
1 files changed, 18 insertions, 45 deletions
diff --git a/main/mariadb/mariadb.initd b/main/mariadb/mariadb.initd
index 8409bad26d4..cb2a388b967 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")
}