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

Diff of /eclass/mysql.eclass

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

Revision 1.10 Revision 1.12
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.10 2006/01/24 23:56:01 vivo Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/Attic/mysql.eclass,v 1.12 2006/01/31 19:47:50 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
427 "${FILESDIR}/my.cnf-4.1-r1" \ 427 "${FILESDIR}/my.cnf-4.1-r1" \
428 > "${TMPDIR}/my.cnf.ok" 428 > "${TMPDIR}/my.cnf.ok"
429 newins "${TMPDIR}/my.cnf.ok" my.cnf 429 newins "${TMPDIR}/my.cnf.ok" my.cnf
430 430
431 insinto "/etc/conf.d" 431 insinto "/etc/conf.d"
432 newins "${FILESDIR}/mysql-slot.conf.d-r2" "mysql" 432 newins "${FILESDIR}/mysql-slot.conf.d-r1" "mysql"
433 mysql_version_is_at_least "5.00.11.00" \ 433 mysql_version_is_at_least "5.00.11.00" \
434 && newins "${FILESDIR}/mysqlmanager-slot.conf.d" "mysqlmanager" 434 && newins "${FILESDIR}/mysqlmanager-slot.conf.d" "mysqlmanager"
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}!g" \ 444 sed -e "s!___MY_SUFFIX___!${MY_SUFFIX}!g" \
489 "${D}/usr/share/mysql${MY_SUFFIX}/fill_help_tables.sql" 488 "${D}/usr/share/mysql${MY_SUFFIX}/fill_help_tables.sql"
490} 489}
491 490
492mysql_pkg_preinst() { 491mysql_pkg_preinst() {
493 492
494 enewgroup mysql 60 || die "problem adding group mysql"
495 enewuser mysql 60 -1 /dev/null mysql \
496 || die "problem adding user mysql"
497}
498
499mysql_pkg_postinst() {
500
501 mysql_init_vars
502 mysql_lib_symlinks
503
504 # mind at FEATURES=collision-protect before to remove this
505 [ -d "${ROOT}/var/log/mysql" ] \
506 || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}"
507
508 #secure the logfiles... does this bother anybody?
509 touch "${ROOT}${MY_LOGDIR}"/mysql.{log,err}
510 chown mysql:mysql "${ROOT}${MY_LOGDIR}"/mysql*
511 chmod 0660 "${ROOT}${MY_LOGDIR}"/mysql*
512
513 # create a list of files, to be used 493 # create a list of files, to be used
514 # by external utilities 494 # by external utilities
515 # uncompressed because of the small size 495 # will be used in pkg_postinst
516 local filelist="${ROOT}/var/lib/eselect/mysql/mysql${MY_SUFFIX}" 496 local filelist="${TMPDIR}/FILELIST"
517 pushd "${D}/" &>/dev/null 497 pushd "${D}/" &>/dev/null
518 mkdir -p "${ROOT}/var/lib/eselect/mysql/" 498 mkdir -p "${ROOT}/var/lib/eselect/mysql/"
519 env -i find usr/bin/ usr/sbin/ usr/share/man \ 499 env -i find usr/bin/ usr/sbin/ usr/share/man \
520 -type f -name "*${MY_SUFFIX}*" \ 500 -type f -name "*${MY_SUFFIX}*" \
521 -and -not -name "mysql_config${MY_SUFFIX}" \ 501 -and -not -name "mysql_config${MY_SUFFIX}" \
522 > "${filelist}.filelist" 502 > "${filelist}"
523 echo "${MY_SYSCONFDIR#"/"}" >> "${filelist}.filelist" 503 echo "${MY_SYSCONFDIR#"/"}" >> "${filelist}"
524 echo "${MY_LIBDIR#"/"}" >> "${filelist}.filelist" 504 echo "${MY_LIBDIR#"/"}" >> "${filelist}"
525 echo "${MY_SHAREDSTATEDIR#"/"}" >> "${filelist}.filelist" 505 echo "${MY_SHAREDSTATEDIR#"/"}" >> "${filelist}"
526 popd &>/dev/null 506 popd &>/dev/null
507
508 enewgroup mysql 60 || die "problem adding group mysql"
509 enewuser mysql 60 -1 /dev/null mysql \
510 || die "problem adding user mysql"
511}
512
513mysql_pkg_postinst() {
514
515 mysql_init_vars
516 mysql_lib_symlinks
517
518 # mind at FEATURES=collision-protect before to remove this
519 [ -d "${ROOT}/var/log/mysql" ] \
520 || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}"
521
522 #secure the logfiles... does this bother anybody?
523 touch "${ROOT}${MY_LOGDIR}"/mysql.{log,err}
524 chown mysql:mysql "${ROOT}${MY_LOGDIR}"/mysql*
525 chmod 0660 "${ROOT}${MY_LOGDIR}"/mysql*
526
527 # list of files, to be used
528 # by external utilities
529 mkdir -p "${ROOT}/var/lib/eselect/mysql/"
530 cp "${TMPDIR}/FILELIST" "${ROOT}/var/lib/eselect/mysql/mysql${MY_SUFFIX}"
527 531
528 if ! useq minimal; then 532 if ! useq minimal; then
529 if [[ ${SLOT} -gt 0 ]] ; then 533 if [[ ${SLOT} -gt 0 ]] ; then
530 if [[ -f "${ROOT}/usr/sbin/mysqld" ]] ; then 534 if [[ -f "${ROOT}/usr/sbin/mysqld" ]] ; then
531 einfo "you may want to run unmerge any unslotted MySQL versions with " 535 einfo "you may want to read:"
532 einfo "emerge -C --pretend dev-db/mysql" 536 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 537 else
537 local tmpres="$( eselect mysql show )" 538 local tmpres="$( eselect mysql show )"
538 # "like grep -q unset" 539 # "like grep -q unset"
539 if [[ "{$tmpres}" == "{$tmpres/unset/}" ]] ; then 540 if [[ "{$tmpres}" == "{$tmpres/unset/}" ]] ; then
540 eselect mysql set 1 541 eselect mysql set 1

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

  ViewVC Help
Powered by ViewVC 1.1.20