| 1 |
jmbsvicetto |
1.12 |
# Copyright 1999-2012 Gentoo Foundation |
| 2 |
robbat2 |
1.1 |
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
robbat2 |
1.20 |
# $Header: /var/cvsroot/gentoo-x86/eclass/mysql-v2.eclass,v 1.19 2012/09/27 16:35:41 axs Exp $ |
| 4 |
robbat2 |
1.1 |
|
| 5 |
|
|
# @ECLASS: mysql-v2.eclass |
| 6 |
|
|
# @MAINTAINER: |
| 7 |
|
|
# Maintainers: |
| 8 |
|
|
# - MySQL Team <mysql-bugs@gentoo.org> |
| 9 |
|
|
# - Robin H. Johnson <robbat2@gentoo.org> |
| 10 |
|
|
# - Jorge Manuel B. S. Vicetto <jmbsvicetto@gentoo.org> |
| 11 |
|
|
# @BLURB: This eclass provides most of the functions for mysql ebuilds |
| 12 |
|
|
# @DESCRIPTION: |
| 13 |
|
|
# The mysql-v2.eclass is the base eclass to build the mysql and |
| 14 |
|
|
# alternative projects (mariadb) ebuilds. |
| 15 |
|
|
# This eclass uses the mysql-autotools and mysql-cmake eclasses for the |
| 16 |
|
|
# specific bits related to the build system. |
| 17 |
|
|
# It provides the src_unpack, src_prepare, src_configure, src_compile, |
| 18 |
heroxbd |
1.16 |
# src_install, pkg_preinst, pkg_postinst, pkg_config and pkg_postrm |
| 19 |
robbat2 |
1.1 |
# phase hooks. |
| 20 |
|
|
|
| 21 |
|
|
# @ECLASS-VARIABLE: BUILD |
| 22 |
vapier |
1.7 |
# @DESCRIPTION: |
| 23 |
|
|
# Build type of the mysql version |
| 24 |
robbat2 |
1.1 |
: ${BUILD:=autotools} |
| 25 |
|
|
|
| 26 |
|
|
case ${BUILD} in |
| 27 |
|
|
"cmake") |
| 28 |
|
|
BUILD_INHERIT="mysql-cmake" |
| 29 |
|
|
;; |
| 30 |
|
|
"autotools") |
| 31 |
|
|
BUILD_INHERIT="mysql-autotools" |
| 32 |
|
|
|
| 33 |
|
|
WANT_AUTOCONF="latest" |
| 34 |
|
|
WANT_AUTOMAKE="latest" |
| 35 |
|
|
;; |
| 36 |
|
|
*) |
| 37 |
|
|
die "${BUILD} is not a valid build system for mysql" |
| 38 |
|
|
;; |
| 39 |
|
|
esac |
| 40 |
|
|
|
| 41 |
|
|
MYSQL_EXTRAS="" |
| 42 |
|
|
|
| 43 |
|
|
# @ECLASS-VARIABLE: MYSQL_EXTRAS_VER |
| 44 |
vapier |
1.7 |
# @DESCRIPTION: |
| 45 |
|
|
# The version of the MYSQL_EXTRAS repo to use to build mysql |
| 46 |
jmbsvicetto |
1.9 |
# Use "none" to disable it's use |
| 47 |
robbat2 |
1.1 |
[[ "${MY_EXTRAS_VER}" == "live" ]] && MYSQL_EXTRAS="git-2" |
| 48 |
|
|
|
| 49 |
|
|
inherit eutils flag-o-matic gnuconfig ${MYSQL_EXTRAS} ${BUILD_INHERIT} mysql_fx versionator toolchain-funcs |
| 50 |
|
|
|
| 51 |
|
|
# |
| 52 |
|
|
# Supported EAPI versions and export functions |
| 53 |
|
|
# |
| 54 |
|
|
|
| 55 |
|
|
case "${EAPI:-0}" in |
| 56 |
axs |
1.19 |
3|4|5) ;; |
| 57 |
robbat2 |
1.1 |
*) die "Unsupported EAPI: ${EAPI}" ;; |
| 58 |
|
|
esac |
| 59 |
|
|
|
| 60 |
jmbsvicetto |
1.3 |
EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_install pkg_preinst pkg_postinst pkg_config pkg_postrm |
| 61 |
robbat2 |
1.1 |
|
| 62 |
|
|
# |
| 63 |
|
|
# VARIABLES: |
| 64 |
|
|
# |
| 65 |
|
|
|
| 66 |
|
|
# Shorten the path because the socket path length must be shorter than 107 chars |
| 67 |
|
|
# and we will run a mysql server during test phase |
| 68 |
|
|
S="${WORKDIR}/mysql" |
| 69 |
|
|
|
| 70 |
|
|
[[ "${MY_EXTRAS_VER}" == "latest" ]] && MY_EXTRAS_VER="20090228-0714Z" |
| 71 |
|
|
if [[ "${MY_EXTRAS_VER}" == "live" ]]; then |
| 72 |
|
|
EGIT_PROJECT=mysql-extras |
| 73 |
|
|
EGIT_REPO_URI="git://git.overlays.gentoo.org/proj/mysql-extras.git" |
| 74 |
|
|
fi |
| 75 |
|
|
|
| 76 |
|
|
# @ECLASS-VARIABLE: MYSQL_PV_MAJOR |
| 77 |
|
|
# @DESCRIPTION: |
| 78 |
|
|
# Upstream MySQL considers the first two parts of the version number to be the |
| 79 |
|
|
# major version. Upgrades that change major version should always run |
| 80 |
|
|
# mysql_upgrade. |
| 81 |
|
|
MYSQL_PV_MAJOR="$(get_version_component_range 1-2 ${PV})" |
| 82 |
|
|
|
| 83 |
|
|
# @ECLASS-VARIABLE: MYSQL_VERSION_ID |
| 84 |
|
|
# @DESCRIPTION: |
| 85 |
|
|
# MYSQL_VERSION_ID will be: |
| 86 |
|
|
# major * 10e6 + minor * 10e4 + micro * 10e2 + gentoo revision number, all [0..99] |
| 87 |
|
|
# This is an important part, because many of the choices the MySQL ebuild will do |
| 88 |
|
|
# depend on this variable. |
| 89 |
|
|
# In particular, the code below transforms a $PVR like "5.0.18-r3" in "5001803" |
| 90 |
|
|
# We also strip off upstream's trailing letter that they use to respin tarballs |
| 91 |
|
|
MYSQL_VERSION_ID="" |
| 92 |
|
|
tpv="${PV%[a-z]}" |
| 93 |
|
|
tpv=( ${tpv//[-._]/ } ) ; tpv[3]="${PVR:${#PV}}" ; tpv[3]="${tpv[3]##*-r}" |
| 94 |
|
|
for vatom in 0 1 2 3 ; do |
| 95 |
|
|
# pad to length 2 |
| 96 |
|
|
tpv[${vatom}]="00${tpv[${vatom}]}" |
| 97 |
|
|
MYSQL_VERSION_ID="${MYSQL_VERSION_ID}${tpv[${vatom}]:0-2}" |
| 98 |
|
|
done |
| 99 |
|
|
# strip leading "0" (otherwise it's considered an octal number by BASH) |
| 100 |
|
|
MYSQL_VERSION_ID=${MYSQL_VERSION_ID##"0"} |
| 101 |
|
|
|
| 102 |
|
|
# This eclass should only be used with at least mysql-5.1.50 |
| 103 |
|
|
mysql_version_is_at_least "5.1.50" || die "This eclass should only be used with >=mysql-5.1.50" |
| 104 |
|
|
|
| 105 |
|
|
# @ECLASS-VARIABLE: XTRADB_VER |
| 106 |
|
|
# @DEFAULT_UNSET |
| 107 |
|
|
# @DESCRIPTION: |
| 108 |
|
|
# Version of the XTRADB storage engine |
| 109 |
|
|
|
| 110 |
|
|
# @ECLASS-VARIABLE: PERCONA_VER |
| 111 |
|
|
# @DEFAULT_UNSET |
| 112 |
|
|
# @DESCRIPTION: |
| 113 |
|
|
# Designation by PERCONA for a MySQL version to apply an XTRADB release |
| 114 |
|
|
|
| 115 |
|
|
# Work out the default SERVER_URI correctly |
| 116 |
|
|
if [ -z "${SERVER_URI}" ]; then |
| 117 |
|
|
[ -z "${MY_PV}" ] && MY_PV="${PV//_/-}" |
| 118 |
|
|
if [ "${PN}" == "mariadb" ]; then |
| 119 |
robbat2 |
1.15 |
MARIA_FULL_PV="$(replace_version_separator 3 '-' ${MY_PV})" |
| 120 |
robbat2 |
1.1 |
MARIA_FULL_P="${PN}-${MARIA_FULL_PV}" |
| 121 |
|
|
SERVER_URI=" |
| 122 |
|
|
http://ftp.osuosl.org/pub/mariadb/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz |
| 123 |
|
|
http://ftp.rediris.es/mirror/MariaDB/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz |
| 124 |
|
|
http://maria.llarian.net/download/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz |
| 125 |
|
|
http://launchpad.net/maria/${MYSQL_PV_MAJOR}/ongoing/+download/${MARIA_FULL_P}.tar.gz |
| 126 |
|
|
http://mirrors.fe.up.pt/pub/${PN}/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz |
| 127 |
|
|
http://ftp-stud.hs-esslingen.de/pub/Mirrors/${PN}/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz |
| 128 |
|
|
" |
| 129 |
robbat2 |
1.15 |
else |
| 130 |
|
|
URI_DIR="MySQL" |
| 131 |
|
|
URI_FILE="mysql" |
| 132 |
robbat2 |
1.1 |
URI_A="${URI_FILE}-${MY_PV}.tar.gz" |
| 133 |
|
|
MIRROR_PV=$(get_version_component_range 1-2 ${PV}) |
| 134 |
|
|
# Recently upstream switched to an archive site, and not on mirrors |
| 135 |
|
|
SERVER_URI="http://downloads.mysql.com/archives/${URI_FILE}-${MIRROR_PV}/${URI_A} |
| 136 |
|
|
mirror://mysql/Downloads/${URI_DIR}-${PV%.*}/${URI_A}" |
| 137 |
|
|
fi |
| 138 |
|
|
fi |
| 139 |
|
|
|
| 140 |
|
|
# Define correct SRC_URIs |
| 141 |
|
|
SRC_URI="${SERVER_URI}" |
| 142 |
|
|
|
| 143 |
|
|
# Gentoo patches to MySQL |
| 144 |
jmbsvicetto |
1.9 |
[[ ${MY_EXTRAS_VER} != live ]] && [[ ${MY_EXTRAS_VER} != none ]] \ |
| 145 |
robbat2 |
1.1 |
&& SRC_URI="${SRC_URI} |
| 146 |
|
|
mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
| 147 |
|
|
http://g3nt8.org/patches/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
| 148 |
jmbsvicetto |
1.4 |
http://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
| 149 |
|
|
http://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2" |
| 150 |
robbat2 |
1.1 |
|
| 151 |
|
|
DESCRIPTION="A fast, multi-threaded, multi-user SQL database server." |
| 152 |
|
|
HOMEPAGE="http://www.mysql.com/" |
| 153 |
|
|
if [[ "${PN}" == "mariadb" ]]; then |
| 154 |
|
|
HOMEPAGE="http://mariadb.org/" |
| 155 |
|
|
DESCRIPTION="MariaDB is a MySQL fork with 3rd-party patches and additional storage engines merged." |
| 156 |
|
|
fi |
| 157 |
|
|
LICENSE="GPL-2" |
| 158 |
|
|
SLOT="0" |
| 159 |
|
|
|
| 160 |
|
|
case "${BUILD}" in |
| 161 |
|
|
"autotools") |
| 162 |
|
|
IUSE="big-tables debug embedded minimal +perl selinux ssl static test" |
| 163 |
|
|
;; |
| 164 |
|
|
"cmake") |
| 165 |
|
|
IUSE="debug embedded minimal +perl selinux ssl static test" |
| 166 |
|
|
;; |
| 167 |
|
|
esac |
| 168 |
|
|
|
| 169 |
|
|
IUSE="${IUSE} latin1" |
| 170 |
|
|
|
| 171 |
|
|
IUSE="${IUSE} extraengine" |
| 172 |
robbat2 |
1.15 |
IUSE="${IUSE} cluster" |
| 173 |
robbat2 |
1.1 |
|
| 174 |
|
|
IUSE="${IUSE} max-idx-128" |
| 175 |
|
|
IUSE="${IUSE} berkdb" |
| 176 |
robbat2 |
1.15 |
IUSE="${IUSE} +community profiling" |
| 177 |
robbat2 |
1.1 |
|
| 178 |
|
|
[[ ${PN} == "mariadb" ]] \ |
| 179 |
|
|
&& IUSE="${IUSE} libevent" |
| 180 |
|
|
|
| 181 |
|
|
[[ ${PN} == "mariadb" ]] \ |
| 182 |
|
|
&& mysql_version_is_at_least "5.2" \ |
| 183 |
|
|
&& IUSE="${IUSE} oqgraph" |
| 184 |
|
|
|
| 185 |
|
|
[[ ${PN} == "mariadb" ]] \ |
| 186 |
|
|
&& mysql_version_is_at_least "5.2.5" \ |
| 187 |
|
|
&& IUSE="${IUSE} sphinx" |
| 188 |
|
|
|
| 189 |
robbat2 |
1.11 |
mysql_version_is_at_least "5.5.7" \ |
| 190 |
|
|
&& IUSE="${IUSE} systemtap" |
| 191 |
|
|
|
| 192 |
robbat2 |
1.1 |
# |
| 193 |
|
|
# DEPENDENCIES: |
| 194 |
|
|
# |
| 195 |
|
|
|
| 196 |
|
|
# Be warned, *DEPEND are version-dependant |
| 197 |
|
|
# These are used for both runtime and compiletime |
| 198 |
|
|
DEPEND=" |
| 199 |
|
|
ssl? ( >=dev-libs/openssl-0.9.6d ) |
| 200 |
jmbsvicetto |
1.9 |
kernel_linux? ( sys-process/procps ) |
| 201 |
robbat2 |
1.1 |
>=sys-apps/sed-4 |
| 202 |
|
|
>=sys-apps/texinfo-4.7-r1 |
| 203 |
|
|
>=sys-libs/readline-4.1 |
| 204 |
|
|
>=sys-libs/zlib-1.2.3 |
| 205 |
|
|
" |
| 206 |
|
|
|
| 207 |
|
|
[[ ${PN} == mariadb ]] \ |
| 208 |
|
|
&& DEPEND="${DEPEND} libevent? ( >=dev-libs/libevent-1.4 )" |
| 209 |
|
|
|
| 210 |
|
|
# Having different flavours at the same time is not a good idea |
| 211 |
robbat2 |
1.15 |
for i in "mysql" "mariadb" ; do |
| 212 |
robbat2 |
1.1 |
[[ ${i} == ${PN} ]] || |
| 213 |
|
|
DEPEND="${DEPEND} !dev-db/${i}" |
| 214 |
|
|
done |
| 215 |
|
|
|
| 216 |
grobian |
1.8 |
# prefix: first need to implement something for #196294 |
| 217 |
robbat2 |
1.1 |
RDEPEND="${DEPEND} |
| 218 |
grobian |
1.8 |
!minimal? ( !prefix? ( dev-db/mysql-init-scripts ) ) |
| 219 |
robbat2 |
1.1 |
selinux? ( sec-policy/selinux-mysql ) |
| 220 |
|
|
" |
| 221 |
|
|
|
| 222 |
jmbsvicetto |
1.6 |
DEPEND="${DEPEND} |
| 223 |
|
|
virtual/yacc |
| 224 |
|
|
" |
| 225 |
|
|
|
| 226 |
jmbsvicetto |
1.17 |
DEPEND="${DEPEND} static? ( sys-libs/ncurses[static-libs] )" |
| 227 |
robbat2 |
1.1 |
|
| 228 |
|
|
# compile-time-only |
| 229 |
|
|
DEPEND="${DEPEND} >=dev-util/cmake-2.4.3" |
| 230 |
|
|
|
| 231 |
|
|
# compile-time-only |
| 232 |
|
|
mysql_version_is_at_least "5.5.8" \ |
| 233 |
|
|
&& DEPEND="${DEPEND} >=dev-util/cmake-2.6.3" |
| 234 |
|
|
|
| 235 |
|
|
[[ "${PN}" == "mariadb" ]] \ |
| 236 |
|
|
&& mysql_version_is_at_least "5.2" \ |
| 237 |
|
|
&& DEPEND="${DEPEND} oqgraph? ( >=dev-libs/boost-1.40.0 )" |
| 238 |
|
|
|
| 239 |
|
|
[[ "${PN}" == "mariadb" ]] \ |
| 240 |
|
|
&& mysql_version_is_at_least "5.2.5" \ |
| 241 |
|
|
&& DEPEND="${DEPEND} sphinx? ( app-misc/sphinx )" |
| 242 |
|
|
|
| 243 |
robbat2 |
1.11 |
mysql_version_is_at_least "5.5.7" \ |
| 244 |
|
|
&& DEPEND="${DEPEND} systemtap? ( >=dev-util/systemtap-1.3 )" |
| 245 |
|
|
|
| 246 |
robbat2 |
1.1 |
# dev-perl/DBD-mysql is needed by some scripts installed by MySQL |
| 247 |
|
|
PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )" |
| 248 |
|
|
|
| 249 |
|
|
# For other stuff to bring us in |
| 250 |
|
|
PDEPEND="${PDEPEND} =virtual/mysql-${MYSQL_PV_MAJOR}" |
| 251 |
|
|
|
| 252 |
|
|
# |
| 253 |
|
|
# External patches |
| 254 |
|
|
# |
| 255 |
|
|
|
| 256 |
|
|
# MariaDB has integrated PBXT |
| 257 |
|
|
# PBXT_VERSION means that we have a PBXT patch for this PV |
| 258 |
|
|
# PBXT was only introduced after 5.1.12 |
| 259 |
|
|
pbxt_patch_available() { |
| 260 |
|
|
[[ ${PN} != "mariadb" ]] \ |
| 261 |
|
|
&& [[ -n "${PBXT_VERSION}" ]] |
| 262 |
|
|
return $? |
| 263 |
|
|
} |
| 264 |
|
|
|
| 265 |
|
|
pbxt_available() { |
| 266 |
|
|
pbxt_patch_available || [[ ${PN} == "mariadb" ]] |
| 267 |
|
|
return $? |
| 268 |
|
|
} |
| 269 |
|
|
|
| 270 |
|
|
# Get the percona tarball if XTRADB_VER and PERCONA_VER are both set |
| 271 |
|
|
# MariaDB has integrated XtraDB |
| 272 |
|
|
# XTRADB_VERS means that we have a XTRADB patch for this PV |
| 273 |
|
|
# XTRADB was only introduced after 5.1.26 |
| 274 |
|
|
xtradb_patch_available() { |
| 275 |
|
|
[[ ${PN} != "mariadb" ]] \ |
| 276 |
|
|
&& [[ -n "${XTRADB_VER}" && -n "${PERCONA_VER}" ]] |
| 277 |
|
|
return $? |
| 278 |
|
|
} |
| 279 |
|
|
|
| 280 |
|
|
|
| 281 |
|
|
if pbxt_patch_available; then |
| 282 |
|
|
|
| 283 |
|
|
PBXT_P="pbxt-${PBXT_VERSION}" |
| 284 |
|
|
PBXT_SRC_URI="http://www.primebase.org/download/${PBXT_P}.tar.gz mirror://sourceforge/pbxt/${PBXT_P}.tar.gz" |
| 285 |
|
|
SRC_URI="${SRC_URI} pbxt? ( ${PBXT_SRC_URI} )" |
| 286 |
|
|
|
| 287 |
robbat2 |
1.15 |
fi |
| 288 |
|
|
|
| 289 |
|
|
# PBXT_NEWSTYLE means pbxt is in storage/ and gets enabled as other plugins |
| 290 |
|
|
# vs. built outside the dir |
| 291 |
|
|
if pbxt_available; then |
| 292 |
robbat2 |
1.1 |
|
| 293 |
robbat2 |
1.15 |
IUSE="${IUSE} pbxt" |
| 294 |
|
|
PBXT_NEWSTYLE=1 |
| 295 |
robbat2 |
1.1 |
fi |
| 296 |
|
|
|
| 297 |
|
|
if xtradb_patch_available; then |
| 298 |
|
|
XTRADB_P="percona-xtradb-${XTRADB_VER}" |
| 299 |
|
|
XTRADB_SRC_URI_COMMON="${PERCONA_VER}/source/${XTRADB_P}.tar.gz" |
| 300 |
|
|
XTRADB_SRC_B1="http://www.percona.com/" |
| 301 |
|
|
XTRADB_SRC_B2="${XTRADB_SRC_B1}/percona-builds/" |
| 302 |
|
|
XTRADB_SRC_URI1="${XTRADB_SRC_B2}/Percona-Server/Percona-Server-${XTRADB_SRC_URI_COMMON}" |
| 303 |
|
|
XTRADB_SRC_URI2="${XTRADB_SRC_B2}/xtradb/${XTRADB_SRC_URI_COMMON}" |
| 304 |
|
|
XTRADB_SRC_URI3="${XTRADB_SRC_B1}/${PN}/xtradb/${XTRADB_SRC_URI_COMMON}" |
| 305 |
|
|
SRC_URI="${SRC_URI} xtradb? ( ${XTRADB_SRC_URI1} ${XTRADB_SRC_URI2} ${XTRADB_SRC_URI3} )" |
| 306 |
|
|
IUSE="${IUSE} xtradb" |
| 307 |
|
|
fi |
| 308 |
|
|
|
| 309 |
|
|
# |
| 310 |
|
|
# HELPER FUNCTIONS: |
| 311 |
|
|
# |
| 312 |
|
|
|
| 313 |
|
|
# @FUNCTION: mysql-v2_disable_test |
| 314 |
|
|
# @DESCRIPTION: |
| 315 |
|
|
# Helper function to disable specific tests. |
| 316 |
|
|
mysql-v2_disable_test() { |
| 317 |
|
|
${BUILD_INHERIT}_disable_test "$@" |
| 318 |
|
|
} |
| 319 |
|
|
|
| 320 |
|
|
# @FUNCTION: mysql-v2_configure_minimal |
| 321 |
|
|
# @DESCRIPTION: |
| 322 |
|
|
# Helper function to configure minimal build |
| 323 |
|
|
configure_minimal() { |
| 324 |
|
|
${BUILD_INHERIT}_configure_minimal "$@" |
| 325 |
|
|
} |
| 326 |
|
|
|
| 327 |
|
|
# @FUNCTION: mysql-v2_configure_common |
| 328 |
|
|
# @DESCRIPTION: |
| 329 |
|
|
# Helper function to configure common builds |
| 330 |
|
|
configure_common() { |
| 331 |
|
|
${BUILD_INHERIT}_configure_common "$@" |
| 332 |
|
|
} |
| 333 |
|
|
|
| 334 |
|
|
# |
| 335 |
|
|
# EBUILD FUNCTIONS |
| 336 |
|
|
# |
| 337 |
|
|
|
| 338 |
|
|
# @FUNCTION: mysql-v2_pkg_setup |
| 339 |
|
|
# @DESCRIPTION: |
| 340 |
|
|
# Perform some basic tests and tasks during pkg_setup phase: |
| 341 |
|
|
# die if FEATURES="test", USE="-minimal" and not using FEATURES="userpriv" |
| 342 |
|
|
# check for conflicting use flags |
| 343 |
|
|
# create new user and group for mysql |
| 344 |
|
|
# warn about deprecated features |
| 345 |
|
|
mysql-v2_pkg_setup() { |
| 346 |
|
|
|
| 347 |
|
|
if has test ${FEATURES} ; then |
| 348 |
|
|
if ! use minimal ; then |
| 349 |
jmbsvicetto |
1.12 |
if ! has userpriv ${FEATURES} ; then |
| 350 |
robbat2 |
1.1 |
eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." |
| 351 |
|
|
fi |
| 352 |
|
|
fi |
| 353 |
|
|
fi |
| 354 |
|
|
|
| 355 |
|
|
# Check for USE flag problems in pkg_setup |
| 356 |
|
|
if use static && use ssl ; then |
| 357 |
|
|
M="MySQL does not support being built statically with SSL support enabled!" |
| 358 |
|
|
eerror "${M}" |
| 359 |
|
|
die "${M}" |
| 360 |
|
|
fi |
| 361 |
|
|
|
| 362 |
|
|
if ! mysql_version_is_at_least "5.2" \ |
| 363 |
|
|
&& use debug ; then |
| 364 |
|
|
# Also in package.use.mask |
| 365 |
|
|
die "Bug #344885: Upstream has broken USE=debug for 5.1 series >=5.1.51" |
| 366 |
|
|
fi |
| 367 |
|
|
|
| 368 |
|
|
if ( use cluster || use extraengine || use embedded ) \ |
| 369 |
|
|
&& use minimal ; then |
| 370 |
|
|
M="USE flags 'cluster', 'extraengine', 'embedded' conflict with 'minimal' USE flag!" |
| 371 |
|
|
eerror "${M}" |
| 372 |
|
|
die "${M}" |
| 373 |
|
|
fi |
| 374 |
|
|
|
| 375 |
|
|
if xtradb_patch_available \ |
| 376 |
|
|
&& use xtradb \ |
| 377 |
|
|
&& use embedded ; then |
| 378 |
|
|
M="USE flags 'xtradb' and 'embedded' conflict and cause build failures" |
| 379 |
|
|
eerror "${M}" |
| 380 |
|
|
die "${M}" |
| 381 |
|
|
fi |
| 382 |
|
|
|
| 383 |
|
|
# This should come after all of the die statements |
| 384 |
|
|
enewgroup mysql 60 || die "problem adding 'mysql' group" |
| 385 |
|
|
enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user" |
| 386 |
|
|
|
| 387 |
robbat2 |
1.15 |
if use cluster; then |
| 388 |
robbat2 |
1.1 |
ewarn "Upstream has noted that the NDB cluster support in the 5.0 and" |
| 389 |
|
|
ewarn "5.1 series should NOT be put into production. In the near" |
| 390 |
|
|
ewarn "future, it will be disabled from building." |
| 391 |
|
|
fi |
| 392 |
|
|
} |
| 393 |
|
|
|
| 394 |
|
|
# @FUNCTION: mysql-v2_src_unpack |
| 395 |
|
|
# @DESCRIPTION: |
| 396 |
|
|
# Unpack the source code |
| 397 |
|
|
mysql-v2_src_unpack() { |
| 398 |
|
|
|
| 399 |
|
|
# Initialize the proper variables first |
| 400 |
|
|
mysql_init_vars |
| 401 |
|
|
|
| 402 |
|
|
unpack ${A} |
| 403 |
|
|
# Grab the patches |
| 404 |
|
|
[[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git-2_src_unpack |
| 405 |
|
|
|
| 406 |
|
|
mv -f "${WORKDIR}/${MY_SOURCEDIR}" "${S}" |
| 407 |
|
|
} |
| 408 |
|
|
|
| 409 |
|
|
# @FUNCTION: mysql-v2_src_prepare |
| 410 |
|
|
# @DESCRIPTION: |
| 411 |
|
|
# Apply patches to the source code and remove unneeded bundled libs. |
| 412 |
|
|
mysql-v2_src_prepare() { |
| 413 |
|
|
${BUILD_INHERIT}_src_prepare "$@" |
| 414 |
|
|
} |
| 415 |
|
|
|
| 416 |
|
|
# @FUNCTION: mysql-v2_src_configure |
| 417 |
|
|
# @DESCRIPTION: |
| 418 |
|
|
# Configure mysql to build the code for Gentoo respecting the use flags. |
| 419 |
|
|
mysql-v2_src_configure() { |
| 420 |
|
|
${BUILD_INHERIT}_src_configure "$@" |
| 421 |
|
|
} |
| 422 |
|
|
|
| 423 |
|
|
# @FUNCTION: mysql-v2_src_compile |
| 424 |
|
|
# @DESCRIPTION: |
| 425 |
|
|
# Compile the mysql code. |
| 426 |
|
|
mysql-v2_src_compile() { |
| 427 |
|
|
${BUILD_INHERIT}_src_compile "$@" |
| 428 |
|
|
} |
| 429 |
|
|
|
| 430 |
|
|
# @FUNCTION: mysql-v2_src_install |
| 431 |
|
|
# @DESCRIPTION: |
| 432 |
|
|
# Install mysql. |
| 433 |
|
|
mysql-v2_src_install() { |
| 434 |
|
|
${BUILD_INHERIT}_src_install "$@" |
| 435 |
|
|
} |
| 436 |
|
|
|
| 437 |
|
|
# @FUNCTION: mysql-v2_pkg_preinst |
| 438 |
|
|
# @DESCRIPTION: |
| 439 |
|
|
# Create the user and groups for mysql - die if that fails. |
| 440 |
|
|
mysql-v2_pkg_preinst() { |
| 441 |
|
|
enewgroup mysql 60 || die "problem adding 'mysql' group" |
| 442 |
|
|
enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user" |
| 443 |
|
|
} |
| 444 |
|
|
|
| 445 |
|
|
# @FUNCTION: mysql-v2_pkg_postinst |
| 446 |
|
|
# @DESCRIPTION: |
| 447 |
|
|
# Run post-installation tasks: |
| 448 |
|
|
# create the dir for logfiles if non-existant |
| 449 |
|
|
# touch the logfiles and secure them |
| 450 |
|
|
# install scripts |
| 451 |
|
|
# issue required steps for optional features |
| 452 |
|
|
# issue deprecation warnings |
| 453 |
|
|
mysql-v2_pkg_postinst() { |
| 454 |
|
|
|
| 455 |
|
|
# Make sure the vars are correctly initialized |
| 456 |
|
|
mysql_init_vars |
| 457 |
|
|
|
| 458 |
|
|
# Check FEATURES="collision-protect" before removing this |
| 459 |
jmbsvicetto |
1.12 |
[[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}" |
| 460 |
robbat2 |
1.1 |
|
| 461 |
|
|
# Secure the logfiles |
| 462 |
|
|
touch "${ROOT}${MY_LOGDIR}"/mysql.{log,err} |
| 463 |
|
|
chown mysql:mysql "${ROOT}${MY_LOGDIR}"/mysql* |
| 464 |
|
|
chmod 0660 "${ROOT}${MY_LOGDIR}"/mysql* |
| 465 |
|
|
|
| 466 |
|
|
# Minimal builds don't have the MySQL server |
| 467 |
|
|
if ! use minimal ; then |
| 468 |
|
|
docinto "support-files" |
| 469 |
|
|
for script in \ |
| 470 |
|
|
support-files/my-*.cnf \ |
| 471 |
|
|
support-files/magic \ |
| 472 |
|
|
support-files/ndb-config-2-node.ini |
| 473 |
|
|
do |
| 474 |
|
|
[[ -f "${script}" ]] \ |
| 475 |
|
|
&& dodoc "${script}" |
| 476 |
|
|
done |
| 477 |
|
|
|
| 478 |
|
|
docinto "scripts" |
| 479 |
|
|
for script in scripts/mysql* ; do |
| 480 |
|
|
[[ -f "${script}" ]] \ |
| 481 |
|
|
&& [[ "${script%.sh}" == "${script}" ]] \ |
| 482 |
|
|
&& dodoc "${script}" |
| 483 |
|
|
done |
| 484 |
|
|
|
| 485 |
|
|
einfo |
| 486 |
|
|
elog "You might want to run:" |
| 487 |
|
|
elog "\"emerge --config =${CATEGORY}/${PF}\"" |
| 488 |
|
|
elog "if this is a new install." |
| 489 |
|
|
einfo |
| 490 |
|
|
|
| 491 |
|
|
einfo |
| 492 |
|
|
elog "If you are upgrading major versions, you should run the" |
| 493 |
|
|
elog "mysql_upgrade tool." |
| 494 |
|
|
einfo |
| 495 |
|
|
fi |
| 496 |
|
|
|
| 497 |
|
|
if pbxt_available && use pbxt ; then |
| 498 |
|
|
# TODO: explain it better |
| 499 |
|
|
elog " mysql> INSTALL PLUGIN pbxt SONAME 'libpbxt.so';" |
| 500 |
|
|
elog " mysql> CREATE TABLE t1 (c1 int, c2 text) ENGINE=pbxt;" |
| 501 |
|
|
elog "if, after that, you cannot start the MySQL server," |
| 502 |
|
|
elog "remove the ${MY_DATADIR}/mysql/plugin.* files, then" |
| 503 |
|
|
elog "use the MySQL upgrade script to restore the table" |
| 504 |
|
|
elog "or execute the following SQL command:" |
| 505 |
|
|
elog " CREATE TABLE IF NOT EXISTS plugin (" |
| 506 |
|
|
elog " name char(64) binary DEFAULT '' NOT NULL," |
| 507 |
|
|
elog " dl char(128) DEFAULT '' NOT NULL," |
| 508 |
|
|
elog " PRIMARY KEY (name)" |
| 509 |
|
|
elog " ) CHARACTER SET utf8 COLLATE utf8_bin;" |
| 510 |
|
|
fi |
| 511 |
|
|
|
| 512 |
|
|
mysql_check_version_range "4.0 to 5.0.99.99" \ |
| 513 |
|
|
&& use berkdb \ |
| 514 |
|
|
&& elog "Berkeley DB support is deprecated and will be removed in future versions!" |
| 515 |
|
|
} |
| 516 |
|
|
|
| 517 |
robbat2 |
1.20 |
# @FUNCTION: mysql-v2_getopt |
| 518 |
|
|
# @DESCRIPTION: |
| 519 |
|
|
# Use my_print_defaults to extract specific config options |
| 520 |
|
|
mysql-v2_getopt() { |
| 521 |
|
|
local mypd="${EROOT}"/usr/bin/my_print_defaults |
| 522 |
|
|
section="$1" |
| 523 |
|
|
flag="--${2}=" |
| 524 |
|
|
"${mypd}" $section | sed -n "/^${flag}/p" |
| 525 |
|
|
} |
| 526 |
|
|
|
| 527 |
|
|
# @FUNCTION: mysql-v2_getoptval |
| 528 |
|
|
# @DESCRIPTION: |
| 529 |
|
|
# Use my_print_defaults to extract specific config options |
| 530 |
|
|
mysql-v2_getoptval() { |
| 531 |
|
|
local mypd="${EROOT}"/usr/bin/my_print_defaults |
| 532 |
|
|
section="$1" |
| 533 |
|
|
flag="--${2}=" |
| 534 |
|
|
"${mypd}" $section | sed -n "/^${flag}/s,${flag},,gp" |
| 535 |
|
|
} |
| 536 |
|
|
|
| 537 |
robbat2 |
1.1 |
# @FUNCTION: mysql-v2_pkg_config |
| 538 |
|
|
# @DESCRIPTION: |
| 539 |
|
|
# Configure mysql environment. |
| 540 |
|
|
mysql-v2_pkg_config() { |
| 541 |
|
|
|
| 542 |
|
|
local old_MY_DATADIR="${MY_DATADIR}" |
| 543 |
robbat2 |
1.20 |
local old_HOME="${HOME}" |
| 544 |
|
|
# my_print_defaults needs to read stuff in $HOME/.my.cnf |
| 545 |
|
|
export HOME=/root |
| 546 |
robbat2 |
1.1 |
|
| 547 |
|
|
# Make sure the vars are correctly initialized |
| 548 |
|
|
mysql_init_vars |
| 549 |
|
|
|
| 550 |
|
|
[[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR" |
| 551 |
|
|
|
| 552 |
|
|
if built_with_use ${CATEGORY}/${PN} minimal ; then |
| 553 |
|
|
die "Minimal builds do NOT include the MySQL server" |
| 554 |
|
|
fi |
| 555 |
|
|
|
| 556 |
|
|
if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then |
| 557 |
ferringb |
1.18 |
local MY_DATADIR_s="${ROOT}/${MY_DATADIR}" |
| 558 |
|
|
MY_DATADIR_s="${MY_DATADIR_s%%/}" |
| 559 |
robbat2 |
1.20 |
local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}" |
| 560 |
ferringb |
1.18 |
old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}" |
| 561 |
robbat2 |
1.1 |
|
| 562 |
robbat2 |
1.20 |
if [[ -d "${old_MY_DATADIR_s}" ]] && [[ "${old_MY_DATADIR_s}" != / ]]; then |
| 563 |
robbat2 |
1.1 |
if [[ -d "${MY_DATADIR_s}" ]]; then |
| 564 |
|
|
ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist" |
| 565 |
|
|
ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}" |
| 566 |
|
|
else |
| 567 |
|
|
elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}" |
| 568 |
|
|
mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \ |
| 569 |
|
|
|| die "Moving MY_DATADIR failed" |
| 570 |
|
|
fi |
| 571 |
|
|
else |
| 572 |
|
|
ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist" |
| 573 |
|
|
if [[ -d "${MY_DATADIR_s}" ]]; then |
| 574 |
|
|
ewarn "Attempting to use ${MY_DATADIR_s}" |
| 575 |
|
|
else |
| 576 |
|
|
eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist" |
| 577 |
|
|
die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}" |
| 578 |
|
|
fi |
| 579 |
|
|
fi |
| 580 |
|
|
fi |
| 581 |
|
|
|
| 582 |
|
|
local pwd1="a" |
| 583 |
|
|
local pwd2="b" |
| 584 |
|
|
local maxtry=15 |
| 585 |
|
|
|
| 586 |
robbat2 |
1.20 |
if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then |
| 587 |
|
|
MYSQL_ROOT_PASSWORD="$(mysql-v2_getoptval 'client mysql' password)" |
| 588 |
|
|
fi |
| 589 |
|
|
MYSQL_TMPDIR="$(mysql-v2_getoptval mysqld tmpdir)" |
| 590 |
|
|
# These are dir+prefix |
| 591 |
|
|
MYSQL_RELAY_LOG="$(mysql-v2_getoptval mysqld relay-log)" |
| 592 |
|
|
MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*} |
| 593 |
|
|
MYSQL_LOG_BIN="$(mysql-v2_getoptval mysqld log-bin)" |
| 594 |
|
|
MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*} |
| 595 |
|
|
|
| 596 |
|
|
if [[ ! -d "${EROOT}"/$MYSQL_TMPDIR ]]; then |
| 597 |
|
|
einfo "Creating MySQL tmpdir $MYSQL_TMPDIR" |
| 598 |
|
|
install -d -m 770 -o mysql -g mysql "${EROOT}"/$MYSQL_TMPDIR |
| 599 |
|
|
fi |
| 600 |
|
|
if [[ ! -d "${EROOT}"/$MYSQL_LOG_BIN ]]; then |
| 601 |
|
|
einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN" |
| 602 |
|
|
install -d -m 770 -o mysql -g mysql "${EROOT}"/$MYSQL_LOG_BIN |
| 603 |
|
|
fi |
| 604 |
|
|
if [[ ! -d "${EROOT}"/$MYSQL_RELAY_LOG ]]; then |
| 605 |
|
|
einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG" |
| 606 |
|
|
install -d -m 770 -o mysql -g mysql "${EROOT}"/$MYSQL_RELAY_LOG |
| 607 |
robbat2 |
1.1 |
fi |
| 608 |
|
|
|
| 609 |
|
|
if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then |
| 610 |
|
|
ewarn "You have already a MySQL database in place." |
| 611 |
|
|
ewarn "(${ROOT}/${MY_DATADIR}/*)" |
| 612 |
|
|
ewarn "Please rename or delete it if you wish to replace it." |
| 613 |
|
|
die "MySQL database already exists!" |
| 614 |
|
|
fi |
| 615 |
|
|
|
| 616 |
|
|
# Bug #213475 - MySQL _will_ object strenously if your machine is named |
| 617 |
|
|
# localhost. Also causes weird failures. |
| 618 |
|
|
[[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
| 619 |
|
|
|
| 620 |
|
|
if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then |
| 621 |
|
|
|
| 622 |
|
|
einfo "Please provide a password for the mysql 'root' user now, in the" |
| 623 |
|
|
einfo "MYSQL_ROOT_PASSWORD env var or through the /root/.my.cnf file." |
| 624 |
|
|
ewarn "Avoid [\"'\\_%] characters in the password" |
| 625 |
|
|
read -rsp " >" pwd1 ; echo |
| 626 |
|
|
|
| 627 |
|
|
einfo "Retype the password" |
| 628 |
|
|
read -rsp " >" pwd2 ; echo |
| 629 |
|
|
|
| 630 |
|
|
if [[ "x$pwd1" != "x$pwd2" ]] ; then |
| 631 |
|
|
die "Passwords are not the same" |
| 632 |
|
|
fi |
| 633 |
|
|
MYSQL_ROOT_PASSWORD="${pwd1}" |
| 634 |
|
|
unset pwd1 pwd2 |
| 635 |
|
|
fi |
| 636 |
|
|
|
| 637 |
robbat2 |
1.20 |
local options="--log-warnings=0" |
| 638 |
robbat2 |
1.1 |
local sqltmp="$(emktemp)" |
| 639 |
|
|
|
| 640 |
|
|
local help_tables="${ROOT}${MY_SHAREDSTATEDIR}/fill_help_tables.sql" |
| 641 |
|
|
[[ -r "${help_tables}" ]] \ |
| 642 |
|
|
&& cp "${help_tables}" "${TMPDIR}/fill_help_tables.sql" \ |
| 643 |
|
|
|| touch "${TMPDIR}/fill_help_tables.sql" |
| 644 |
|
|
help_tables="${TMPDIR}/fill_help_tables.sql" |
| 645 |
robbat2 |
1.20 |
|
| 646 |
|
|
# Figure out which options we need to disable to do the setup |
| 647 |
|
|
helpfile="${TMPDIR}/mysqld-help" |
| 648 |
|
|
${EROOT}/usr/sbin/mysqld --verbose --help >"${helpfile}" 2>/dev/null |
| 649 |
|
|
for opt in grant-tables host-cache name-resolve networking slave-start bdb \ |
| 650 |
|
|
federated innodb ssl log-bin relay-log slow-query-log external-locking \ |
| 651 |
|
|
ndbcluster log-slave-updates \ |
| 652 |
|
|
; do |
| 653 |
|
|
optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}" |
| 654 |
|
|
egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}" |
| 655 |
|
|
done |
| 656 |
|
|
# But some options changed names |
| 657 |
|
|
egrep -sq external-locking "${helpfile}" && \ |
| 658 |
|
|
options="${options/skip-locking/skip-external-locking}" |
| 659 |
|
|
|
| 660 |
|
|
use prefix || options="${options} --user=mysql" |
| 661 |
robbat2 |
1.1 |
|
| 662 |
|
|
pushd "${TMPDIR}" &>/dev/null |
| 663 |
robbat2 |
1.20 |
#cmd="'${EROOT}/usr/share/mysql/scripts/mysql_install_db' '--basedir=${EPREFIX}/usr' ${options}" |
| 664 |
|
|
cmd=${EROOT}usr/share/mysql/scripts/mysql_install_db |
| 665 |
|
|
[ -f ${cmd} ] || cmd=${EROOT}usr/bin/mysql_install_db |
| 666 |
|
|
cmd="'$cmd' '--basedir=${EPREFIX}/usr' ${options}" |
| 667 |
|
|
einfo "Command: $cmd" |
| 668 |
|
|
eval $cmd \ |
| 669 |
|
|
>"${TMPDIR}"/mysql_install_db.log 2>&1 |
| 670 |
robbat2 |
1.1 |
if [ $? -ne 0 ]; then |
| 671 |
|
|
grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2 |
| 672 |
jmbsvicetto |
1.12 |
die "Failed to run mysql_install_db. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log" |
| 673 |
robbat2 |
1.1 |
fi |
| 674 |
|
|
popd &>/dev/null |
| 675 |
|
|
[[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \ |
| 676 |
|
|
|| die "MySQL databases not installed" |
| 677 |
|
|
chown -R mysql:mysql "${ROOT}/${MY_DATADIR}" 2>/dev/null |
| 678 |
|
|
chmod 0750 "${ROOT}/${MY_DATADIR}" 2>/dev/null |
| 679 |
|
|
|
| 680 |
|
|
# Filling timezones, see |
| 681 |
|
|
# http://dev.mysql.com/doc/mysql/en/time-zone-support.html |
| 682 |
jmbsvicetto |
1.12 |
"${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null |
| 683 |
robbat2 |
1.1 |
|
| 684 |
|
|
if [[ -r "${help_tables}" ]] ; then |
| 685 |
|
|
cat "${help_tables}" >> "${sqltmp}" |
| 686 |
|
|
fi |
| 687 |
|
|
|
| 688 |
|
|
einfo "Creating the mysql database and setting proper" |
| 689 |
|
|
einfo "permissions on it ..." |
| 690 |
|
|
|
| 691 |
jmbsvicetto |
1.12 |
local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock" |
| 692 |
|
|
local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid" |
| 693 |
|
|
local mysqld="${EROOT}/usr/sbin/mysqld \ |
| 694 |
robbat2 |
1.1 |
${options} \ |
| 695 |
|
|
--user=mysql \ |
| 696 |
robbat2 |
1.20 |
--log-warnings=0 \ |
| 697 |
jmbsvicetto |
1.12 |
--basedir=${EROOT}/usr \ |
| 698 |
robbat2 |
1.1 |
--datadir=${ROOT}/${MY_DATADIR} \ |
| 699 |
|
|
--max_allowed_packet=8M \ |
| 700 |
|
|
--net_buffer_length=16K \ |
| 701 |
|
|
--default-storage-engine=MyISAM \ |
| 702 |
|
|
--socket=${socket} \ |
| 703 |
|
|
--pid-file=${pidfile}" |
| 704 |
|
|
#einfo "About to start mysqld: ${mysqld}" |
| 705 |
|
|
ebegin "Starting mysqld" |
| 706 |
robbat2 |
1.20 |
einfo "Command ${mysqld}" |
| 707 |
robbat2 |
1.1 |
${mysqld} & |
| 708 |
|
|
rc=$? |
| 709 |
|
|
while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do |
| 710 |
|
|
maxtry=$((${maxtry}-1)) |
| 711 |
|
|
echo -n "." |
| 712 |
|
|
sleep 1 |
| 713 |
|
|
done |
| 714 |
|
|
eend $rc |
| 715 |
|
|
|
| 716 |
|
|
if ! [[ -S "${socket}" ]]; then |
| 717 |
|
|
die "Completely failed to start up mysqld with: ${mysqld}" |
| 718 |
|
|
fi |
| 719 |
|
|
|
| 720 |
|
|
ebegin "Setting root password" |
| 721 |
|
|
# Do this from memory, as we don't want clear text passwords in temp files |
| 722 |
|
|
local sql="UPDATE mysql.user SET Password = PASSWORD('${MYSQL_ROOT_PASSWORD}') WHERE USER='root'" |
| 723 |
jmbsvicetto |
1.12 |
"${EROOT}/usr/bin/mysql" \ |
| 724 |
robbat2 |
1.1 |
--socket=${socket} \ |
| 725 |
|
|
-hlocalhost \ |
| 726 |
|
|
-e "${sql}" |
| 727 |
|
|
eend $? |
| 728 |
|
|
|
| 729 |
|
|
ebegin "Loading \"zoneinfo\", this step may require a few seconds ..." |
| 730 |
jmbsvicetto |
1.12 |
"${EROOT}/usr/bin/mysql" \ |
| 731 |
robbat2 |
1.1 |
--socket=${socket} \ |
| 732 |
|
|
-hlocalhost \ |
| 733 |
|
|
-uroot \ |
| 734 |
robbat2 |
1.20 |
--password="${MYSQL_ROOT_PASSWORD}" \ |
| 735 |
robbat2 |
1.1 |
mysql < "${sqltmp}" |
| 736 |
|
|
rc=$? |
| 737 |
|
|
eend $? |
| 738 |
|
|
[ $rc -ne 0 ] && ewarn "Failed to load zoneinfo!" |
| 739 |
|
|
|
| 740 |
|
|
# Stop the server and cleanup |
| 741 |
|
|
einfo "Stopping the server ..." |
| 742 |
|
|
kill $(< "${pidfile}" ) |
| 743 |
|
|
rm -f "${sqltmp}" |
| 744 |
|
|
wait %1 |
| 745 |
|
|
einfo "Done" |
| 746 |
|
|
} |
| 747 |
|
|
|
| 748 |
|
|
# @FUNCTION: mysql-v2_pkg_postrm |
| 749 |
|
|
# @DESCRIPTION: |
| 750 |
|
|
# Remove mysql symlinks. |
| 751 |
|
|
mysql-v2_pkg_postrm() { |
| 752 |
|
|
|
| 753 |
jmbsvicetto |
1.12 |
: # mysql_lib_symlinks "${ED}" |
| 754 |
robbat2 |
1.1 |
} |