diff options
Diffstat (limited to 'databases/mysql57-server/files/mysql-server.in')
-rw-r--r-- | databases/mysql57-server/files/mysql-server.in | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/databases/mysql57-server/files/mysql-server.in b/databases/mysql57-server/files/mysql-server.in index 03c57e7d15b8..cafd13f414aa 100644 --- a/databases/mysql57-server/files/mysql-server.in +++ b/databases/mysql57-server/files/mysql-server.in @@ -19,7 +19,9 @@ # mysql_confdir (str): Default to "%%ETCDIR%%" # Base configuration directory. # mysql_optfile (str): Server-specific option file. -# Default to "${mysql_confdir}/my.cnf". +# Set it in the rc.conf or default behaviour of +# `mysqld_safe` itself, will be picking +# ${mysql_confdir}/my.cnf if it exists. # mysql_pidfile (str): Custum PID file path and name. # Default to "${mysql_dbdir}/${hostname}.pid". # mysql_args (str): Custom additional arguments to be passed @@ -37,10 +39,13 @@ load_rc_config $name : ${mysql_limits="NO"} : ${mysql_dbdir="%%MY_DBDIR%%"} : ${mysql_confdir="%%ETCDIR%%"} -if [ -f "${mysql_dbdir}/my.cnf" ]; then -: ${mysql_optfile="${mysql_dbdir}/my.cnf"} -else +if [ -f "${mysql_confdir}/my.cnf" ]; then : ${mysql_optfile="${mysql_confdir}/my.cnf"} +elif [ -f "${mysql_dbdir}/my.cnf" ]; then +: ${mysql_optfile="${mysql_dbdir}/my.cnf"} +fi +if [ ! -z "${mysql_optfile}" ]; then +mysql_extra="--defaults-extra-file=${mysql_optfile}" fi mysql_user="mysql" @@ -48,12 +53,12 @@ mysql_limits_args="-e -U ${mysql_user}" : ${hostname:=`/bin/hostname`} pidfile=${mysql_pidfile:-"${mysql_dbdir}/${hostname}.pid"} command="/usr/sbin/daemon" -command_args="-c -f %%PREFIX%%/bin/mysqld_safe --defaults-extra-file=${mysql_optfile} --basedir=%%PREFIX%% --datadir=${mysql_dbdir} --pid-file=${pidfile} --user=${mysql_user} ${mysql_args} %%PERFSCHEMRC%%" +command_args="-c -f %%PREFIX%%/bin/mysqld_safe ${mysql_extra} --basedir=%%PREFIX%% --datadir=${mysql_dbdir} --pid-file=${pidfile} --user=${mysql_user} ${mysql_args} %%FEDER%% %%PERFSCHEMRC%%" procname="%%PREFIX%%/libexec/mysqld" start_precmd="${name}_prestart" start_postcmd="${name}_poststart" mysql_install_db="%%PREFIX%%/bin/mysql_install_db" -mysql_install_db_args="--defaults-extra-file=${mysql_optfile} --basedir=%%PREFIX%% --datadir=${mysql_dbdir} --mysqld-file=${procname} --user=${mysql_user}" +mysql_install_db_args="${mysql_extra} --basedir=%%PREFIX%% --datadir=${mysql_dbdir} --mysqld-file=${procname} --user=${mysql_user}" mysql_create_auth_tables() { @@ -62,18 +67,7 @@ mysql_create_auth_tables() mysql_prestart() { - if [ -f "${mysql_dbdir}/my.cnf" ]; then - echo "" - echo "Please keep in mind that the default location for my.cnf has changed" - echo "from \"%%MY_DBDIR%%/my.cnf\" to \"%%ETCDIR%%/my.cnf\". " - echo "Please merge your existing my.cnf with the new default and move" - echo "it to \"%%ETCDIR%%/my.cnf\"." - echo "If you do not want to move your my.cnf to the new location then" - echo "you must set \"mysql_optfile\" in /etc/rc.conf to \"/var/db/mysql/my.cnf\"." - echo "" - fi - - if [ ! -d "${mysql_dbdir}/mysql" ]; then + if [ ! -d "${mysql_dbdir}/mysql/." ]; then mysql_create_auth_tables || return 1 fi if checkyesno mysql_limits; then |