grknight    14/09/15 14:17:12

  Modified:             init.d-2.0
  Log:
  Revision bump.  Update checkconfig section to accept alternate 
configurations. Thanks to László Szalma <[email protected]> for the input. wrt 
bug 522766
  
  (Portage version: 2.2.12/cvs/Linux x86_64, signed Manifest commit with key 
67C78E1D)

Revision  Changes    Path
1.2                  dev-db/mysql-init-scripts/files/init.d-2.0

file : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/mysql-init-scripts/files/init.d-2.0?rev=1.2&view=markup
plain: 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/mysql-init-scripts/files/init.d-2.0?rev=1.2&content-type=text/plain
diff : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/mysql-init-scripts/files/init.d-2.0?r1=1.1&r2=1.2

Index: init.d-2.0
===================================================================
RCS file: /var/cvsroot/gentoo-x86/dev-db/mysql-init-scripts/files/init.d-2.0,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- init.d-2.0  21 Aug 2014 03:08:13 -0000      1.1
+++ init.d-2.0  15 Sep 2014 14:17:12 -0000      1.2
@@ -1,7 +1,7 @@
 #!/sbin/runscript
 # Copyright 1999-2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: 
/var/cvsroot/gentoo-x86/dev-db/mysql-init-scripts/files/init.d-2.0,v 1.1 
2014/08/21 03:08:13 grknight Exp $
+# $Header: 
/var/cvsroot/gentoo-x86/dev-db/mysql-init-scripts/files/init.d-2.0,v 1.2 
2014/09/15 14:17:12 grknight Exp $
 
 extra_commands="checkconfig"
 
@@ -134,19 +134,26 @@
 }
 
 checkconfig() {
-       local basedir=$(get_config "${MY_CNF}" basedir | tail -n1)
-       ebegin "Checking mysqld configuration"
-
-       # Suppress output to check the return value
-       "${basedir}"/sbin/mysqld --help --verbose &> /dev/null
-
-       # If the above command does not return 0,
-       # then there is an error to echo to the user
-       if [ $? -ne 0 ] ; then
-               "${basedir}"/sbin/mysqld --help --verbose > /dev/null
+       local my_cnf="${MY_CNF:-/etc/${SVCNAME}/my.cnf}"
+       local basedir=$(get_config "${my_cnf}" basedir | tail -n1)
+       local svc_name=$(mysql_svcname)
+       ebegin "Checking mysqld configuration for ${svc_name}"
+
+       if [ ${RC_CMD} == "checkconfig" ] ; then
+               # We are calling checkconfig specifically.  Print warnings 
regardless.
+               "${basedir}"/sbin/mysqld --defaults-file="${my_cnf}" --help 
--verbose > /dev/null
+       else
+               # Suppress output to check the return value
+               "${basedir}"/sbin/mysqld --defaults-file="${my_cnf}" --help 
--verbose > /dev/null 2>&1
+
+               # If the above command does not return 0,
+               # then there is an error to echo to the user
+               if [ $? -ne 0 ] ; then
+                       "${basedir}"/sbin/mysqld --defaults-file="${my_cnf}" 
--help --verbose > /dev/null
+               fi
        fi
 
-       eend $? "MySQL config check failed"
+       eend $? "${svc_name} config check failed"
 }
 
 # vim: filetype=gentoo-init-d sw=2 ts=2 sts=2 noet:




Reply via email to