/[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.16
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.16 2006/02/08 21:25:53 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>
353 --enable-local-infile \ 353 --enable-local-infile \
354 --with-mysqld-user=mysql \ 354 --with-mysqld-user=mysql \
355 --with-client-ldflags=-lstdc++ \ 355 --with-client-ldflags=-lstdc++ \
356 --enable-thread-safe-client \ 356 --enable-thread-safe-client \
357 --with-comment="Gentoo Linux ${PF}" \ 357 --with-comment="Gentoo Linux ${PF}" \
358 --with-unix-socket-path="/var/run/mysqld/mysqld${MY_SUFFIX}.sock" \ 358 --with-unix-socket-path="/var/run/mysqld/mysqld.sock" \
359 --with-zlib-dir=/usr \ 359 --with-zlib-dir=/usr \
360 --with-lib-ccflags="-fPIC" \ 360 --with-lib-ccflags="-fPIC" \
361 --without-readline \ 361 --without-readline \
362 --without-docs \ 362 --without-docs \
363 ${myconf} || die "bad ./configure" 363 ${myconf} || die "bad ./configure"
484 # oops, temporary fix 484 # oops, temporary fix
485 mysql_check_version_range "5.00.16.00 to 5.00.18.99" \ 485 mysql_check_version_range "5.00.16.00 to 5.00.18.99" \
486 && cp -f \ 486 && cp -f \
487 "${WORKDIR}/mysql-extras/fill_help_tables.sql-5.0" \ 487 "${WORKDIR}/mysql-extras/fill_help_tables.sql-5.0" \
488 "${D}/usr/share/mysql${MY_SUFFIX}/fill_help_tables.sql" 488 "${D}/usr/share/mysql${MY_SUFFIX}/fill_help_tables.sql"
489}
490 489
491mysql_pkg_preinst() { 490 # MOVED HERE DUE TO BUG #121445
492
493 # create a list of files, to be used 491 # create a list of files, to be used
494 # by external utilities 492 # by external utilities
495 # will be used in pkg_postinst 493 mkdir -p "${D}/var/lib/eselect/mysql/"
496 local filelist="${TMPDIR}/FILELIST" 494 local filelist="${D}/var/lib/eselect/mysql/mysql${MY_SUFFIX}.filelist"
497 pushd "${D}/" &>/dev/null 495 pushd "${D}/" &>/dev/null
498 mkdir -p "${ROOT}/var/lib/eselect/mysql/"
499 env -i find usr/bin/ usr/sbin/ usr/share/man \ 496 env -i find usr/bin/ usr/sbin/ usr/share/man \
500 -type f -name "*${MY_SUFFIX}*" \ 497 -type f -name "*${MY_SUFFIX}*" \
501 -and -not -name "mysql_config${MY_SUFFIX}" \ 498 -and -not -name "mysql_config${MY_SUFFIX}" \
502 > "${filelist}" 499 > "${filelist}"
503 echo "${MY_SYSCONFDIR#"/"}" >> "${filelist}" 500 echo "${MY_SYSCONFDIR#"/"}" >> "${filelist}"
504 echo "${MY_LIBDIR#"/"}" >> "${filelist}" 501 echo "${MY_LIBDIR#"/"}" >> "${filelist}"
505 echo "${MY_SHAREDSTATEDIR#"/"}" >> "${filelist}" 502 echo "${MY_SHAREDSTATEDIR#"/"}" >> "${filelist}"
506 popd &>/dev/null 503 popd &>/dev/null
507 504
505}
506
507mysql_pkg_preinst() {
508
509 ## create a list of files, to be used
510 ## by external utilities
511 ## will be used in pkg_postinst
512 #local filelist="${TMPDIR}/FILELIST"
513 #pushd "${D}/" &>/dev/null
514 # mkdir -p "${ROOT}/var/lib/eselect/mysql/"
515 # env -i find usr/bin/ usr/sbin/ usr/share/man \
516 # -type f -name "*${MY_SUFFIX}*" \
517 # -and -not -name "mysql_config${MY_SUFFIX}" \
518 # > "${filelist}"
519 # echo "${MY_SYSCONFDIR#"/"}" >> "${filelist}"
520 # echo "${MY_LIBDIR#"/"}" >> "${filelist}"
521 # echo "${MY_SHAREDSTATEDIR#"/"}" >> "${filelist}"
522 #popd &>/dev/null
523
508 enewgroup mysql 60 || die "problem adding group mysql" 524 enewgroup mysql 60 || die "problem adding group mysql"
509 enewuser mysql 60 -1 /dev/null mysql \ 525 enewuser mysql 60 -1 /dev/null mysql \
510 || die "problem adding user mysql" 526 || die "problem adding user mysql"
511} 527}
512 528
522 #secure the logfiles... does this bother anybody? 538 #secure the logfiles... does this bother anybody?
523 touch "${ROOT}${MY_LOGDIR}"/mysql.{log,err} 539 touch "${ROOT}${MY_LOGDIR}"/mysql.{log,err}
524 chown mysql:mysql "${ROOT}${MY_LOGDIR}"/mysql* 540 chown mysql:mysql "${ROOT}${MY_LOGDIR}"/mysql*
525 chmod 0660 "${ROOT}${MY_LOGDIR}"/mysql* 541 chmod 0660 "${ROOT}${MY_LOGDIR}"/mysql*
526 542
527 # list of files, to be used 543 ## list of files, to be used
528 # by external utilities 544 ## by external utilities
529 mkdir -p "${ROOT}/var/lib/eselect/mysql/" 545 #mkdir -p "${ROOT}/var/lib/eselect/mysql/"
530 cp "${TMPDIR}/FILELIST" "${ROOT}/var/lib/eselect/mysql/mysql${MY_SUFFIX}" 546 #cp "${TMPDIR}/FILELIST" "${ROOT}/var/lib/eselect/mysql/mysql${MY_SUFFIX}.filelist"
531 547
532 if ! useq minimal; then 548 if ! useq minimal; then
533 if [[ ${SLOT} -gt 0 ]] ; then 549 if [[ ${SLOT} -gt 0 ]] ; then
534 if [[ -f "${ROOT}/usr/sbin/mysqld" ]] ; then 550 #if [[ -f "${ROOT}/usr/sbin/mysqld" ]] ; then
535 einfo "you may want to read:" 551 einfo "you may want to read:"
536 einfo "http://www.gentoo.org/doc/en/mysql-upgrade-slotted.xml" 552 einfo "http://www.gentoo.org/doc/en/mysql-upgrade-slotted.xml"
537 else 553 #else
538 local tmpres="$( eselect mysql show )" 554 # local tmpres="$( eselect mysql show )"
539 # "like grep -q unset" 555 # # "like grep -q unset"
540 if [[ "{$tmpres}" == "{$tmpres/unset/}" ]] ; then 556 # if [[ "{$tmpres}" == "{$tmpres/unset/}" ]] ; then
541 eselect mysql set 1 557 # eselect mysql set 1
542 else 558 # else
543 einfo "The version of mysql emerged now stils is _NOT_ the default" 559 # 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 " 560 einfo "you may want to run \"eselect myqsl list\" followed by a "
545 einfo "\"eselect myqsl set 1\" to chose the default mysql server" 561 einfo "\"eselect myqsl set 1\" to chose the default mysql server"
546 fi 562 # fi
547 fi 563 #fi
548 fi 564 fi
549 565
550 # your friendly public service announcement... 566 # your friendly public service announcement...
551 einfo 567 einfo
552 einfo "You might want to run:" 568 einfo "You might want to run:"
617 if [[ -r "${help_tables}" ]] ; then 633 if [[ -r "${help_tables}" ]] ; then
618 cat "${help_tables}" >> "${sqltmp}" 634 cat "${help_tables}" >> "${sqltmp}"
619 fi 635 fi
620 fi 636 fi
621 637
622 local socket=${ROOT}/var/run/mysqld/mysqld${MY_SUFFIX}${RANDOM}.sock 638 local socket=${ROOT}/var/run/mysqld/mysqld${RANDOM}.sock
623 local pidfile=${ROOT}/var/run/mysqld/mysqld${MY_SUFFIX}${RANDOM}.sock 639 local pidfile=${ROOT}/var/run/mysqld/mysqld${MY_SUFFIX}${RANDOM}.pid
624 local mysqld="${ROOT}/usr/sbin/mysqld${MY_SUFFIX} \ 640 local mysqld="${ROOT}/usr/sbin/mysqld${MY_SUFFIX} \
625 ${options} \ 641 ${options} \
626 --user=mysql \ 642 --user=mysql \
627 --skip-grant-tables \ 643 --skip-grant-tables \
628 --basedir=${ROOT}/usr \ 644 --basedir=${ROOT}/usr \
663 einfo "stopping the server," 679 einfo "stopping the server,"
664 wait %1 680 wait %1
665 einfo "done" 681 einfo "done"
666} 682}
667 683
684mysql_pkg_prerm() {
685 # external program
686 eselect mysql slot_remove "${SLOT}"
687}
688
668mysql_pkg_postrm() { 689mysql_pkg_postrm() {
669 mysql_lib_symlinks 690 mysql_lib_symlinks
670 if [[ ${SLOT} -gt 0 ]] ; then 691 if [[ ${SLOT} -gt 0 ]] ; then
671 einfo "you may want to run \"eselect myqsl list\" followed by a " 692 einfo "you may want to run \"eselect myqsl list\" followed by a "
672 einfo "\"eselect myqsl list\" to chose the default mysql server" 693 einfo "\"eselect myqsl list\" to chose the default mysql server"

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

  ViewVC Help
Powered by ViewVC 1.1.20