# 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 =
    mysql-bin
    mysql-admin
    mysqld-bin
    mysql-instance
    start-mysql-instance

[configuration]
mysql_port = 10002
mysql_host = 127.0.0.1
mysql_datadir = ${buildout:directory}/var/mysql
mysql_pid = ${:mysql_datadir}/mysql.pid
mysql_sock = ${:mysql_datadir}/mysql.sock
mysql_error_log = ${buildout:directory}/var/log/mysql.err.log

[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-instance]
recipe = plone.recipe.command
command = 
    mkdir -p ${buildout:directory}/var/log/
    ${software_definition:mysql_software}/bin/mysql_install_db --datadir=${configuration:mysql_datadir}
update-command = ${:command}

[start-mysql-instance]
recipe = plone.recipe.command
command = ${buildout:bin-directory}/mysqld &
update-command = ${:command}

[stop-mysql-instance]
recipe = plone.recipe.command
command = kill `cat ${configuration:mysql_pid}`
update-command = ${:command}