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

Diff of /eclass/mysql.eclass

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

Revision 1.8 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.8 2006/01/24 19:14:00 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 8inherit eutils flag-o-matic gnuconfig mysql_fx
9 9
10#major, minor only in the slot 10#major, minor only in the slot
11SLOT=$(( ${MYSQL_VERSION_ID} / 10000 )) 11SLOT=$(( ${MYSQL_VERSION_ID} / 10000 ))
12 12
13# shorten the path because the socket path length must be shorter than 107 chars 13# shorten the path because the socket path length must be shorter than 107 chars
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"
420 fi 420 fi
421 421
422 # config stuff 422 # config stuff
423 insinto "${MY_SYSCONFDIR}" 423 insinto "${MY_SYSCONFDIR}"
424 doins scripts/mysqlaccess.conf 424 doins scripts/mysqlaccess.conf
425 sed -e "s!@MY_SUFFIX@!${MY_SUFFIX}!g" \
426 -e "s!@DATADIR@!${DATADIR}!g" \
427 "${FILESDIR}/my.cnf-4.1-r1" \
428 > "${TMPDIR}/my.cnf.ok"
425 newins "${FILESDIR}/my.cnf-4.1-r1" my.cnf 429 newins "${TMPDIR}/my.cnf.ok" my.cnf
430
426 insinto "/etc/conf.d" 431 insinto "/etc/conf.d"
427 newins "${FILESDIR}/mysql-slot.conf.d-r2" "mysql" 432 newins "${FILESDIR}/mysql-slot.conf.d-r1" "mysql"
428 mysql_version_is_at_least "5.00.11.00" \ 433 mysql_version_is_at_least "5.00.11.00" \
429 && newins "${FILESDIR}/mysqlmanager-slot.conf.d" "mysqlmanager" 434 && newins "${FILESDIR}/mysqlmanager-slot.conf.d" "mysqlmanager"
430
431 sed --in-place \
432 -e "s/@MY_SUFFIX@/${MY_SUFFIX}/" \
433 -e "s/@DATADIR@/${DATADIR}/" \
434 "${D}/etc/mysql${MY_SUFFIX}/my.cnf"
435 435
436 # minimal builds don't have the server 436 # minimal builds don't have the server
437 if ! useq minimal; then 437 if ! useq minimal; then
438 exeinto /etc/init.d 438 exeinto /etc/init.d
439 newexe "${FILESDIR}/mysql-slot.rc6-r2" "mysql" 439 newexe "${FILESDIR}/mysql-slot.rc6-r3" "mysql"
440 [[ ${SLOT} -gt 0 ]] && dosym "/etc/init.d/mysql" "/etc/init.d/mysql${MY_SUFFIX}"
441 440
442 mysql_version_is_at_least "5.00.11.00" \ 441 mysql_version_is_at_least "5.00.11.00" \
443 && newexe "${FILESDIR}/mysqlmanager-slot.rc6" "mysqlmanager" 442 && newexe "${FILESDIR}/mysqlmanager-slot.rc6" "mysqlmanager"
444 insinto /etc/logrotate.d 443 insinto /etc/logrotate.d
445 sed -e "s!___MY_SUFFIX___!${MY_SUFFIX}!" \ 444 sed -e "s!___MY_SUFFIX___!${MY_SUFFIX}!g" \
446 "${FILESDIR}/logrotate-slot.mysql" \ 445 "${FILESDIR}/logrotate-slot.mysql" \
447 > "${TMPDIR}/logrotate.mysql" 446 > "${TMPDIR}/logrotate.mysql"
448 newins "${TMPDIR}/logrotate.mysql" "mysql${MY_SUFFIX}" 447 newins "${TMPDIR}/logrotate.mysql" "mysql${MY_SUFFIX}"
449 448
450 #empty dirs... 449 #empty dirs...
485 # oops, temporary fix 484 # oops, temporary fix
486 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" \
487 && cp -f \ 486 && cp -f \
488 "${WORKDIR}/mysql-extras/fill_help_tables.sql-5.0" \ 487 "${WORKDIR}/mysql-extras/fill_help_tables.sql-5.0" \
489 "${D}/usr/share/mysql${MY_SUFFIX}/fill_help_tables.sql" 488 "${D}/usr/share/mysql${MY_SUFFIX}/fill_help_tables.sql"
489
490 # MOVED HERE DUE TO BUG #121445
491 # create a list of files, to be used
492 # by external utilities
493 mkdir -p "${D}/var/lib/eselect/mysql/"
494 local filelist="${D}/var/lib/eselect/mysql/mysql${MY_SUFFIX}.filelist"
495 pushd "${D}/" &>/dev/null
496 env -i find usr/bin/ usr/sbin/ usr/share/man \
497 -type f -name "*${MY_SUFFIX}*" \
498 -and -not -name "mysql_config${MY_SUFFIX}" \
499 > "${filelist}"
500 echo "${MY_SYSCONFDIR#"/"}" >> "${filelist}"
501 echo "${MY_LIBDIR#"/"}" >> "${filelist}"
502 echo "${MY_SHAREDSTATEDIR#"/"}" >> "${filelist}"
503 popd &>/dev/null
504
490} 505}
491 506
492mysql_pkg_preinst() { 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
493 523
494 enewgroup mysql 60 || die "problem adding group mysql" 524 enewgroup mysql 60 || die "problem adding group mysql"
495 enewuser mysql 60 -1 /dev/null mysql \ 525 enewuser mysql 60 -1 /dev/null mysql \
496 || die "problem adding user mysql" 526 || die "problem adding user mysql"
497} 527}
508 #secure the logfiles... does this bother anybody? 538 #secure the logfiles... does this bother anybody?
509 touch "${ROOT}${MY_LOGDIR}"/mysql.{log,err} 539 touch "${ROOT}${MY_LOGDIR}"/mysql.{log,err}
510 chown mysql:mysql "${ROOT}${MY_LOGDIR}"/mysql* 540 chown mysql:mysql "${ROOT}${MY_LOGDIR}"/mysql*
511 chmod 0660 "${ROOT}${MY_LOGDIR}"/mysql* 541 chmod 0660 "${ROOT}${MY_LOGDIR}"/mysql*
512 542
513 # create a list of files, to be used 543 ## list of files, to be used
514 # by external utilities 544 ## by external utilities
515 # uncompressed because of the small size
516 local filelist="${ROOT}/var/lib/eselect/mysql/mysql${MY_SUFFIX}"
517 pushd "${D}/" &>/dev/null
518 mkdir -p "${ROOT}/var/lib/eselect/mysql/" 545 #mkdir -p "${ROOT}/var/lib/eselect/mysql/"
519 env -i find usr/bin/ usr/sbin/ usr/share/man \ 546 #cp "${TMPDIR}/FILELIST" "${ROOT}/var/lib/eselect/mysql/mysql${MY_SUFFIX}.filelist"
520 -type f -name "*${MY_SUFFIX}*" \
521 -and -not -name "mysql_config${MY_SUFFIX}" \
522 > "${filelist}.filelist"
523 echo "${MY_SYSCONFDIR#"/"}" >> "${filelist}.filelist"
524 echo "${MY_LIBDIR#"/"}" >> "${filelist}.filelist"
525 echo "${MY_SHAREDSTATEDIR#"/"}" >> "${filelist}.filelist"
526 popd &>/dev/null
527 547
528 if ! useq minimal; then 548 if ! useq minimal; then
529 if [[ ${SLOT} -gt 0 ]] ; then 549 if [[ ${SLOT} -gt 0 ]] ; then
530 if [[ -f "${ROOT}/usr/sbin/mysqld" ]] ; then 550 #if [[ -f "${ROOT}/usr/sbin/mysqld" ]] ; then
531 einfo "you may want to run unmerge any unslotted MySQL versions with " 551 einfo "you may want to read:"
532 einfo "emerge -C --pretend dev-db/mysql" 552 einfo "http://www.gentoo.org/doc/en/mysql-upgrade-slotted.xml"
533 einfo "emerge -C =dev-db/mysql-X.Y.Z"
534 einfo "After the unmerge run \"eselect myqsl list\" followed by a "
535 einfo "\"eselect myqsl set 1\" to chose the default mysql server"
536 else 553 #else
537 local tmpres="$( eselect mysql show )" 554 # local tmpres="$( eselect mysql show )"
538 # "like grep -q unset" 555 # # "like grep -q unset"
539 if [[ "{$tmpres}" == "{$tmpres/unset/}" ]] ; then 556 # if [[ "{$tmpres}" == "{$tmpres/unset/}" ]] ; then
540 eselect mysql set 1 557 # eselect mysql set 1
541 else 558 # else
542 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"
543 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 "
544 einfo "\"eselect myqsl set 1\" to chose the default mysql server" 561 einfo "\"eselect myqsl set 1\" to chose the default mysql server"
545 fi 562 # fi
546 fi 563 #fi
547 fi 564 fi
548 565
549 # your friendly public service announcement... 566 # your friendly public service announcement...
550 einfo 567 einfo
551 einfo "You might want to run:" 568 einfo "You might want to run:"
616 if [[ -r "${help_tables}" ]] ; then 633 if [[ -r "${help_tables}" ]] ; then
617 cat "${help_tables}" >> "${sqltmp}" 634 cat "${help_tables}" >> "${sqltmp}"
618 fi 635 fi
619 fi 636 fi
620 637
621 local socket=${ROOT}/var/run/mysqld/mysqld${MY_SUFFIX}${RANDOM}.sock 638 local socket=${ROOT}/var/run/mysqld/mysqld${RANDOM}.sock
622 local pidfile=${ROOT}/var/run/mysqld/mysqld${MY_SUFFIX}${RANDOM}.sock 639 local pidfile=${ROOT}/var/run/mysqld/mysqld${MY_SUFFIX}${RANDOM}.pid
623 local mysqld="${ROOT}/usr/sbin/mysqld${MY_SUFFIX} \ 640 local mysqld="${ROOT}/usr/sbin/mysqld${MY_SUFFIX} \
624 ${options} \ 641 ${options} \
625 --user=mysql \ 642 --user=mysql \
626 --skip-grant-tables \ 643 --skip-grant-tables \
627 --basedir=${ROOT}/usr \ 644 --basedir=${ROOT}/usr \
662 einfo "stopping the server," 679 einfo "stopping the server,"
663 wait %1 680 wait %1
664 einfo "done" 681 einfo "done"
665} 682}
666 683
684mysql_pkg_prerm() {
685 # external program
686 eselect mysql slot_remove "${SLOT}"
687}
688
667mysql_pkg_postrm() { 689mysql_pkg_postrm() {
668 mysql_lib_symlinks 690 mysql_lib_symlinks
669 if [[ ${SLOT} -gt 0 ]] ; then 691 if [[ ${SLOT} -gt 0 ]] ; then
670 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 "
671 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.8  
changed lines
  Added in v.1.16

  ViewVC Help
Powered by ViewVC 1.1.20