From a05b905d05654d967c2110a8cf689dae151fa9ff Mon Sep 17 00:00:00 2001 From: nico Date: Wed, 16 Nov 2011 09:44:18 +0000 Subject: [PATCH] packages/mysql: use new service functions git-svn-id: svn://svn.openwrt.org/openwrt/packages@29176 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- libs/mysql/Makefile | 4 ++-- libs/mysql/files/mysqld.init | 27 ++++++++++++++------------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/libs/mysql/Makefile b/libs/mysql/Makefile index eeecfb0ca..ed1f1c606 100644 --- a/libs/mysql/Makefile +++ b/libs/mysql/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2006-2010 OpenWrt.org +# Copyright (C) 2006-2011 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mysql PKG_VERSION:=5.1.53 -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=\ diff --git a/libs/mysql/files/mysqld.init b/libs/mysql/files/mysqld.init index 693dade6c..48e61896e 100644 --- a/libs/mysql/files/mysqld.init +++ b/libs/mysql/files/mysqld.init @@ -1,29 +1,30 @@ #!/bin/sh /etc/rc.common -# Copyright (C) 2010 OpenWrt.org +# Copyright (C) 2010-2011 OpenWrt.org START=95 STOP=10 -PID=/var/run/mysqld.pid -CMD=/usr/bin/mysqld +SERVICE_DAEMONIZE=1 +SERVICE_WRITE_PID=1 +SERVICE_STOP_TIME=9 + +error() { + echo "${initscript}:" "$@" 1>&2 +} start() { local datadir=$(sed -n -e "s/^[[:space:]]*datadir[[:space:]]*=[[:space:]]*[\"']\?\([^\"']*\)[\"']\?/\1/p" /etc/my.cnf) if [ ! -d "$datadir" ]; then - echo "Error: datadir in /etc/my.cnf ($datadir) doesn't exist" + error "Error: datadir '$datadir' in /etc/my.cnf doesn't exist" return 1 - elif [ ! -f "$datadir/mysql/tables_priv.MYD" ]; then - echo "Error: I didn't detect a privileges table, you might need to run mysql_install_db --force to initialize the system tables" + fi + if [ ! -f "$datadir/mysql/tables_priv.MYD" ]; then + error "Error: I didn't detect a privileges table, you might need to run mysql_install_db --force to initialize the system tables" return 1 - else - echo -n "Starting MySQL daemon... " - start-stop-daemon -x $CMD -b -S -- --pid-file=$PID - echo "done" fi + service_start /usr/bin/mysqld } stop() { - echo -n "Stopping MySQL daemon... " - service_kill ${CMD##*/} $PID - echo "done" + service_stop /usr/bin/mysqld } -- 2.11.0