mysql: Make S97mysqld source a default file
authorEloi BAIL <eloi.bail@savoirfairelinux.com>
Thu, 13 Oct 2016 18:28:02 +0000 (14:28 -0400)
committerPeter Korsgaard <peter@korsgaard.com>
Sat, 15 Oct 2016 09:21:27 +0000 (11:21 +0200)
Hardcoded parameters are used for mysql user/directory.

Make S97mysqld source a /etc/default/mysql file where these
parameters can be overridden.

Signed-off-by: Eloi BAIL <eloi.bail@savoirfairelinux.com>
Tested-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
package/mysql/S97mysqld

index 5a660e94245a8bc1786b2ab4a9ee1ef7274ce4a3..110ca2cd12d77b2d890bb3eb7d9de2a6e66396aa 100644 (file)
@@ -1,10 +1,15 @@
 #!/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