/[gentoo-x86]/eclass/mysql.eclass
Gentoo

Diff of /eclass/mysql.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.110 Revision 1.111
1# Copyright 1999-2007 Gentoo Foundation 1# Copyright 1999-2007 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/mysql.eclass,v 1.110 2009/07/06 18:18:00 robbat2 Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/mysql.eclass,v 1.111 2009/07/06 18:21:18 robbat2 Exp $
4 4
5# Author: Francesco Riosa (Retired) <vivo@gentoo.org> 5# Author: Francesco Riosa (Retired) <vivo@gentoo.org>
6# Maintainer: MySQL Team <mysql-bugs@gentoo.org> 6# Maintainer: MySQL Team <mysql-bugs@gentoo.org>
7# - Luca Longinotti <chtekk@gentoo.org> 7# - Luca Longinotti <chtekk@gentoo.org>
8# - Robin H. Johnson <robbat2@gentoo.org> 8# - Robin H. Johnson <robbat2@gentoo.org>
186 PREVIOUS_DATADIR="yes" 186 PREVIOUS_DATADIR="yes"
187 else 187 else
188 PREVIOUS_DATADIR="no" 188 PREVIOUS_DATADIR="no"
189 fi 189 fi
190 export PREVIOUS_DATADIR 190 export PREVIOUS_DATADIR
191 fi
192 else
193 if [[ ${EBUILD_PHASE} == "config" ]]; then
194 local new_MY_DATADIR
195 new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
196 | sed -ne '/datadir/s|^--datadir=||p' \
197 | tail -n1`
198
199 if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then
200 ewarn "MySQL MY_DATADIR has changed"
201 ewarn "from ${MY_DATADIR}"
202 ewarn "to ${new_MY_DATADIR}"
203 MY_DATADIR="${new_MY_DATADIR}"
204 fi
191 fi 205 fi
192 fi 206 fi
193 207
194 MY_SOURCEDIR=${SERVER_URI##*/} 208 MY_SOURCEDIR=${SERVER_URI##*/}
195 MY_SOURCEDIR=${MY_SOURCEDIR%.tar*} 209 MY_SOURCEDIR=${MY_SOURCEDIR%.tar*}
758 && use berkdb \ 772 && use berkdb \
759 && elog "Berkeley DB support is deprecated and will be removed in future versions!" 773 && elog "Berkeley DB support is deprecated and will be removed in future versions!"
760} 774}
761 775
762mysql_pkg_config() { 776mysql_pkg_config() {
777 local old_MY_DATADIR="${MY_DATADIR}"
778
763 # Make sure the vars are correctly initialized 779 # Make sure the vars are correctly initialized
764 mysql_init_vars 780 mysql_init_vars
765 781
766 [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR" 782 [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR"
767 783
768 if built_with_use ${CATEGORY}/${PN} minimal ; then 784 if built_with_use ${CATEGORY}/${PN} minimal ; then
769 die "Minimal builds do NOT include the MySQL server" 785 die "Minimal builds do NOT include the MySQL server"
786 fi
787
788 if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then
789 local MY_DATADIR_s="$(strip_duplicate_slashes ${ROOT}/${MY_DATADIR})"
790 local old_MY_DATADIR_s="$(strip_duplicate_slashes ${ROOT}/${old_MY_DATADIR})"
791
792 if [[ -d "${old_MY_DATADIR_s}" ]]; then
793 if [[ -d "${MY_DATADIR_s}" ]]; then
794 ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist"
795 ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}"
796 else
797 elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}"
798 mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \
799 || die "Moving MY_DATADIR failed"
800 fi
801 else
802 ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist"
803 if [[ -d "${MY_DATADIR_s}" ]]; then
804 ewarn "Attempting to use ${MY_DATADIR_s}"
805 else
806 eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist"
807 die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}"
808 fi
809 fi
770 fi 810 fi
771 811
772 local pwd1="a" 812 local pwd1="a"
773 local pwd2="b" 813 local pwd2="b"
774 local maxtry=5 814 local maxtry=5

Legend:
Removed from v.1.110  
changed lines
  Added in v.1.111

  ViewVC Help
Powered by ViewVC 1.1.20