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

Diff of /eclass/mysql.eclass

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

Revision 1.12 Revision 1.17
1# Copyright 1999-2005 Gentoo Foundation 1# Copyright 1999-2005 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/Attic/mysql.eclass,v 1.12 2006/01/31 19:47:50 vivo Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/Attic/mysql.eclass,v 1.17 2006/02/09 13:15:43 vivo Exp $
4 4
5# Author: Francesco Riosa <vivo at gentoo.org> 5# Author: Francesco Riosa <vivo at gentoo.org>
6# Maintainer: Francesco Riosa <vivo at gentoo.org> 6# Maintainer: Francesco Riosa <vivo at gentoo.org>
7 7
8inherit eutils flag-o-matic gnuconfig mysql_fx 8inherit eutils flag-o-matic gnuconfig mysql_fx
31&& IUSE="${IUSE} max-idx-128" 31&& IUSE="${IUSE} max-idx-128"
32 32
33mysql_version_is_at_least "5.01.00.00" \ 33mysql_version_is_at_least "5.01.00.00" \
34&& IUSE="${IUSE} innodb" 34&& IUSE="${IUSE} innodb"
35 35
36EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_preinst pkg_postinst pkg_config pkg_postrm 36EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_preinst pkg_postinst pkg_config mysql_pkg_prerm pkg_postrm
37 37
38# void mysql_init_vars() 38# void mysql_init_vars()
39# 39#
40# initialize global variables 40# initialize global variables
41# 2005-11-19 <vivo at gentoo.org> 41# 2005-11-19 <vivo at gentoo.org>
53 MY_LOGDIR=${MY_LOGDIR="/var/log/mysql${MY_SUFFIX}"} 53 MY_LOGDIR=${MY_LOGDIR="/var/log/mysql${MY_SUFFIX}"}
54 MY_INCLUDEDIR=${MY_INCLUDEDIR="/usr/include/mysql${MY_SUFFIX}"} 54 MY_INCLUDEDIR=${MY_INCLUDEDIR="/usr/include/mysql${MY_SUFFIX}"}
55 55
56 if [ -z "${DATADIR}" ]; then 56 if [ -z "${DATADIR}" ]; then
57 DATADIR="" 57 DATADIR=""
58 if [ -f "${SYSCONFDIR}/my.cnf" ] ; then 58 if [ -f "${MY_SYSCONFDIR}/my.cnf" ] ; then
59 DATADIR=`"my_print_defaults${MY_SUFFIX}" mysqld 2>/dev/null | sed -ne '/datadir/s|^--datadir=||p' | tail -n1` 59 DATADIR=`"my_print_defaults${MY_SUFFIX}" mysqld 2>/dev/null | sed -ne '/datadir/s|^--datadir=||p' | tail -n1`
60 if [ -z "${DATADIR}" ]; then 60 if [ -z "${DATADIR}" ]; then
61 if useq "srvdir" ; then 61 if useq "srvdir" ; then
62 DATADIR="/srv/localhost/mysql/datadir" 62 DATADIR="${ROOT}/srv/localhost/mysql${MY_SUFFIX}/datadir"
63 else 63 else
64 DATADIR=`grep ^datadir "${SYSCONFDIR}/my.cnf" | sed -e 's/.*=\s*//'` 64 DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" | sed -e 's/.*=\s*//'`
65 fi 65 fi
66 fi 66 fi
67 fi 67 fi
68 if [ -z "${DATADIR}" ]; then 68 if [ -z "${DATADIR}" ]; then
69 if useq "srvdir" ; then
70 DATADIR="${ROOT}/srv/localhost/mysql${MY_SUFFIX}/datadir"
71 else
69 DATADIR="${MY_LOCALSTATEDIR}" 72 DATADIR="${MY_LOCALSTATEDIR}"
73 fi
70 einfo "Using default DATADIR" 74 einfo "Using default DATADIR"
71 fi 75 fi
72 einfo "MySQL DATADIR is ${DATADIR}" 76 einfo "MySQL DATADIR is ${DATADIR}"
73 77
74 if [ -z "${PREVIOUS_DATADIR}" ] ; then 78 if [ -z "${PREVIOUS_DATADIR}" ] ; then
353 --enable-local-infile \ 357 --enable-local-infile \
354 --with-mysqld-user=mysql \ 358 --with-mysqld-user=mysql \
355 --with-client-ldflags=-lstdc++ \ 359 --with-client-ldflags=-lstdc++ \
356 --enable-thread-safe-client \ 360 --enable-thread-safe-client \
357 --with-comment="Gentoo Linux ${PF}" \ 361 --with-comment="Gentoo Linux ${PF}" \
358 --with-unix-socket-path="/var/run/mysqld/mysqld${MY_SUFFIX}.sock" \ 362 --with-unix-socket-path="/var/run/mysqld/mysqld.sock" \
359 --with-zlib-dir=/usr \ 363 --with-zlib-dir=/usr \
360 --with-lib-ccflags="-fPIC" \ 364 --with-lib-ccflags="-fPIC" \
361 --without-readline \ 365 --without-readline \
362 --without-docs \ 366 --without-docs \
363 ${myconf} || die "bad ./configure" 367 ${myconf} || die "bad ./configure"
484 # oops, temporary fix 488 # oops, temporary fix
485 mysql_check_version_range "5.00.16.00 to 5.00.18.99" \ 489 mysql_check_version_range "5.00.16.00 to 5.00.18.99" \
486 && cp -f \ 490 && cp -f \
487 "${WORKDIR}/mysql-extras/fill_help_tables.sql-5.0" \ 491 "${WORKDIR}/mysql-extras/fill_help_tables.sql-5.0" \
488 "${D}/usr/share/mysql${MY_SUFFIX}/fill_help_tables.sql" 492 "${D}/usr/share/mysql${MY_SUFFIX}/fill_help_tables.sql"
489}
490 493
491mysql_pkg_preinst() { 494 # MOVED HERE DUE TO BUG #121445
492
493 # create a list of files, to be used 495 # create a list of files, to be used
494 # by external utilities 496 # by external utilities
495 # will be used in pkg_postinst 497 mkdir -p "${D}/var/lib/eselect/mysql/"
496 local filelist="${TMPDIR}/FILELIST" 498 local filelist="${D}/var/lib/eselect/mysql/mysql${MY_SUFFIX}.filelist"
497 pushd "${D}/" &>/dev/null 499 pushd "${D}/" &>/dev/null
498 mkdir -p "${ROOT}/var/lib/eselect/mysql/"
499 env -i find usr/bin/ usr/sbin/ usr/share/man \ 500 env -i find usr/bin/ usr/sbin/ usr/share/man \
500 -type f -name "*${MY_SUFFIX}*" \ 501 -type f -name "*${MY_SUFFIX}*" \
501 -and -not -name "mysql_config${MY_SUFFIX}" \ 502 -and -not -name "mysql_config${MY_SUFFIX}" \
502 > "${filelist}" 503 > "${filelist}"
503 echo "${MY_SYSCONFDIR#"/"}" >> "${filelist}" 504 echo "${MY_SYSCONFDIR#"/"}" >> "${filelist}"
504 echo "${MY_LIBDIR#"/"}" >> "${filelist}" 505 echo "${MY_LIBDIR#"/"}" >> "${filelist}"
505 echo "${MY_SHAREDSTATEDIR#"/"}" >> "${filelist}" 506 echo "${MY_SHAREDSTATEDIR#"/"}" >> "${filelist}"
506 popd &>/dev/null 507 popd &>/dev/null
507 508
509}
510
511mysql_pkg_preinst() {
512
513 ## create a list of files, to be used
514 ## by external utilities
515 ## will be used in pkg_postinst
516 #local filelist="${TMPDIR}/FILELIST"
517 #pushd "${D}/" &>/dev/null
518 # mkdir -p "${ROOT}/var/lib/eselect/mysql/"
519 # env -i find usr/bin/ usr/sbin/ usr/share/man \
520 # -type f -name "*${MY_SUFFIX}*" \
521 # -and -not -name "mysql_config${MY_SUFFIX}" \
522 # > "${filelist}"
523 # echo "${MY_SYSCONFDIR#"/"}" >> "${filelist}"
524 # echo "${MY_LIBDIR#"/"}" >> "${filelist}"
525 # echo "${MY_SHAREDSTATEDIR#"/"}" >> "${filelist}"
526 #popd &>/dev/null
527
508 enewgroup mysql 60 || die "problem adding group mysql" 528 enewgroup mysql 60 || die "problem adding group mysql"
509 enewuser mysql 60 -1 /dev/null mysql \ 529 enewuser mysql 60 -1 /dev/null mysql \
510 || die "problem adding user mysql" 530 || die "problem adding user mysql"
511} 531}
512 532
522 #secure the logfiles... does this bother anybody? 542 #secure the logfiles... does this bother anybody?
523 touch "${ROOT}${MY_LOGDIR}"/mysql.{log,err} 543 touch "${ROOT}${MY_LOGDIR}"/mysql.{log,err}
524 chown mysql:mysql "${ROOT}${MY_LOGDIR}"/mysql* 544 chown mysql:mysql "${ROOT}${MY_LOGDIR}"/mysql*
525 chmod 0660 "${ROOT}${MY_LOGDIR}"/mysql* 545 chmod 0660 "${ROOT}${MY_LOGDIR}"/mysql*
526 546
527 # list of files, to be used 547 ## list of files, to be used
528 # by external utilities 548 ## by external utilities
529 mkdir -p "${ROOT}/var/lib/eselect/mysql/" 549 #mkdir -p "${ROOT}/var/lib/eselect/mysql/"
530 cp "${TMPDIR}/FILELIST" "${ROOT}/var/lib/eselect/mysql/mysql${MY_SUFFIX}" 550 #cp "${TMPDIR}/FILELIST" "${ROOT}/var/lib/eselect/mysql/mysql${MY_SUFFIX}.filelist"
531 551
532 if ! useq minimal; then 552 if ! useq minimal; then
533 if [[ ${SLOT} -gt 0 ]] ; then 553 if [[ ${SLOT} -gt 0 ]] ; then
534 if [[ -f "${ROOT}/usr/sbin/mysqld" ]] ; then 554 #if [[ -f "${ROOT}/usr/sbin/mysqld" ]] ; then
535 einfo "you may want to read:" 555 einfo "you may want to read:"
536 einfo "http://www.gentoo.org/doc/en/mysql-upgrade-slotted.xml" 556 einfo "http://www.gentoo.org/doc/en/mysql-upgrade-slotted.xml"
537 else 557 #else
538 local tmpres="$( eselect mysql show )" 558 # local tmpres="$( eselect mysql show )"
539 # "like grep -q unset" 559 # # "like grep -q unset"
540 if [[ "{$tmpres}" == "{$tmpres/unset/}" ]] ; then 560 # if [[ "{$tmpres}" == "{$tmpres/unset/}" ]] ; then
541 eselect mysql set 1 561 # eselect mysql set 1
542 else 562 # else
543 einfo "The version of mysql emerged now stils is _NOT_ the default" 563 # einfo "The version of mysql emerged now stils is _NOT_ the default"
544 einfo "you may want to run \"eselect myqsl list\" followed by a " 564 einfo "you may want to run \"eselect myqsl list\" followed by a "
545 einfo "\"eselect myqsl set 1\" to chose the default mysql server" 565 einfo "\"eselect myqsl set 1\" to chose the default mysql server"
546 fi 566 # fi
547 fi 567 #fi
548 fi 568 fi
549 569
550 # your friendly public service announcement... 570 # your friendly public service announcement...
551 einfo 571 einfo
552 einfo "You might want to run:" 572 einfo "You might want to run:"
617 if [[ -r "${help_tables}" ]] ; then 637 if [[ -r "${help_tables}" ]] ; then
618 cat "${help_tables}" >> "${sqltmp}" 638 cat "${help_tables}" >> "${sqltmp}"
619 fi 639 fi
620 fi 640 fi
621 641
622 local socket=${ROOT}/var/run/mysqld/mysqld${MY_SUFFIX}${RANDOM}.sock 642 local socket=${ROOT}/var/run/mysqld/mysqld${RANDOM}.sock
623 local pidfile=${ROOT}/var/run/mysqld/mysqld${MY_SUFFIX}${RANDOM}.sock 643 local pidfile=${ROOT}/var/run/mysqld/mysqld${MY_SUFFIX}${RANDOM}.pid
624 local mysqld="${ROOT}/usr/sbin/mysqld${MY_SUFFIX} \ 644 local mysqld="${ROOT}/usr/sbin/mysqld${MY_SUFFIX} \
625 ${options} \ 645 ${options} \
626 --user=mysql \ 646 --user=mysql \
627 --skip-grant-tables \ 647 --skip-grant-tables \
628 --basedir=${ROOT}/usr \ 648 --basedir=${ROOT}/usr \
663 einfo "stopping the server," 683 einfo "stopping the server,"
664 wait %1 684 wait %1
665 einfo "done" 685 einfo "done"
666} 686}
667 687
688mysql_pkg_prerm() {
689 # external program
690 eselect mysql slot_remove "${SLOT}"
691}
692
668mysql_pkg_postrm() { 693mysql_pkg_postrm() {
669 mysql_lib_symlinks 694 mysql_lib_symlinks
670 if [[ ${SLOT} -gt 0 ]] ; then 695 if [[ ${SLOT} -gt 0 ]] ; then
671 einfo "you may want to run \"eselect myqsl list\" followed by a " 696 einfo "you may want to run \"eselect myqsl list\" followed by a "
672 einfo "\"eselect myqsl list\" to chose the default mysql server" 697 einfo "\"eselect myqsl list\" to chose the default mysql server"

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

  ViewVC Help
Powered by ViewVC 1.1.20