summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2009-07-06 18:21:18 +0000
committerRobin H. Johnson <robbat2@gentoo.org>2009-07-06 18:21:18 +0000
commit83a578d7a10d77c1ae3922a6507e82be5cef6e84 (patch)
tree9dfd3322bef5e087c29cce5505a2692df38cd4dc /eclass/mysql.eclass
parentMarking tiff-3.8.2-r7 ppc64 and ppc for bug 276339 (diff)
downloadgentoo-2-83a578d7a10d77c1ae3922a6507e82be5cef6e84.tar.gz
gentoo-2-83a578d7a10d77c1ae3922a6507e82be5cef6e84.tar.bz2
gentoo-2-83a578d7a10d77c1ae3922a6507e82be5cef6e84.zip
Bug #212407: Allow for datadir that is changed by user to work better during pkg_config.
Diffstat (limited to 'eclass/mysql.eclass')
-rw-r--r--eclass/mysql.eclass42
1 files changed, 41 insertions, 1 deletions
diff --git a/eclass/mysql.eclass b/eclass/mysql.eclass
index 0a0123ab6d74..837be974cdec 100644
--- a/eclass/mysql.eclass
+++ b/eclass/mysql.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/mysql.eclass,v 1.110 2009/07/06 18:18:00 robbat2 Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/mysql.eclass,v 1.111 2009/07/06 18:21:18 robbat2 Exp $
# Author: Francesco Riosa (Retired) <vivo@gentoo.org>
# Maintainer: MySQL Team <mysql-bugs@gentoo.org>
@@ -189,6 +189,20 @@ mysql_init_vars() {
fi
export PREVIOUS_DATADIR
fi
+ else
+ if [[ ${EBUILD_PHASE} == "config" ]]; then
+ local new_MY_DATADIR
+ new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
+ | sed -ne '/datadir/s|^--datadir=||p' \
+ | tail -n1`
+
+ if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then
+ ewarn "MySQL MY_DATADIR has changed"
+ ewarn "from ${MY_DATADIR}"
+ ewarn "to ${new_MY_DATADIR}"
+ MY_DATADIR="${new_MY_DATADIR}"
+ fi
+ fi
fi
MY_SOURCEDIR=${SERVER_URI##*/}
@@ -760,6 +774,8 @@ mysql_pkg_postinst() {
}
mysql_pkg_config() {
+ local old_MY_DATADIR="${MY_DATADIR}"
+
# Make sure the vars are correctly initialized
mysql_init_vars
@@ -769,6 +785,30 @@ mysql_pkg_config() {
die "Minimal builds do NOT include the MySQL server"
fi
+ if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then
+ local MY_DATADIR_s="$(strip_duplicate_slashes ${ROOT}/${MY_DATADIR})"
+ local old_MY_DATADIR_s="$(strip_duplicate_slashes ${ROOT}/${old_MY_DATADIR})"
+
+ if [[ -d "${old_MY_DATADIR_s}" ]]; then
+ if [[ -d "${MY_DATADIR_s}" ]]; then
+ ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist"
+ ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}"
+ else
+ elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}"
+ mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \
+ || die "Moving MY_DATADIR failed"
+ fi
+ else
+ ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist"
+ if [[ -d "${MY_DATADIR_s}" ]]; then
+ ewarn "Attempting to use ${MY_DATADIR_s}"
+ else
+ eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist"
+ die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}"
+ fi
+ fi
+ fi
+
local pwd1="a"
local pwd2="b"
local maxtry=5