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

Diff of /eclass/mysql-v2.eclass

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

Revision 1.7 Revision 1.17
1# Copyright 1999-2011 Gentoo Foundation 1# Copyright 1999-2012 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-v2.eclass,v 1.7 2011/08/22 04:46:32 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/mysql-v2.eclass,v 1.17 2012/07/23 10:57:15 jmbsvicetto Exp $
4 4
5# @ECLASS: mysql-v2.eclass 5# @ECLASS: mysql-v2.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# Maintainers: 7# Maintainers:
8# - MySQL Team <mysql-bugs@gentoo.org> 8# - MySQL Team <mysql-bugs@gentoo.org>
13# The mysql-v2.eclass is the base eclass to build the mysql and 13# The mysql-v2.eclass is the base eclass to build the mysql and
14# alternative projects (mariadb) ebuilds. 14# alternative projects (mariadb) ebuilds.
15# This eclass uses the mysql-autotools and mysql-cmake eclasses for the 15# This eclass uses the mysql-autotools and mysql-cmake eclasses for the
16# specific bits related to the build system. 16# specific bits related to the build system.
17# It provides the src_unpack, src_prepare, src_configure, src_compile, 17# It provides the src_unpack, src_prepare, src_configure, src_compile,
18# scr_install, pkg_preinst, pkg_postinst, pkg_config and pkg_postrm 18# src_install, pkg_preinst, pkg_postinst, pkg_config and pkg_postrm
19# phase hooks. 19# phase hooks.
20 20
21# @ECLASS-VARIABLE: BUILD 21# @ECLASS-VARIABLE: BUILD
22# @DESCRIPTION: 22# @DESCRIPTION:
23# Build type of the mysql version 23# Build type of the mysql version
41MYSQL_EXTRAS="" 41MYSQL_EXTRAS=""
42 42
43# @ECLASS-VARIABLE: MYSQL_EXTRAS_VER 43# @ECLASS-VARIABLE: MYSQL_EXTRAS_VER
44# @DESCRIPTION: 44# @DESCRIPTION:
45# The version of the MYSQL_EXTRAS repo to use to build mysql 45# The version of the MYSQL_EXTRAS repo to use to build mysql
46# Use "none" to disable it's use
46[[ "${MY_EXTRAS_VER}" == "live" ]] && MYSQL_EXTRAS="git-2" 47[[ "${MY_EXTRAS_VER}" == "live" ]] && MYSQL_EXTRAS="git-2"
47 48
48inherit eutils flag-o-matic gnuconfig ${MYSQL_EXTRAS} ${BUILD_INHERIT} mysql_fx versionator toolchain-funcs 49inherit eutils flag-o-matic gnuconfig ${MYSQL_EXTRAS} ${BUILD_INHERIT} mysql_fx versionator toolchain-funcs
49 50
50# 51#
51# Supported EAPI versions and export functions 52# Supported EAPI versions and export functions
52# 53#
53 54
54case "${EAPI:-0}" in 55case "${EAPI:-0}" in
55 2|3|4) ;; 56 3|4) ;;
56 *) die "Unsupported EAPI: ${EAPI}" ;; 57 *) die "Unsupported EAPI: ${EAPI}" ;;
57esac 58esac
58 59
59EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_install pkg_preinst pkg_postinst pkg_config pkg_postrm 60EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_install pkg_preinst pkg_postinst pkg_config pkg_postrm
60 61
76# @DESCRIPTION: 77# @DESCRIPTION:
77# Upstream MySQL considers the first two parts of the version number to be the 78# Upstream MySQL considers the first two parts of the version number to be the
78# major version. Upgrades that change major version should always run 79# major version. Upgrades that change major version should always run
79# mysql_upgrade. 80# mysql_upgrade.
80MYSQL_PV_MAJOR="$(get_version_component_range 1-2 ${PV})" 81MYSQL_PV_MAJOR="$(get_version_component_range 1-2 ${PV})"
81
82# Cluster is a special case...
83if [[ "${PN}" == "mysql-cluster" ]]; then
84 case $PV in
85 6.1*|7.0*|7.1*) MYSQL_PV_MAJOR=5.1 ;;
86 esac
87fi
88
89 82
90# @ECLASS-VARIABLE: MYSQL_VERSION_ID 83# @ECLASS-VARIABLE: MYSQL_VERSION_ID
91# @DESCRIPTION: 84# @DESCRIPTION:
92# MYSQL_VERSION_ID will be: 85# MYSQL_VERSION_ID will be:
93# major * 10e6 + minor * 10e4 + micro * 10e2 + gentoo revision number, all [0..99] 86# major * 10e6 + minor * 10e4 + micro * 10e2 + gentoo revision number, all [0..99]
107MYSQL_VERSION_ID=${MYSQL_VERSION_ID##"0"} 100MYSQL_VERSION_ID=${MYSQL_VERSION_ID##"0"}
108 101
109# This eclass should only be used with at least mysql-5.1.50 102# This eclass should only be used with at least mysql-5.1.50
110mysql_version_is_at_least "5.1.50" || die "This eclass should only be used with >=mysql-5.1.50" 103mysql_version_is_at_least "5.1.50" || die "This eclass should only be used with >=mysql-5.1.50"
111 104
112# @ECLASS-VARIABLE: MYSQL_COMMUNITY_FEATURES
113# @DESCRIPTION:
114# Specifiy if community features are available. Possible values are 1 (yes)
115# and 0 (no).
116# Community features are available in mysql-community
117# AND in the re-merged mysql-5.0.82 and newer
118if [ "${PN}" == "mysql-community" -o "${PN}" == "mariadb" ]; then
119 MYSQL_COMMUNITY_FEATURES=1
120elif [ "${MYSQL_PV_MAJOR}" == "5.1" ]; then
121 MYSQL_COMMUNITY_FEATURES=1
122elif mysql_version_is_at_least "5.4.0"; then
123 MYSQL_COMMUNITY_FEATURES=1
124else
125 MYSQL_COMMUNITY_FEATURES=0
126fi
127
128
129# @ECLASS-VARIABLE: XTRADB_VER 105# @ECLASS-VARIABLE: XTRADB_VER
130# @DEFAULT_UNSET 106# @DEFAULT_UNSET
131# @DESCRIPTION: 107# @DESCRIPTION:
132# Version of the XTRADB storage engine 108# Version of the XTRADB storage engine
133 109
138 114
139# Work out the default SERVER_URI correctly 115# Work out the default SERVER_URI correctly
140if [ -z "${SERVER_URI}" ]; then 116if [ -z "${SERVER_URI}" ]; then
141 [ -z "${MY_PV}" ] && MY_PV="${PV//_/-}" 117 [ -z "${MY_PV}" ] && MY_PV="${PV//_/-}"
142 if [ "${PN}" == "mariadb" ]; then 118 if [ "${PN}" == "mariadb" ]; then
143 MARIA_FULL_PV="$(replace_version_separator 3 '-' ${PV})" 119 MARIA_FULL_PV="$(replace_version_separator 3 '-' ${MY_PV})"
144 MARIA_FULL_P="${PN}-${MARIA_FULL_PV}" 120 MARIA_FULL_P="${PN}-${MARIA_FULL_PV}"
145 SERVER_URI=" 121 SERVER_URI="
146 http://ftp.osuosl.org/pub/mariadb/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz 122 http://ftp.osuosl.org/pub/mariadb/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz
147 http://ftp.rediris.es/mirror/MariaDB/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz 123 http://ftp.rediris.es/mirror/MariaDB/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz
148 http://maria.llarian.net/download/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz 124 http://maria.llarian.net/download/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz
149 http://launchpad.net/maria/${MYSQL_PV_MAJOR}/ongoing/+download/${MARIA_FULL_P}.tar.gz 125 http://launchpad.net/maria/${MYSQL_PV_MAJOR}/ongoing/+download/${MARIA_FULL_P}.tar.gz
150 http://mirrors.fe.up.pt/pub/${PN}/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz 126 http://mirrors.fe.up.pt/pub/${PN}/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz
151 http://ftp-stud.hs-esslingen.de/pub/Mirrors/${PN}/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz 127 http://ftp-stud.hs-esslingen.de/pub/Mirrors/${PN}/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz
152 " 128 "
153 # The community and cluster builds are on the mirrors
154 elif [[ "${MYSQL_COMMUNITY_FEATURES}" == "1" || ${PN} == "mysql-cluster" ]] ; then
155 if [[ "${PN}" == "mysql-cluster" ]] ; then
156 URI_DIR="MySQL-Cluster"
157 URI_FILE="mysql-cluster-gpl"
158 else 129 else
159 URI_DIR="MySQL" 130 URI_DIR="MySQL"
160 URI_FILE="mysql" 131 URI_FILE="mysql"
161 fi
162 URI_A="${URI_FILE}-${MY_PV}.tar.gz" 132 URI_A="${URI_FILE}-${MY_PV}.tar.gz"
163 MIRROR_PV=$(get_version_component_range 1-2 ${PV}) 133 MIRROR_PV=$(get_version_component_range 1-2 ${PV})
164 # Recently upstream switched to an archive site, and not on mirrors 134 # Recently upstream switched to an archive site, and not on mirrors
165 SERVER_URI="http://downloads.mysql.com/archives/${URI_FILE}-${MIRROR_PV}/${URI_A} 135 SERVER_URI="http://downloads.mysql.com/archives/${URI_FILE}-${MIRROR_PV}/${URI_A}
166 mirror://mysql/Downloads/${URI_DIR}-${PV%.*}/${URI_A}" 136 mirror://mysql/Downloads/${URI_DIR}-${PV%.*}/${URI_A}"
167 # The (old) enterprise source is on the primary site only
168 elif [ "${PN}" == "mysql" ]; then
169 SERVER_URI="ftp://ftp.mysql.com/pub/mysql/src/mysql-${MY_PV}.tar.gz"
170 fi 137 fi
171fi 138fi
172 139
173# Define correct SRC_URIs 140# Define correct SRC_URIs
174SRC_URI="${SERVER_URI}" 141SRC_URI="${SERVER_URI}"
175 142
176# Gentoo patches to MySQL 143# Gentoo patches to MySQL
177[[ ${MY_EXTRAS_VER} != live ]] \ 144[[ ${MY_EXTRAS_VER} != live ]] && [[ ${MY_EXTRAS_VER} != none ]] \
178&& SRC_URI="${SRC_URI} 145&& SRC_URI="${SRC_URI}
179 mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 146 mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
180 http://g3nt8.org/patches/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 147 http://g3nt8.org/patches/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
181 http://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 148 http://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
182 http://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2" 149 http://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2"
184DESCRIPTION="A fast, multi-threaded, multi-user SQL database server." 151DESCRIPTION="A fast, multi-threaded, multi-user SQL database server."
185HOMEPAGE="http://www.mysql.com/" 152HOMEPAGE="http://www.mysql.com/"
186if [[ "${PN}" == "mariadb" ]]; then 153if [[ "${PN}" == "mariadb" ]]; then
187 HOMEPAGE="http://mariadb.org/" 154 HOMEPAGE="http://mariadb.org/"
188 DESCRIPTION="MariaDB is a MySQL fork with 3rd-party patches and additional storage engines merged." 155 DESCRIPTION="MariaDB is a MySQL fork with 3rd-party patches and additional storage engines merged."
189fi
190if [[ "${PN}" == "mysql-community" ]]; then
191 DESCRIPTION="${DESCRIPTION} (obsolete, move to dev-db/mysql)"
192fi 156fi
193LICENSE="GPL-2" 157LICENSE="GPL-2"
194SLOT="0" 158SLOT="0"
195 159
196case "${BUILD}" in 160case "${BUILD}" in
203esac 167esac
204 168
205IUSE="${IUSE} latin1" 169IUSE="${IUSE} latin1"
206 170
207IUSE="${IUSE} extraengine" 171IUSE="${IUSE} extraengine"
208if [[ ${PN} != "mysql-cluster" ]] ; then
209 IUSE="${IUSE} cluster" 172IUSE="${IUSE} cluster"
210fi
211 173
212IUSE="${IUSE} max-idx-128" 174IUSE="${IUSE} max-idx-128"
213IUSE="${IUSE} berkdb" 175IUSE="${IUSE} berkdb"
214
215[[ ${MYSQL_COMMUNITY_FEATURES} == 1 ]] \
216&& IUSE="${IUSE} +community profiling" 176IUSE="${IUSE} +community profiling"
217 177
218[[ ${PN} == "mariadb" ]] \ 178[[ ${PN} == "mariadb" ]] \
219&& IUSE="${IUSE} libevent" 179&& IUSE="${IUSE} libevent"
220 180
221[[ ${PN} == "mariadb" ]] \ 181[[ ${PN} == "mariadb" ]] \
224 184
225[[ ${PN} == "mariadb" ]] \ 185[[ ${PN} == "mariadb" ]] \
226&& mysql_version_is_at_least "5.2.5" \ 186&& mysql_version_is_at_least "5.2.5" \
227&& IUSE="${IUSE} sphinx" 187&& IUSE="${IUSE} sphinx"
228 188
189mysql_version_is_at_least "5.5.7" \
190&& IUSE="${IUSE} systemtap"
229 191
230# 192#
231# DEPENDENCIES: 193# DEPENDENCIES:
232# 194#
233 195
234# Be warned, *DEPEND are version-dependant 196# Be warned, *DEPEND are version-dependant
235# These are used for both runtime and compiletime 197# These are used for both runtime and compiletime
236DEPEND=" 198DEPEND="
237 ssl? ( >=dev-libs/openssl-0.9.6d ) 199 ssl? ( >=dev-libs/openssl-0.9.6d )
238 userland_GNU? ( sys-process/procps ) 200 kernel_linux? ( sys-process/procps )
239 >=sys-apps/sed-4 201 >=sys-apps/sed-4
240 >=sys-apps/texinfo-4.7-r1 202 >=sys-apps/texinfo-4.7-r1
241 >=sys-libs/readline-4.1 203 >=sys-libs/readline-4.1
242 >=sys-libs/zlib-1.2.3 204 >=sys-libs/zlib-1.2.3
243" 205"
244 206
245[[ ${PN} == mariadb ]] \ 207[[ ${PN} == mariadb ]] \
246&& DEPEND="${DEPEND} libevent? ( >=dev-libs/libevent-1.4 )" 208&& DEPEND="${DEPEND} libevent? ( >=dev-libs/libevent-1.4 )"
247 209
248# Having different flavours at the same time is not a good idea 210# Having different flavours at the same time is not a good idea
249for i in "mysql" "mysql-community" "mysql-cluster" "mariadb" ; do 211for i in "mysql" "mariadb" ; do
250 [[ ${i} == ${PN} ]] || 212 [[ ${i} == ${PN} ]] ||
251 DEPEND="${DEPEND} !dev-db/${i}" 213 DEPEND="${DEPEND} !dev-db/${i}"
252done 214done
253 215
216# prefix: first need to implement something for #196294
254RDEPEND="${DEPEND} 217RDEPEND="${DEPEND}
255 !minimal? ( dev-db/mysql-init-scripts ) 218 !minimal? ( !prefix? ( dev-db/mysql-init-scripts ) )
256 selinux? ( sec-policy/selinux-mysql ) 219 selinux? ( sec-policy/selinux-mysql )
257" 220"
258 221
259DEPEND="${DEPEND} 222DEPEND="${DEPEND}
260 virtual/yacc 223 virtual/yacc
261" 224"
262 225
263DEPEND="${DEPEND} static? ( || ( sys-libs/ncurses[static-libs] <=sys-libs/ncurses-5.7-r3 ) )" 226DEPEND="${DEPEND} static? ( sys-libs/ncurses[static-libs] )"
264 227
265# compile-time-only 228# compile-time-only
266DEPEND="${DEPEND} >=dev-util/cmake-2.4.3" 229DEPEND="${DEPEND} >=dev-util/cmake-2.4.3"
267 230
268# compile-time-only 231# compile-time-only
275 238
276[[ "${PN}" == "mariadb" ]] \ 239[[ "${PN}" == "mariadb" ]] \
277&& mysql_version_is_at_least "5.2.5" \ 240&& mysql_version_is_at_least "5.2.5" \
278&& DEPEND="${DEPEND} sphinx? ( app-misc/sphinx )" 241&& DEPEND="${DEPEND} sphinx? ( app-misc/sphinx )"
279 242
243mysql_version_is_at_least "5.5.7" \
244&& DEPEND="${DEPEND} systemtap? ( >=dev-util/systemtap-1.3 )"
245
280# dev-perl/DBD-mysql is needed by some scripts installed by MySQL 246# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
281PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )" 247PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )"
282 248
283# For other stuff to bring us in 249# For other stuff to bring us in
284PDEPEND="${PDEPEND} =virtual/mysql-${MYSQL_PV_MAJOR}" 250PDEPEND="${PDEPEND} =virtual/mysql-${MYSQL_PV_MAJOR}"
285
286 251
287# 252#
288# External patches 253# External patches
289# 254#
290 255
317 282
318 PBXT_P="pbxt-${PBXT_VERSION}" 283 PBXT_P="pbxt-${PBXT_VERSION}"
319 PBXT_SRC_URI="http://www.primebase.org/download/${PBXT_P}.tar.gz mirror://sourceforge/pbxt/${PBXT_P}.tar.gz" 284 PBXT_SRC_URI="http://www.primebase.org/download/${PBXT_P}.tar.gz mirror://sourceforge/pbxt/${PBXT_P}.tar.gz"
320 SRC_URI="${SRC_URI} pbxt? ( ${PBXT_SRC_URI} )" 285 SRC_URI="${SRC_URI} pbxt? ( ${PBXT_SRC_URI} )"
321 286
287fi
288
322 # PBXT_NEWSTYLE means pbxt is in storage/ and gets enabled as other plugins 289# PBXT_NEWSTYLE means pbxt is in storage/ and gets enabled as other plugins
323 # vs. built outside the dir 290# vs. built outside the dir
324 if pbxt_available; then 291if pbxt_available; then
325 292
326 IUSE="${IUSE} pbxt" 293 IUSE="${IUSE} pbxt"
327 PBXT_NEWSTYLE=1 294 PBXT_NEWSTYLE=1
328 fi
329fi 295fi
330 296
331if xtradb_patch_available; then 297if xtradb_patch_available; then
332 XTRADB_P="percona-xtradb-${XTRADB_VER}" 298 XTRADB_P="percona-xtradb-${XTRADB_VER}"
333 XTRADB_SRC_URI_COMMON="${PERCONA_VER}/source/${XTRADB_P}.tar.gz" 299 XTRADB_SRC_URI_COMMON="${PERCONA_VER}/source/${XTRADB_P}.tar.gz"
378# warn about deprecated features 344# warn about deprecated features
379mysql-v2_pkg_setup() { 345mysql-v2_pkg_setup() {
380 346
381 if has test ${FEATURES} ; then 347 if has test ${FEATURES} ; then
382 if ! use minimal ; then 348 if ! use minimal ; then
383 if [[ $UID -eq 0 ]]; then 349 if ! has userpriv ${FEATURES} ; then
384 eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." 350 eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
385 fi 351 fi
386 fi 352 fi
387 fi 353 fi
388 354
416 382
417 # This should come after all of the die statements 383 # This should come after all of the die statements
418 enewgroup mysql 60 || die "problem adding 'mysql' group" 384 enewgroup mysql 60 || die "problem adding 'mysql' group"
419 enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user" 385 enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user"
420 386
421 if [ "${PN}" != "mysql-cluster" ] && use cluster; then 387 if use cluster; then
422 ewarn "Upstream has noted that the NDB cluster support in the 5.0 and" 388 ewarn "Upstream has noted that the NDB cluster support in the 5.0 and"
423 ewarn "5.1 series should NOT be put into production. In the near" 389 ewarn "5.1 series should NOT be put into production. In the near"
424 ewarn "future, it will be disabled from building." 390 ewarn "future, it will be disabled from building."
425 ewarn ""
426 ewarn "If you need NDB support, you should instead move to the new"
427 ewarn "mysql-cluster package that represents that upstream NDB"
428 ewarn "development."
429 fi 391 fi
430} 392}
431 393
432# @FUNCTION: mysql-v2_src_unpack 394# @FUNCTION: mysql-v2_src_unpack
433# @DESCRIPTION: 395# @DESCRIPTION:
492 454
493 # Make sure the vars are correctly initialized 455 # Make sure the vars are correctly initialized
494 mysql_init_vars 456 mysql_init_vars
495 457
496 # Check FEATURES="collision-protect" before removing this 458 # Check FEATURES="collision-protect" before removing this
497 [[ -d "${ROOT}/var/log/mysql" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}" 459 [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}"
498 460
499 # Secure the logfiles 461 # Secure the logfiles
500 touch "${ROOT}${MY_LOGDIR}"/mysql.{log,err} 462 touch "${ROOT}${MY_LOGDIR}"/mysql.{log,err}
501 chown mysql:mysql "${ROOT}${MY_LOGDIR}"/mysql* 463 chown mysql:mysql "${ROOT}${MY_LOGDIR}"/mysql*
502 chmod 0660 "${ROOT}${MY_LOGDIR}"/mysql* 464 chmod 0660 "${ROOT}${MY_LOGDIR}"/mysql*
594 556
595 local pwd1="a" 557 local pwd1="a"
596 local pwd2="b" 558 local pwd2="b"
597 local maxtry=15 559 local maxtry=15
598 560
599 if [ -z "${MYSQL_ROOT_PASSWORD}" -a -f "${ROOT}/root/.my.cnf" ]; then 561 if [ -z "${MYSQL_ROOT_PASSWORD}" -a -f "${EROOT}/root/.my.cnf" ]; then
600 MYSQL_ROOT_PASSWORD="$(sed -n -e '/^password=/s,^password=,,gp' "${ROOT}/root/.my.cnf")" 562 MYSQL_ROOT_PASSWORD="$(sed -n -e '/^password=/s,^password=,,gp' "${EROOT}/root/.my.cnf")"
601 fi 563 fi
602 564
603 if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then 565 if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then
604 ewarn "You have already a MySQL database in place." 566 ewarn "You have already a MySQL database in place."
605 ewarn "(${ROOT}/${MY_DATADIR}/*)" 567 ewarn "(${ROOT}/${MY_DATADIR}/*)"
636 && cp "${help_tables}" "${TMPDIR}/fill_help_tables.sql" \ 598 && cp "${help_tables}" "${TMPDIR}/fill_help_tables.sql" \
637 || touch "${TMPDIR}/fill_help_tables.sql" 599 || touch "${TMPDIR}/fill_help_tables.sql"
638 help_tables="${TMPDIR}/fill_help_tables.sql" 600 help_tables="${TMPDIR}/fill_help_tables.sql"
639 601
640 pushd "${TMPDIR}" &>/dev/null 602 pushd "${TMPDIR}" &>/dev/null
641 "${ROOT}/usr/bin/mysql_install_db" >"${TMPDIR}"/mysql_install_db.log 2>&1 603 "${EROOT}/usr/bin/mysql_install_db" "--basedir=${EPREFIX}/usr" >"${TMPDIR}"/mysql_install_db.log 2>&1
642 if [ $? -ne 0 ]; then 604 if [ $? -ne 0 ]; then
643 grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2 605 grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2
644 die "Failed to run mysql_install_db. Please review /var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log" 606 die "Failed to run mysql_install_db. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log"
645 fi 607 fi
646 popd &>/dev/null 608 popd &>/dev/null
647 [[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \ 609 [[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \
648 || die "MySQL databases not installed" 610 || die "MySQL databases not installed"
649 chown -R mysql:mysql "${ROOT}/${MY_DATADIR}" 2>/dev/null 611 chown -R mysql:mysql "${ROOT}/${MY_DATADIR}" 2>/dev/null
650 chmod 0750 "${ROOT}/${MY_DATADIR}" 2>/dev/null 612 chmod 0750 "${ROOT}/${MY_DATADIR}" 2>/dev/null
651 613
652 # Figure out which options we need to disable to do the setup 614 # Figure out which options we need to disable to do the setup
653 helpfile="${TMPDIR}/mysqld-help" 615 helpfile="${TMPDIR}/mysqld-help"
654 ${ROOT}/usr/sbin/mysqld --verbose --help >"${helpfile}" 2>/dev/null 616 ${EROOT}/usr/sbin/mysqld --verbose --help >"${helpfile}" 2>/dev/null
655 for opt in grant-tables host-cache name-resolve networking slave-start bdb \ 617 for opt in grant-tables host-cache name-resolve networking slave-start bdb \
656 federated innodb ssl log-bin relay-log slow-query-log external-locking \ 618 federated innodb ssl log-bin relay-log slow-query-log external-locking \
657 ndbcluster \ 619 ndbcluster \
658 ; do 620 ; do
659 optexp="--(skip-)?${opt}" optfull="--skip-${opt}" 621 optexp="--(skip-)?${opt}" optfull="--skip-${opt}"
663 egrep -sq external-locking "${helpfile}" && \ 625 egrep -sq external-locking "${helpfile}" && \
664 options="${options/skip-locking/skip-external-locking}" 626 options="${options/skip-locking/skip-external-locking}"
665 627
666 # Filling timezones, see 628 # Filling timezones, see
667 # http://dev.mysql.com/doc/mysql/en/time-zone-support.html 629 # http://dev.mysql.com/doc/mysql/en/time-zone-support.html
668 "${ROOT}/usr/bin/mysql_tzinfo_to_sql" "${ROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null 630 "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null
669 631
670 if [[ -r "${help_tables}" ]] ; then 632 if [[ -r "${help_tables}" ]] ; then
671 cat "${help_tables}" >> "${sqltmp}" 633 cat "${help_tables}" >> "${sqltmp}"
672 fi 634 fi
673 635
674 einfo "Creating the mysql database and setting proper" 636 einfo "Creating the mysql database and setting proper"
675 einfo "permissions on it ..." 637 einfo "permissions on it ..."
676 638
677 local socket="${ROOT}/var/run/mysqld/mysqld${RANDOM}.sock" 639 local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock"
678 local pidfile="${ROOT}/var/run/mysqld/mysqld${RANDOM}.pid" 640 local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid"
679 local mysqld="${ROOT}/usr/sbin/mysqld \ 641 local mysqld="${EROOT}/usr/sbin/mysqld \
680 ${options} \ 642 ${options} \
681 --user=mysql \ 643 --user=mysql \
682 --basedir=${ROOT}/usr \ 644 --basedir=${EROOT}/usr \
683 --datadir=${ROOT}/${MY_DATADIR} \ 645 --datadir=${ROOT}/${MY_DATADIR} \
684 --max_allowed_packet=8M \ 646 --max_allowed_packet=8M \
685 --net_buffer_length=16K \ 647 --net_buffer_length=16K \
686 --default-storage-engine=MyISAM \ 648 --default-storage-engine=MyISAM \
687 --socket=${socket} \ 649 --socket=${socket} \
702 fi 664 fi
703 665
704 ebegin "Setting root password" 666 ebegin "Setting root password"
705 # Do this from memory, as we don't want clear text passwords in temp files 667 # Do this from memory, as we don't want clear text passwords in temp files
706 local sql="UPDATE mysql.user SET Password = PASSWORD('${MYSQL_ROOT_PASSWORD}') WHERE USER='root'" 668 local sql="UPDATE mysql.user SET Password = PASSWORD('${MYSQL_ROOT_PASSWORD}') WHERE USER='root'"
707 "${ROOT}/usr/bin/mysql" \ 669 "${EROOT}/usr/bin/mysql" \
708 --socket=${socket} \ 670 --socket=${socket} \
709 -hlocalhost \ 671 -hlocalhost \
710 -e "${sql}" 672 -e "${sql}"
711 eend $? 673 eend $?
712 674
713 ebegin "Loading \"zoneinfo\", this step may require a few seconds ..." 675 ebegin "Loading \"zoneinfo\", this step may require a few seconds ..."
714 "${ROOT}/usr/bin/mysql" \ 676 "${EROOT}/usr/bin/mysql" \
715 --socket=${socket} \ 677 --socket=${socket} \
716 -hlocalhost \ 678 -hlocalhost \
717 -uroot \ 679 -uroot \
718 -p"${MYSQL_ROOT_PASSWORD}" \ 680 -p"${MYSQL_ROOT_PASSWORD}" \
719 mysql < "${sqltmp}" 681 mysql < "${sqltmp}"
732# @FUNCTION: mysql-v2_pkg_postrm 694# @FUNCTION: mysql-v2_pkg_postrm
733# @DESCRIPTION: 695# @DESCRIPTION:
734# Remove mysql symlinks. 696# Remove mysql symlinks.
735mysql-v2_pkg_postrm() { 697mysql-v2_pkg_postrm() {
736 698
737 : # mysql_lib_symlinks "${D}" 699 : # mysql_lib_symlinks "${ED}"
738} 700}

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.17

  ViewVC Help
Powered by ViewVC 1.1.20