aboutsummaryrefslogtreecommitdiffstats
path: root/main/mysql/mysql.initd
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2011-04-01 14:16:00 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2011-04-01 14:22:07 +0000
commit975befa3e304631a57dc469805d83bf86ac82d10 (patch)
treec0ada4324aae0fcc2ac1682eed734ecd2e1778c8 /main/mysql/mysql.initd
parent77aff19e6d50d5443d646733229b5e149308a129 (diff)
downloadaports-975befa3e304631a57dc469805d83bf86ac82d10.tar.bz2
aports-975befa3e304631a57dc469805d83bf86ac82d10.tar.xz
main/mysql: upgrade to 5.5.10, again
* Create mysql-common subpackage for common files * Fix dynamic linking for client apps * Fix init.d script - let user create db with 'setup' * Use my-medium.cnf example config as default config
Diffstat (limited to 'main/mysql/mysql.initd')
-rw-r--r--main/mysql/mysql.initd63
1 files changed, 41 insertions, 22 deletions
diff --git a/main/mysql/mysql.initd b/main/mysql/mysql.initd
index c55b76121a..698067d49d 100644
--- a/main/mysql/mysql.initd
+++ b/main/mysql/mysql.initd
@@ -1,39 +1,58 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/www/viewcvs.gentoo.org/raw_cvs/gentoo-x86/dev-db/mysql/files/mysql.init,v 1.7 2004/07/14 21:41:15 agriffis Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-db/mysql/files/mysql.init,v 1.7 2004/07/14 21:41:15 agriffis Exp $
+
+opts="${opts} setup"
+pidfile=/var/run/mysqld/mysqld.pid
depend() {
- need net
- after firewall
- use dns
+ need net
+ after firewall
+ use dns
+}
+
+setup() {
+ ebegin "Creating a new MySQL database"
+ mysql_install_db --user=mysql --rpm
+ eend $?
}
checkconfig() {
- if [ ! -f /etc/mysql/my.cnf ] ; then
- eerror "No /etc/mysql/my.cnf file exists!"
- fi
+ if [ ! -f /etc/mysql/my.cnf ] ; then
+ eerror "No /etc/mysql/my.cnf file exists!"
+ fi
- dir=`my_print_defaults -c /etc/mysql/my.cnf mysqld | grep -- --datadir | sed -e "s|^.*=\(.*\)|\1|"`
+ dir=`my_print_defaults mysqld | grep -- --datadir | sed -e "s|^.*=\(.*\)|\1|"`
- if [ ! -d $dir/mysql ] ; then
- eerror "You dont appear to have the mysql database installed yet."
- eerror "Please run /usr/bin/mysql_install_db --user=mysql to have this done..."
- return 1
- fi
+ 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/mysql setup' to setup a new database."
+ return 1
+ fi
+ setup
}
start() {
- checkconfig || return 1
- ebegin "Starting mysqld"
- /usr/bin/mysqld_safe --defaults-file=/etc/mysql/my.cnf >/dev/null 2>&1 &
- eend $?
+ checkconfig || return 1
+ ebegin "Starting mysqld"
+ start-stop-daemon --pidfile $pidfile \
+ --start \
+ --background \
+ --stdout /dev/null \
+ --stderr /dev/null \
+ --wait 500 \
+ -- \
+ /usr/bin/mysqld_safe --pid-file=$pidfile
+ eend $?
}
stop () {
- ebegin "Stopping mysqld"
- start-stop-daemon --stop --quiet \
- --pidfile=/var/run/mysqld/mysqld.pid --retry 20
- eend $?
+ ebegin "Stopping mysqld"
+ start-stop-daemon --stop --quiet \
+ --pidfile $pidfile --retry 20
+ eend $?
}
-