| 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/mysql.eclass,v 1.14 2006/02/03 08:48:37 vivo Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/mysql.eclass,v 1.25 2006/03/16 20:39:00 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 | |
| 8 | inherit eutils flag-o-matic gnuconfig mysql_fx |
8 | inherit eutils flag-o-matic gnuconfig autotools mysql_fx |
| 9 | |
9 | |
| 10 | #major, minor only in the slot |
10 | #major, minor only in the slot |
| 11 | SLOT=$(( ${MYSQL_VERSION_ID} / 10000 )) |
11 | SLOT=$(( ${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 |
| … | |
… | |
| 16 | |
16 | |
| 17 | DESCRIPTION="A fast, multi-threaded, multi-user SQL database server" |
17 | DESCRIPTION="A fast, multi-threaded, multi-user SQL database server" |
| 18 | HOMEPAGE="http://www.mysql.com/" |
18 | HOMEPAGE="http://www.mysql.com/" |
| 19 | NEWP="${P/_/-}" |
19 | NEWP="${P/_/-}" |
| 20 | SRC_URI="mirror://mysql/Downloads/MySQL-${PV%.*}/${NEWP}.tar.gz |
20 | SRC_URI="mirror://mysql/Downloads/MySQL-${PV%.*}/${NEWP}.tar.gz |
| 21 | mirror://gentoo/mysql-extras-20060115.tar.bz2" |
21 | mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2" |
| 22 | LICENSE="GPL-2" |
22 | LICENSE="GPL-2" |
| 23 | IUSE="big-tables berkdb debug minimal perl selinux srvdir ssl static" |
23 | IUSE="big-tables berkdb debug embedded minimal perl selinux srvdir ssl static" |
| 24 | RESTRICT="primaryuri confcache" |
24 | RESTRICT="primaryuri confcache" |
| 25 | DEPEND="app-admin/eselect-mysql" |
|
|
| 26 | |
25 | |
| 27 | mysql_version_is_at_least "4.01.03.00" \ |
26 | mysql_version_is_at_least "4.01.03.00" \ |
| 28 | && IUSE="${IUSE} cluster extraengine" |
27 | && IUSE="${IUSE} cluster extraengine" |
| 29 | |
28 | |
|
|
29 | mysql_version_is_at_least "5.00.00.00" \ |
|
|
30 | || IUSE="${IUSE} raid" |
|
|
31 | |
| 30 | mysql_version_is_at_least "5.00.18.00" \ |
32 | mysql_version_is_at_least "5.00.18.00" \ |
| 31 | && IUSE="${IUSE} max-idx-128" |
33 | && IUSE="${IUSE} max-idx-128" |
| 32 | |
34 | |
| 33 | mysql_version_is_at_least "5.01.00.00" \ |
35 | mysql_version_is_at_least "5.01.00.00" \ |
| 34 | && IUSE="${IUSE} innodb" |
36 | && IUSE="${IUSE} innodb" |
| 35 | |
37 | |
| 36 | EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_preinst pkg_postinst pkg_config pkg_postrm |
38 | EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_preinst pkg_postinst pkg_config pkg_prerm pkg_postrm |
| 37 | |
39 | |
| 38 | # void mysql_init_vars() |
40 | # void mysql_init_vars() |
| 39 | # |
41 | # |
| 40 | # initialize global variables |
42 | # initialize global variables |
| 41 | # 2005-11-19 <vivo at gentoo.org> |
43 | # 2005-11-19 <vivo at gentoo.org> |
| … | |
… | |
| 53 | MY_LOGDIR=${MY_LOGDIR="/var/log/mysql${MY_SUFFIX}"} |
55 | MY_LOGDIR=${MY_LOGDIR="/var/log/mysql${MY_SUFFIX}"} |
| 54 | MY_INCLUDEDIR=${MY_INCLUDEDIR="/usr/include/mysql${MY_SUFFIX}"} |
56 | MY_INCLUDEDIR=${MY_INCLUDEDIR="/usr/include/mysql${MY_SUFFIX}"} |
| 55 | |
57 | |
| 56 | if [ -z "${DATADIR}" ]; then |
58 | if [ -z "${DATADIR}" ]; then |
| 57 | DATADIR="" |
59 | DATADIR="" |
| 58 | if [ -f "${SYSCONFDIR}/my.cnf" ] ; then |
60 | 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` |
61 | DATADIR=`"my_print_defaults${MY_SUFFIX}" mysqld 2>/dev/null | sed -ne '/datadir/s|^--datadir=||p' | tail -n1` |
| 60 | if [ -z "${DATADIR}" ]; then |
62 | if [ -z "${DATADIR}" ]; then |
| 61 | if useq "srvdir" ; then |
63 | if useq "srvdir" ; then |
| 62 | DATADIR="/srv/localhost/mysql/datadir" |
64 | DATADIR="${ROOT}/srv/localhost/mysql${MY_SUFFIX}/datadir" |
| 63 | else |
65 | else |
| 64 | DATADIR=`grep ^datadir "${SYSCONFDIR}/my.cnf" | sed -e 's/.*=\s*//'` |
66 | DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" | sed -e 's/.*=\s*//'` |
| 65 | fi |
67 | fi |
| 66 | fi |
68 | fi |
| 67 | fi |
69 | fi |
| 68 | if [ -z "${DATADIR}" ]; then |
70 | if [ -z "${DATADIR}" ]; then |
|
|
71 | if useq "srvdir" ; then |
|
|
72 | DATADIR="${ROOT}/srv/localhost/mysql${MY_SUFFIX}/datadir" |
|
|
73 | else |
| 69 | DATADIR="${MY_LOCALSTATEDIR}" |
74 | DATADIR="${MY_LOCALSTATEDIR}" |
|
|
75 | fi |
| 70 | einfo "Using default DATADIR" |
76 | einfo "Using default DATADIR" |
| 71 | fi |
77 | fi |
| 72 | einfo "MySQL DATADIR is ${DATADIR}" |
78 | einfo "MySQL DATADIR is ${DATADIR}" |
| 73 | |
79 | |
| 74 | if [ -z "${PREVIOUS_DATADIR}" ] ; then |
80 | if [ -z "${PREVIOUS_DATADIR}" ] ; then |
| … | |
… | |
| 127 | # additional check, remove bundled zlib |
133 | # additional check, remove bundled zlib |
| 128 | rm -f "${S}/zlib/"*.[ch] |
134 | rm -f "${S}/zlib/"*.[ch] |
| 129 | sed -i -e "s/zlib\/Makefile dnl/dnl zlib\/Makefile/" "${S}/configure.in" |
135 | sed -i -e "s/zlib\/Makefile dnl/dnl zlib\/Makefile/" "${S}/configure.in" |
| 130 | rm -f scripts/mysqlbug |
136 | rm -f scripts/mysqlbug |
| 131 | |
137 | |
| 132 | # Multilib issue with zlib detection |
|
|
| 133 | mysql_version_is_at_least "5.00.15.00" \ |
|
|
| 134 | && sed -i -e "s:zlib_dir/lib:zlib_dir/$(get_libdir):g" \ |
|
|
| 135 | "${S}/config/ac-macros/zlib.m4" |
|
|
| 136 | |
|
|
| 137 | # Make charsets install in the right place |
138 | # Make charsets install in the right place |
| 138 | find . -name 'Makefile.am' \ |
139 | find . -name 'Makefile.am' \ |
| 139 | -exec sed --in-place -e 's!$(pkgdatadir)!'${MY_SHAREDSTATEDIR}'!g' {} \; |
140 | -exec sed --in-place -e 's!$(pkgdatadir)!'${MY_SHAREDSTATEDIR}'!g' {} \; |
| 140 | |
141 | |
| 141 | # Manage mysqlmanager |
142 | # Manage mysqlmanager |
| … | |
… | |
| 159 | fi |
160 | fi |
| 160 | |
161 | |
| 161 | for d in ${rebuilddirlist}; do |
162 | for d in ${rebuilddirlist}; do |
| 162 | einfo "reconfiguring dir \"${d}\"" |
163 | einfo "reconfiguring dir \"${d}\"" |
| 163 | pushd "${d}" &>/dev/null |
164 | pushd "${d}" &>/dev/null |
| 164 | for buildstep in \ |
165 | AT_GNUCONF_UPDATE="yes" eautoreconf |
| 165 | 'libtoolize --copy --force' \ |
|
|
| 166 | 'aclocal --force' \ |
|
|
| 167 | 'autoheader --force -Wnone' \ |
|
|
| 168 | 'autoconf --force -Wnone' \ |
|
|
| 169 | 'automake --force --force-missing -Wnone' \ |
|
|
| 170 | 'gnuconfig_update' |
|
|
| 171 | do |
|
|
| 172 | einfo "performing ${buildstep}" |
|
|
| 173 | ${buildstep} || die "failed ${buildstep/ */} dir \"${d}\"" |
|
|
| 174 | done |
|
|
| 175 | popd &>/dev/null |
166 | popd &>/dev/null |
| 176 | done |
167 | done |
| 177 | |
168 | |
|
|
169 | #TODO berkdb in 5.1 need to be worked on |
| 178 | if useq berkdb && ! mysql_check_version_range "5.01.00.00 to 5.01.06.99" |
170 | if useq berkdb && ! mysql_check_version_range "5.01.00.00 to 5.01.08.99" |
| 179 | then |
171 | then |
| 180 | [[ -w "${bdbdir}/ltmain.sh" ]] && cp -f ltmain.sh "${bdbdir}/ltmain.sh" |
172 | [[ -w "${bdbdir}/ltmain.sh" ]] && cp -f ltmain.sh "${bdbdir}/ltmain.sh" |
| 181 | pushd "${bdbdir}" && sh s_all || die "failed bdb reconfigure" &>/dev/null |
173 | pushd "${bdbdir}" && sh s_all || die "failed bdb reconfigure" &>/dev/null |
| 182 | popd &>/dev/null |
174 | popd &>/dev/null |
| 183 | fi |
175 | fi |
| … | |
… | |
| 241 | |
233 | |
| 242 | if useq static ; then |
234 | if useq static ; then |
| 243 | myconf="${myconf} --without-raid" |
235 | myconf="${myconf} --without-raid" |
| 244 | ewarn "disabling raid support, has problem with static" |
236 | ewarn "disabling raid support, has problem with static" |
| 245 | else |
237 | else |
|
|
238 | if mysql_version_is_at_least "5.00.00.00" ; then |
| 246 | myconf="${myconf} --with-raid" |
239 | myconf="${myconf} --without-raid" |
|
|
240 | else |
|
|
241 | myconf="${myconf} `use_with raid`" |
|
|
242 | fi |
| 247 | fi |
243 | fi |
| 248 | |
244 | |
| 249 | if ! mysql_version_is_at_least "5.00.00.00" ; then |
245 | if ! mysql_version_is_at_least "5.00.00.00" ; then |
| 250 | if mysql_version_is_at_least "4.01.00.00" ; then |
246 | if mysql_version_is_at_least "4.01.00.00" ; then |
| 251 | myconf="${myconf} --with-charset=utf8" |
247 | myconf="${myconf} --with-charset=utf8" |
| … | |
… | |
| 273 | || mysql_check_version_range "5.01.00.00 to 5.01.06.99" |
269 | || mysql_check_version_range "5.01.00.00 to 5.01.06.99" |
| 274 | then |
270 | then |
| 275 | ewarn "bdb berkeley-db disabled due to arch or version" |
271 | ewarn "bdb berkeley-db disabled due to arch or version" |
| 276 | myconf="${myconf} --without-berkeley-db" |
272 | myconf="${myconf} --without-berkeley-db" |
| 277 | else |
273 | else |
|
|
274 | #TODO berkdb in 5.1 need to be worked on |
| 278 | useq berkdb \ |
275 | useq berkdb && \ |
|
|
276 | ! mysql_check_version_range "5.01.00.00 to 5.01.08.99" \ |
| 279 | && myconf="${myconf} --with-berkeley-db=./bdb" \ |
277 | && myconf="${myconf} --with-berkeley-db=./bdb" \ |
| 280 | || myconf="${myconf} --without-berkeley-db" |
278 | || myconf="${myconf} --without-berkeley-db" |
| 281 | fi |
279 | fi |
| 282 | |
280 | |
| 283 | if mysql_version_is_at_least "4.01.03.00" ; then |
281 | if mysql_version_is_at_least "4.01.03.00" ; then |
| … | |
… | |
| 285 | myconf="${myconf} --with-geometry" |
283 | myconf="${myconf} --with-geometry" |
| 286 | myconf="${myconf} $(use_with cluster ndbcluster)" |
284 | myconf="${myconf} $(use_with cluster ndbcluster)" |
| 287 | fi |
285 | fi |
| 288 | |
286 | |
| 289 | mysql_version_is_at_least "4.01.11.00" && myconf="${myconf} `use_with big-tables`" |
287 | mysql_version_is_at_least "4.01.11.00" && myconf="${myconf} `use_with big-tables`" |
|
|
288 | |
|
|
289 | mysql_version_is_at_least "5.01.06.00" && myconf="${myconf} --with-ndb-binlog" |
|
|
290 | |
|
|
291 | if useq embedded ; then |
|
|
292 | #REMIND, need the privilege control enabled ? |
|
|
293 | myconf="${myconf} --without-embedded-privilege-control" |
|
|
294 | myconf="${myconf} --with-embedded-server" |
|
|
295 | else |
|
|
296 | myconf="${myconf} --without-embedded-privilege-control" |
|
|
297 | myconf="${myconf} --without-embedded-server" |
|
|
298 | fi |
| 290 | else |
299 | else |
| 291 | for i in ${minimal_exclude_list}; do |
300 | for i in ${minimal_exclude_list}; do |
| 292 | myconf="${myconf} --without-${i}" |
301 | myconf="${myconf} --without-${i}" |
| 293 | done |
302 | done |
| 294 | myconf="${myconf} --without-berkeley-db" |
303 | myconf="${myconf} --without-berkeley-db" |
| … | |
… | |
| 325 | && useq "max-idx-128" \ |
334 | && useq "max-idx-128" \ |
| 326 | && myconf="${myconf} --with-max-indexes=128" |
335 | && myconf="${myconf} --with-max-indexes=128" |
| 327 | |
336 | |
| 328 | if mysql_version_is_at_least "5.01.05.00" ; then |
337 | if mysql_version_is_at_least "5.01.05.00" ; then |
| 329 | myconf="${myconf} --with-row-based-replication" |
338 | myconf="${myconf} --with-row-based-replication" |
|
|
339 | fi |
|
|
340 | |
|
|
341 | #TODO rechek again later, had problem with assembler enabled |
|
|
342 | # and some combination of use-flags with 5.1 |
|
|
343 | if mysql_check_version_range "5.01.00.00 to 5.01.08.99" ; then |
|
|
344 | myconf="${myconf} --disable-assembler" |
|
|
345 | else |
|
|
346 | myconf="${myconf} --enable-assembler" |
| 330 | fi |
347 | fi |
| 331 | |
348 | |
| 332 | #Bug #114895,Bug #110149 |
349 | #Bug #114895,Bug #110149 |
| 333 | filter-flags "-O" "-O[01]" |
350 | filter-flags "-O" "-O[01]" |
| 334 | #glibc-2.3.2_pre fix; bug #16496 |
351 | #glibc-2.3.2_pre fix; bug #16496 |
| … | |
… | |
| 347 | --localstatedir="${MY_LOCALSTATEDIR}" \ |
364 | --localstatedir="${MY_LOCALSTATEDIR}" \ |
| 348 | --sharedstatedir="${MY_SHAREDSTATEDIR}" \ |
365 | --sharedstatedir="${MY_SHAREDSTATEDIR}" \ |
| 349 | --libdir="${MY_LIBDIR}" \ |
366 | --libdir="${MY_LIBDIR}" \ |
| 350 | --includedir="${MY_INCLUDEDIR}" \ |
367 | --includedir="${MY_INCLUDEDIR}" \ |
| 351 | --with-low-memory \ |
368 | --with-low-memory \ |
| 352 | --enable-assembler \ |
|
|
| 353 | --enable-local-infile \ |
369 | --enable-local-infile \ |
| 354 | --with-mysqld-user=mysql \ |
370 | --with-mysqld-user=mysql \ |
| 355 | --with-client-ldflags=-lstdc++ \ |
371 | --with-client-ldflags=-lstdc++ \ |
| 356 | --enable-thread-safe-client \ |
372 | --enable-thread-safe-client \ |
| 357 | --with-comment="Gentoo Linux ${PF}" \ |
373 | --with-comment="Gentoo Linux ${PF}" \ |
| 358 | --with-unix-socket-path="/var/run/mysqld/mysqld.sock" \ |
374 | --with-unix-socket-path="/var/run/mysqld/mysqld.sock" \ |
| 359 | --with-zlib-dir=/usr \ |
|
|
| 360 | --with-lib-ccflags="-fPIC" \ |
375 | --with-lib-ccflags="-fPIC" \ |
| 361 | --without-readline \ |
376 | --without-readline \ |
| 362 | --without-docs \ |
377 | --without-docs \ |
| 363 | ${myconf} || die "bad ./configure" |
378 | ${myconf} || die "bad ./configure" |
| 364 | |
379 | |
| 365 | # TODO Move this before autoreconf !!! |
380 | # TODO Move this before autoreconf !!! |
| 366 | find . -name 'Makefile' \ |
381 | find . -type f -name Makefile -print0 \ |
| 367 | -exec sed --in-place \ |
382 | | xargs -0 -n100 sed -i \ |
| 368 | -e 's|^pkglibdir\s*=\s*$(libdir)/mysql|pkglibdir = $(libdir)|' \ |
383 | -e 's|^pkglibdir *= *$(libdir)/mysql|pkglibdir = $(libdir)|;s|^pkgincludedir *= *$(includedir)/mysql|pkgincludedir = $(includedir)|' |
| 369 | -e 's|^pkgincludedir\s*=\s*$(includedir)/mysql|pkgincludedir = $(includedir)|' \ |
|
|
| 370 | {} \; |
|
|
| 371 | |
384 | |
| 372 | emake || die "compile problem" |
385 | emake || die "compile problem" |
| 373 | } |
386 | } |
| 374 | |
387 | |
| 375 | mysql_src_install() { |
388 | mysql_src_install() { |
| … | |
… | |
| 427 | "${FILESDIR}/my.cnf-4.1-r1" \ |
440 | "${FILESDIR}/my.cnf-4.1-r1" \ |
| 428 | > "${TMPDIR}/my.cnf.ok" |
441 | > "${TMPDIR}/my.cnf.ok" |
| 429 | newins "${TMPDIR}/my.cnf.ok" my.cnf |
442 | newins "${TMPDIR}/my.cnf.ok" my.cnf |
| 430 | |
443 | |
| 431 | insinto "/etc/conf.d" |
444 | insinto "/etc/conf.d" |
| 432 | newins "${FILESDIR}/mysql-slot.conf.d-r1" "mysql" |
445 | newins "${FILESDIR}/mysql.conf.d-r1" "mysql" |
| 433 | mysql_version_is_at_least "5.00.11.00" \ |
446 | mysql_version_is_at_least "5.00.11.00" \ |
| 434 | && newins "${FILESDIR}/mysqlmanager-slot.conf.d" "mysqlmanager" |
447 | && newins "${FILESDIR}/mysqlmanager.conf.d" "mysqlmanager" |
| 435 | |
448 | |
| 436 | # minimal builds don't have the server |
449 | # minimal builds don't have the server |
| 437 | if ! useq minimal; then |
450 | if ! useq minimal; then |
| 438 | exeinto /etc/init.d |
451 | exeinto /etc/init.d |
| 439 | newexe "${FILESDIR}/mysql-slot.rc6-r3" "mysql" |
452 | newexe "${FILESDIR}/mysql.rc6-r3" "mysql" |
| 440 | |
453 | |
| 441 | mysql_version_is_at_least "5.00.11.00" \ |
454 | mysql_version_is_at_least "5.00.11.00" \ |
| 442 | && newexe "${FILESDIR}/mysqlmanager-slot.rc6" "mysqlmanager" |
455 | && newexe "${FILESDIR}/mysqlmanager.rc6" "mysqlmanager" |
| 443 | insinto /etc/logrotate.d |
456 | insinto /etc/logrotate.d |
| 444 | sed -e "s!___MY_SUFFIX___!${MY_SUFFIX}!g" \ |
457 | sed -e "s!___MY_SUFFIX___!${MY_SUFFIX}!g" \ |
| 445 | "${FILESDIR}/logrotate-slot.mysql" \ |
458 | "${FILESDIR}/logrotate-slot.mysql" \ |
| 446 | > "${TMPDIR}/logrotate.mysql" |
459 | > "${TMPDIR}/logrotate.mysql" |
| 447 | newins "${TMPDIR}/logrotate.mysql" "mysql${MY_SUFFIX}" |
460 | newins "${TMPDIR}/logrotate.mysql" "mysql${MY_SUFFIX}" |
| … | |
… | |
| 484 | # oops, temporary fix |
497 | # oops, temporary fix |
| 485 | mysql_check_version_range "5.00.16.00 to 5.00.18.99" \ |
498 | mysql_check_version_range "5.00.16.00 to 5.00.18.99" \ |
| 486 | && cp -f \ |
499 | && cp -f \ |
| 487 | "${WORKDIR}/mysql-extras/fill_help_tables.sql-5.0" \ |
500 | "${WORKDIR}/mysql-extras/fill_help_tables.sql-5.0" \ |
| 488 | "${D}/usr/share/mysql${MY_SUFFIX}/fill_help_tables.sql" |
501 | "${D}/usr/share/mysql${MY_SUFFIX}/fill_help_tables.sql" |
|
|
502 | |
|
|
503 | if [[ ${SLOT} -gt 0 ]] ; then |
|
|
504 | # MOVED HERE DUE TO BUG #121445 |
|
|
505 | # create a list of files, to be used |
|
|
506 | # by external utilities |
|
|
507 | mkdir -p "${D}/var/lib/eselect/mysql/" |
|
|
508 | local filelist="${D}/var/lib/eselect/mysql/mysql${MY_SUFFIX}.filelist" |
|
|
509 | pushd "${D}/" &>/dev/null |
|
|
510 | find usr/bin/ usr/sbin/ \ |
|
|
511 | -type f -name "*${MY_SUFFIX}*" \ |
|
|
512 | -and -not -name "mysql_config${MY_SUFFIX}" \ |
|
|
513 | > "${filelist}" |
|
|
514 | find usr/share/man \ |
|
|
515 | -type f -name "*${MY_SUFFIX}*" \ |
|
|
516 | | sed -e 's/$/.gz/' \ |
|
|
517 | >> "${filelist}" |
|
|
518 | echo "${MY_SYSCONFDIR#"/"}" >> "${filelist}" |
|
|
519 | echo "${MY_LIBDIR#"/"}" >> "${filelist}" |
|
|
520 | echo "${MY_SHAREDSTATEDIR#"/"}" >> "${filelist}" |
|
|
521 | popd &>/dev/null |
|
|
522 | fi |
|
|
523 | |
|
|
524 | # It's safer portage wis doing this in instal, but we can't |
|
|
525 | # if it's a slotted install |
|
|
526 | [[ ${SLOT} -eq 0 ]] && ROOT="${D}" mysql_lib_symlinks |
| 489 | } |
527 | } |
| 490 | |
528 | |
| 491 | mysql_pkg_preinst() { |
529 | mysql_pkg_preinst() { |
| 492 | |
|
|
| 493 | # create a list of files, to be used |
|
|
| 494 | # by external utilities |
|
|
| 495 | # will be used in pkg_postinst |
|
|
| 496 | local filelist="${TMPDIR}/FILELIST" |
|
|
| 497 | pushd "${D}/" &>/dev/null |
|
|
| 498 | mkdir -p "${ROOT}/var/lib/eselect/mysql/" |
|
|
| 499 | env -i find usr/bin/ usr/sbin/ usr/share/man \ |
|
|
| 500 | -type f -name "*${MY_SUFFIX}*" \ |
|
|
| 501 | -and -not -name "mysql_config${MY_SUFFIX}" \ |
|
|
| 502 | > "${filelist}" |
|
|
| 503 | echo "${MY_SYSCONFDIR#"/"}" >> "${filelist}" |
|
|
| 504 | echo "${MY_LIBDIR#"/"}" >> "${filelist}" |
|
|
| 505 | echo "${MY_SHAREDSTATEDIR#"/"}" >> "${filelist}" |
|
|
| 506 | popd &>/dev/null |
|
|
| 507 | |
530 | |
| 508 | enewgroup mysql 60 || die "problem adding group mysql" |
531 | enewgroup mysql 60 || die "problem adding group mysql" |
| 509 | enewuser mysql 60 -1 /dev/null mysql \ |
532 | enewuser mysql 60 -1 /dev/null mysql \ |
| 510 | || die "problem adding user mysql" |
533 | || die "problem adding user mysql" |
| 511 | } |
534 | } |
| 512 | |
535 | |
| 513 | mysql_pkg_postinst() { |
536 | mysql_pkg_postinst() { |
| 514 | |
537 | |
| 515 | mysql_init_vars |
538 | mysql_init_vars |
| 516 | mysql_lib_symlinks |
539 | # slotted, manage lib symlinks on the real file-system |
|
|
540 | # to cope with other version installed |
|
|
541 | [[ ${SLOT} -ne 0 ]] && mysql_lib_symlinks |
| 517 | |
542 | |
| 518 | # mind at FEATURES=collision-protect before to remove this |
543 | # mind at FEATURES=collision-protect before to remove this |
| 519 | [ -d "${ROOT}/var/log/mysql" ] \ |
544 | [ -d "${ROOT}/var/log/mysql" ] \ |
| 520 | || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}" |
545 | || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}" |
| 521 | |
546 | |
| 522 | #secure the logfiles... does this bother anybody? |
547 | #secure the logfiles... does this bother anybody? |
| 523 | touch "${ROOT}${MY_LOGDIR}"/mysql.{log,err} |
548 | touch "${ROOT}${MY_LOGDIR}"/mysql.{log,err} |
| 524 | chown mysql:mysql "${ROOT}${MY_LOGDIR}"/mysql* |
549 | chown mysql:mysql "${ROOT}${MY_LOGDIR}"/mysql* |
| 525 | chmod 0660 "${ROOT}${MY_LOGDIR}"/mysql* |
550 | chmod 0660 "${ROOT}${MY_LOGDIR}"/mysql* |
| 526 | |
551 | |
| 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}.filelist" |
|
|
| 531 | |
|
|
| 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 |
|
|
| 535 | einfo "you may want to read:" |
554 | einfo "you may want to read:" |
| 536 | einfo "http://www.gentoo.org/doc/en/mysql-upgrade-slotted.xml" |
555 | einfo "http://www.gentoo.org/doc/en/mysql-upgrade-slotted.xml" |
| 537 | else |
|
|
| 538 | local tmpres="$( eselect mysql show )" |
|
|
| 539 | # "like grep -q unset" |
|
|
| 540 | if [[ "{$tmpres}" == "{$tmpres/unset/}" ]] ; then |
|
|
| 541 | eselect mysql set 1 |
|
|
| 542 | else |
|
|
| 543 | 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 " |
556 | einfo "you may want to run \"eselect mysql list\" followed by a " |
| 545 | einfo "\"eselect myqsl set 1\" to chose the default mysql server" |
557 | einfo "\"eselect mysql set 1\" to choose the default mysql server" |
| 546 | fi |
|
|
| 547 | fi |
|
|
| 548 | fi |
558 | fi |
| 549 | |
559 | |
| 550 | # your friendly public service announcement... |
560 | # your friendly public service announcement... |
| 551 | einfo |
561 | einfo |
| 552 | einfo "You might want to run:" |
562 | einfo "You might want to run:" |
| 553 | einfo "\"emerge --config =${CATEGORY}/${PF}\"" |
563 | einfo "\"emerge --config =${CATEGORY}/${PF}\"" |
| 554 | einfo "if this is a new install." |
564 | einfo "if this is a new install." |
| 555 | einfo |
565 | einfo |
|
|
566 | mysql_version_is_at_least "5.01.00.00" \ |
| 556 | einfo "InnoDB is not optional as of MySQL-4.0.24, at the request of upstream." |
567 | || einfo "InnoDB is not optional as of MySQL-4.0.24, at the request of upstream." |
| 557 | fi |
568 | fi |
| 558 | } |
569 | } |
| 559 | |
570 | |
| 560 | mysql_pkg_config() { |
571 | mysql_pkg_config() { |
| 561 | mysql_init_vars |
572 | mysql_init_vars |
| … | |
… | |
| 663 | einfo "stopping the server," |
674 | einfo "stopping the server," |
| 664 | wait %1 |
675 | wait %1 |
| 665 | einfo "done" |
676 | einfo "done" |
| 666 | } |
677 | } |
| 667 | |
678 | |
|
|
679 | mysql_pkg_prerm() { |
|
|
680 | if [[ ${SLOT} -gt 0 ]] ; then |
|
|
681 | # external program |
|
|
682 | eselect mysql slot_remove "${SLOT}" |
|
|
683 | fi |
|
|
684 | } |
|
|
685 | |
| 668 | mysql_pkg_postrm() { |
686 | mysql_pkg_postrm() { |
| 669 | mysql_lib_symlinks |
687 | mysql_lib_symlinks |
| 670 | if [[ ${SLOT} -gt 0 ]] ; then |
688 | if [[ ${SLOT} -gt 0 ]] ; then |
| 671 | einfo "you may want to run \"eselect myqsl list\" followed by a " |
689 | einfo "you may want to run \"eselect mysql list\" followed by a " |
| 672 | einfo "\"eselect myqsl list\" to chose the default mysql server" |
690 | einfo "\"eselect mysql list\" to choose the default mysql server" |
| 673 | fi |
691 | fi |
| 674 | } |
692 | } |