Bug #278633: add in support for mysql root password from secure config file.
authorRobin H. Johnson <robbat2@gentoo.org>
Wed, 24 Mar 2010 03:45:56 +0000 (03:45 +0000)
committerRobin H. Johnson <robbat2@gentoo.org>
Wed, 24 Mar 2010 03:45:56 +0000 (03:45 +0000)
eclass/mysql.eclass

index 71613663bd47b5d677384e297c4d5364a0518a92..9ab804c2872176f6a4aaaa55d58920d16d40a7d5 100644 (file)
@@ -1,6 +1,6 @@
 # Copyright 1999-2009 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/mysql.eclass,v 1.140 2010/03/24 03:09:08 robbat2 Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/mysql.eclass,v 1.141 2010/03/24 03:45:56 robbat2 Exp $
 
 # @ECLASS: mysql.eclass
 # @MAINTAINER:
@@ -1109,6 +1109,10 @@ mysql_pkg_config() {
        local MYSQL_ROOT_PASSWORD=''
        local maxtry=15
 
+       if [ -z "${MYSQL_ROOT_PASSWORD}" -a -f "${ROOT}/root/.my.cnf" ]; then
+               MYSQL_ROOT_PASSWORD="$(sed -n -e '/^password=/s,^password=,,gp' "${ROOT}/root/.my.cnf")"
+       fi
+
        if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then
                ewarn "You have already a MySQL database in place."
                ewarn "(${ROOT}/${MY_DATADIR}/*)"