diff options
author | Mahdi Mokhtari <mmokhi@FreeBSD.org> | 2017-02-22 17:25:22 +0000 |
---|---|---|
committer | Mahdi Mokhtari <mmokhi@FreeBSD.org> | 2017-02-22 17:25:22 +0000 |
commit | b9db44685476e6a101274773887c7b4d1eb1a3f3 (patch) | |
tree | d97795e34ca9bf0c375b8b41d95af2095574a50c | |
parent | cf3ae113910d2084e878d6b5e50f32298e386b79 (diff) | |
download | ports-b9db44685476e6a101274773887c7b4d1eb1a3f3.tar.gz ports-b9db44685476e6a101274773887c7b4d1eb1a3f3.zip |
databases/mysql{56 57 80}:
Improve ${mysql_optfile} default usage in rc script.
Improve pkg-message.
Reviewed by: feld, mat
Approved by: feld, mat (mentors)
Differential Revision: https://reviews.freebsd.org/D9646
Notes
Notes:
svn path=/head/; revision=434623
-rw-r--r-- | databases/mysql56-server/Makefile | 9 | ||||
-rw-r--r-- | databases/mysql56-server/files/mysql-server.in | 22 | ||||
-rw-r--r-- | databases/mysql57-server/Makefile | 9 | ||||
-rw-r--r-- | databases/mysql57-server/files/mysql-server.in | 30 | ||||
-rw-r--r-- | databases/mysql57-server/pkg-message | 12 | ||||
-rw-r--r-- | databases/mysql80-server/Makefile | 8 | ||||
-rw-r--r-- | databases/mysql80-server/files/mysql-server.in | 34 | ||||
-rw-r--r-- | databases/mysql80-server/pkg-message | 18 |
8 files changed, 71 insertions, 71 deletions
diff --git a/databases/mysql56-server/Makefile b/databases/mysql56-server/Makefile index 42959933db3a..bfc4ea868030 100644 --- a/databases/mysql56-server/Makefile +++ b/databases/mysql56-server/Makefile @@ -3,7 +3,7 @@ PORTNAME?= mysql PORTVERSION= 5.6.35 -PORTREVISION?= 5 +PORTREVISION?= 6 CATEGORIES= databases ipv6 MASTER_SITES= MYSQL/MySQL-5.6 PKGNAMESUFFIX?= 56-server @@ -126,8 +126,10 @@ FEATURES_DESC= Default features knobs PERFSCHM_DESC= Enable "Performance Schema" by default (High RAM usage) OPTIONS_DEFAULT+= PERFSCHM -PERFSCHM_SUB_LIST+= PERFSCHEMRC="" -PERFSCHM_SUB_LIST_OFF+= PERFSCHEMRC="--skip-performance-schema" +PERFSCHM_SUB_LIST+= PERFSCHEMRC="" +PERFSCHM_SUB_LIST_OFF+= PERFSCHEMRC="--skip-performance-schema" +FEDERATED_SUB_LIST+= FEDER="--federated" +FEDERATED_SUB_LIST_OFF+= FEDER="" .endif .include <bsd.port.pre.mk> @@ -139,7 +141,6 @@ post-patch: post-install: ${MKDIR} ${STAGEDIR}${ETCDIR} ${INSTALL_DATA} ${WRKDIR}/my.cnf.sample ${STAGEDIR}${ETCDIR}/my.cnf.sample - ${MKDIR} ${STAGEDIR}${ETCDIR}/keyring ${MKDIR} ${STAGEDIR}${MY_SECDIR} ${MKDIR} ${STAGEDIR}${MY_TMPDIR} diff --git a/databases/mysql56-server/files/mysql-server.in b/databases/mysql56-server/files/mysql-server.in index b5015e5505f3..8c1a62cd41df 100644 --- a/databases/mysql56-server/files/mysql-server.in +++ b/databases/mysql56-server/files/mysql-server.in @@ -14,10 +14,14 @@ # mysql_limits (bool): Set to "NO" by default. # Set it to yes to run `limits -e -U mysql` # just before mysql starts. -# mysql_dbdir (str): Default to "/var/db/mysql" +# mysql_dbdir (str): Default to "%%MY_DBDIR%%" # Base database directory. +# mysql_confdir (str): Default to "%%ETCDIR%%" +# Base configuration directory. # mysql_optfile (str): Server-specific option file. -# Default to "${mysql_dbdir}/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 @@ -33,20 +37,28 @@ load_rc_config $name : ${mysql_enable="NO"} : ${mysql_limits="NO"} -: ${mysql_dbdir="/var/db/mysql"} +: ${mysql_dbdir="%%MY_DBDIR%%"} +: ${mysql_confdir="%%ETCDIR%%"} +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" 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} --user=${mysql_user} --datadir=${mysql_dbdir} --pid-file=${pidfile} ${mysql_args}" +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="--basedir=%%PREFIX%% --defaults-extra-file=${mysql_optfile} --datadir=${mysql_dbdir} --force" +mysql_install_db_args="${mysql_extra} --basedir=%%PREFIX%% --datadir=${mysql_dbdir} --force" mysql_create_auth_tables() { diff --git a/databases/mysql57-server/Makefile b/databases/mysql57-server/Makefile index 0e12d0411ff6..c0bde42ec1ea 100644 --- a/databases/mysql57-server/Makefile +++ b/databases/mysql57-server/Makefile @@ -3,7 +3,7 @@ PORTNAME?= mysql PORTVERSION= 5.7.17 -PORTREVISION?= 2 +PORTREVISION?= 3 CATEGORIES= databases ipv6 MASTER_SITES= MYSQL/MySQL-5.7 PKGNAMESUFFIX?= 57-server @@ -125,8 +125,10 @@ FEATURES_DESC= Default features knobs PERFSCHM_DESC= Enable "Performance Schema" by default (High RAM usage) OPTIONS_DEFAULT+= PERFSCHM -PERFSCHM_SUB_LIST+= PERFSCHEMRC="" -PERFSCHM_SUB_LIST_OFF+= PERFSCHEMRC="--skip-performance-schema" +PERFSCHM_SUB_LIST+= PERFSCHEMRC="" +PERFSCHM_SUB_LIST_OFF+= PERFSCHEMRC="--skip-performance-schema" +FEDERATED_SUB_LIST+= FEDER="--federated" +FEDERATED_SUB_LIST_OFF+= FEDER="" .endif .include <bsd.port.pre.mk> @@ -147,7 +149,6 @@ post-patch: post-install: ${MKDIR} ${STAGEDIR}${ETCDIR} ${INSTALL_DATA} ${WRKDIR}/my.cnf.sample ${STAGEDIR}${ETCDIR}/my.cnf.sample - ${MKDIR} ${STAGEDIR}${ETCDIR}/keyring ${MKDIR} ${STAGEDIR}${MY_SECDIR} ${MKDIR} ${STAGEDIR}${MY_TMPDIR} 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 diff --git a/databases/mysql57-server/pkg-message b/databases/mysql57-server/pkg-message index 50a3fb8fb482..751330e3ab70 100644 --- a/databases/mysql57-server/pkg-message +++ b/databases/mysql57-server/pkg-message @@ -7,14 +7,8 @@ Initial password for first time use of MySQL is saved in $HOME/.mysql_secret ie. when you want to use "mysql -u root -p" first you should see password in /root/.mysql_secret -***************************************************************************** - -***************************************************************************** - -The default location for my.cnf has changed from "/var/db/mysql/my.cnf" to -"/usr/local/etc/mysql/my.cnf". Existing my.cnf files must be merged manually -with the new default and moved to the new location. To continue using the -my.cnf file at the old location, set "mysql_optfile" in /etc/rc.conf to -point to the location of the existing my.cnf file. +MySQL57 has a default %%ETCDIR%%/my.cnf, +remember to replace it wit your own +or set `mysql_optfile="$YOUR_CNF_FILE` in rc.conf. ***************************************************************************** diff --git a/databases/mysql80-server/Makefile b/databases/mysql80-server/Makefile index 69abe26b055b..6f6f54e14ec5 100644 --- a/databases/mysql80-server/Makefile +++ b/databases/mysql80-server/Makefile @@ -4,7 +4,7 @@ PORTNAME?= mysql PORTVERSION= 8.0.0 DISTVERSIONSUFFIX?= -dmr -PORTREVISION?= 2 +PORTREVISION?= 3 CATEGORIES= databases ipv6 MASTER_SITES= MYSQL/MySQL-8.0 PKGNAMESUFFIX?= 80-server @@ -127,8 +127,10 @@ FEATURES_DESC= Default features knobs PERFSCHM_DESC= Enable "Performance Schema" by default (High RAM usage) OPTIONS_DEFAULT+= PERFSCHM -PERFSCHM_SUB_LIST+= PERFSCHEMRC="" -PERFSCHM_SUB_LIST_OFF+= PERFSCHEMRC="--skip-performance-schema" +PERFSCHM_SUB_LIST+= PERFSCHEMRC="" +PERFSCHM_SUB_LIST_OFF+= PERFSCHEMRC="--skip-performance-schema" +FEDERATED_SUB_LIST+= FEDER="--federated" +FEDERATED_SUB_LIST_OFF+= FEDER="" .endif .include <bsd.port.pre.mk> diff --git a/databases/mysql80-server/files/mysql-server.in b/databases/mysql80-server/files/mysql-server.in index 03c57e7d15b8..7b86d4e2e047 100644 --- a/databases/mysql80-server/files/mysql-server.in +++ b/databases/mysql80-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,32 +53,21 @@ 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}" +mysqld_init="${procname}" +mysqld_init_args="${mysql_extra} --initialize-insecure --basedir=%%PREFIX%% --datadir=${mysql_dbdir} --user=${mysql_user}" mysql_create_auth_tables() { - eval $mysql_install_db $mysql_install_db_args >/dev/null 2>/dev/null + eval $mysqld_init $mysqld_init_args >/dev/null 2>/dev/null } 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 diff --git a/databases/mysql80-server/pkg-message b/databases/mysql80-server/pkg-message index 02103edffd0d..ccf2f03323bd 100644 --- a/databases/mysql80-server/pkg-message +++ b/databases/mysql80-server/pkg-message @@ -1,16 +1,18 @@ ***************************************************************************** -Remember to run mysql_upgrade the first time you start the MySQL server -after an upgrade from an earlier version. - -Initial password for first time use of MySQL is saved in $HOME/.mysql_secret -ie. when you want to use "mysql -u root -p" first you should see password -in /root/.mysql_secret +WARNING: THIS IS STILL-IN-DEV PROJECT! USE WITH CAUTION ON PRODUCTION ENVS! ***************************************************************************** - ***************************************************************************** -WARNING: THIS IS STILL-IN-DEV PROJECT! USE WITH CAUTION ON PRODUCTION ENVS! +Remember to run mysql_upgrade the first time you start the MySQL server +after an upgrade from an earlier version. + +There is no initial password for first time use of MySQL. +Keep in mind to reset it to a secure password. + +MySQL80 has a default %%ETCDIR%%/my.cnf, +remember to replace it wit your own +or set `mysql_optfile="$YOUR_CNF_FILE` in rc.conf. ***************************************************************************** |