# This is data only part of buildout for mysql with senna
# made by Leonardo Rochael Almeida <leorochael@gmail.com> (thanks!)
# Original place: https://svn.erp5.org/repos/public/experimental/mysqlsenna.buildout/

[buildout]
parts =
    ports
    env
    mysql-bin
    mysql-admin
    mysql_install_db
    mycnf
    mysqld-bin

[ports]
recipe = plone.recipe.command
command = 
    echo The following configuration items are active for this buildout
    echo MySQL: ${:mysql}
mysql = 10002

[env]
recipe = gocept.recipe.env

[mysql-bin]
recipe = collective.recipe.template
input = ${buildout:directory}/mysql-instance/templates/mysql.in
output = ${buildout:directory}/bin/mysql

[mysql-admin]
recipe = collective.recipe.template
input = ${buildout:directory}/mysql-instance/templates/mysqladmin.in
output = ${buildout:directory}/bin/mysqladmin

[mysqld-bin]
recipe = collective.recipe.template
input = ${buildout:directory}/mysql-instance/templates/mysqld.in
output = ${buildout:directory}/bin/mysqld

[mysql_install_db]
recipe = plone.recipe.command
command = 
    ${software_definition:mysql_software}/bin/mysql_install_db --datadir=${mycnf:datadir}
update-command = ${mysql_install_db:command}

[mycnf]
recipe = plone.recipe.command
command =
basedir=${software_definition:mysql_software}
datadir=${buildout:mysql_datadir}
# files shall be in better places
pid=${:datadir}/mysql.pid
err = ${buildout:directory}/var/mysql.err.log
sock = ${:datadir}/mysql.sock
opt = --port=${ports:mysql} --pid-file=${:pid} --log-error=${:err} --basedir=${:basedir} --datadir=${:datadir} --socket=${:sock} --no-defaults