mysql: Make S97mysqld source a default file
PATCH 1/1 mysql: Make S97mysqld source a default file
Hardcoded parameters are used for mysql installation. Make S97mysqld source a /etc/default/mysql file where these parameters can be overridden.
--- package/mysql/S97mysqld | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
package/mysql/S97mysqld +6 -2
@@ -1,10 +1,14 @@ #!/bin/sh +MYSQL_DIR="/var/mysql" +MYSQL_USER="mysql" +[ -r /etc/default/mysql ] && . /etc/default/mysql + case "$1" in start) - if [ ! -d /var/mysql/mysql ] ; then + if [ ! -d $MYSQL_DIR/mysql ] ; then echo "Creating MySQL system tables..." - mysql_install_db --user=mysql --ldata=/var/mysql + mysql_install_db --user=$MYSQL_USER --ldata=$MYSQL_DIR fi # mysqld runs as user mysql, but /run is only writable by root
Signature · 1 line
2.7.4
PATCH 1/1 mysql: Make S97mysqld source a default file
Hello Eloi,
Quoted 5 lines · Eloi BAIL
Hardcoded parameters are used for mysql installation. Make S97mysqld source a
/etc/default/mysqlfile where these parameters can be overridden.Signed-off-by Eloi BAIL <[email protected]>
I've done a run test on qemu creating different /etc/default/mysql files. Everything worked as expected, so...
However I'm not sure if this approach is correct as someone may expect a different content in the default file. For instance a content compatible to be used with the --defaults-file and --defaults-extra-file options:
[mysql_install_db]
user = mysql
datadir = /var/mysql
Why don't we call mysql_install_db with those options passing that kind of default file, instead of sourcing it as you do in your patch? There are two options to do that. The first one is doing it manually (not in the init script). The second one is to do it in the init script, as is done right now, but we would need to grab the value of "datadir" with something like "grep datadir /etc/default/mysql | cut -d= -f2".
Let's see what the others devs think about it.
Regards,
Vincent.
Quoted 26 lines
--- package/mysql/S97mysqld | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)package/mysql/S97mysqld +6
-2@@ -1,10 +1,14 @@ #!/bin/sh +MYSQL_DIR="/var/mysql" +MYSQL_USER="mysql" +[ -r /etc/default/mysql ] && . /etc/default/mysql + case "$1" in start) - if [ ! -d /var/mysql/mysql ] ; then + if [ ! -d $MYSQL_DIR/mysql ] ; then echo "Creating MySQL system tables..." - mysql_install_db --user=mysql --ldata=/var/mysql + mysql_install_db --user=$MYSQL_USER --ldata=$MYSQL_DIR fi # mysqld runs as user mysql, but /run is only writable by root
PATCH 1/1 mysql: Make S97mysqld source a default file
In reply to Eloi BAILQuoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Eloi" == Eloi BAIL <[email protected]> writes:
Hardcoded parameters are used for mysql installation. Make S97mysqld source a
/etc/default/mysqlfile where these parameters can be overridden.Signed-off-by Eloi BAIL <[email protected]>
Committed, thanks.
Signature · 1 line
Bye, Peter Korsgaard