From owner-svn-ports-head@freebsd.org Wed Feb 22 17:25:24 2017 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 077C4CE9697; Wed, 22 Feb 2017 17:25:24 +0000 (UTC) (envelope-from mmokhi@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C6E6722E; Wed, 22 Feb 2017 17:25:23 +0000 (UTC) (envelope-from mmokhi@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1MHPMdD080324; Wed, 22 Feb 2017 17:25:22 GMT (envelope-from mmokhi@FreeBSD.org) Received: (from mmokhi@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1MHPMM8080316; Wed, 22 Feb 2017 17:25:22 GMT (envelope-from mmokhi@FreeBSD.org) Message-Id: <201702221725.v1MHPMM8080316@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmokhi set sender to mmokhi@FreeBSD.org using -f From: Mahdi Mokhtari Date: Wed, 22 Feb 2017 17:25:22 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r434623 - in head/databases: mysql56-server mysql56-server/files mysql57-server mysql57-server/files mysql80-server mysql80-server/files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Feb 2017 17:25:24 -0000 Author: mmokhi Date: Wed Feb 22 17:25:22 2017 New Revision: 434623 URL: https://svnweb.freebsd.org/changeset/ports/434623 Log: 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 Modified: head/databases/mysql56-server/Makefile head/databases/mysql56-server/files/mysql-server.in head/databases/mysql57-server/Makefile head/databases/mysql57-server/files/mysql-server.in head/databases/mysql57-server/pkg-message head/databases/mysql80-server/Makefile head/databases/mysql80-server/files/mysql-server.in head/databases/mysql80-server/pkg-message Modified: head/databases/mysql56-server/Makefile ============================================================================== --- head/databases/mysql56-server/Makefile Wed Feb 22 17:17:49 2017 (r434622) +++ head/databases/mysql56-server/Makefile Wed Feb 22 17:25:22 2017 (r434623) @@ -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 @@ -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} Modified: head/databases/mysql56-server/files/mysql-server.in ============================================================================== --- head/databases/mysql56-server/files/mysql-server.in Wed Feb 22 17:17:49 2017 (r434622) +++ head/databases/mysql56-server/files/mysql-server.in Wed Feb 22 17:25:22 2017 (r434623) @@ -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() { Modified: head/databases/mysql57-server/Makefile ============================================================================== --- head/databases/mysql57-server/Makefile Wed Feb 22 17:17:49 2017 (r434622) +++ head/databases/mysql57-server/Makefile Wed Feb 22 17:25:22 2017 (r434623) @@ -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 @@ -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} Modified: head/databases/mysql57-server/files/mysql-server.in ============================================================================== --- head/databases/mysql57-server/files/mysql-server.in Wed Feb 22 17:17:49 2017 (r434622) +++ head/databases/mysql57-server/files/mysql-server.in Wed Feb 22 17:25:22 2017 (r434623) @@ -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 Modified: head/databases/mysql57-server/pkg-message ============================================================================== --- head/databases/mysql57-server/pkg-message Wed Feb 22 17:17:49 2017 (r434622) +++ head/databases/mysql57-server/pkg-message Wed Feb 22 17:25:22 2017 (r434623) @@ -7,14 +7,8 @@ Initial password for first time use of M 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. ***************************************************************************** Modified: head/databases/mysql80-server/Makefile ============================================================================== --- head/databases/mysql80-server/Makefile Wed Feb 22 17:17:49 2017 (r434622) +++ head/databases/mysql80-server/Makefile Wed Feb 22 17:25:22 2017 (r434623) @@ -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 Modified: head/databases/mysql80-server/files/mysql-server.in ============================================================================== --- head/databases/mysql80-server/files/mysql-server.in Wed Feb 22 17:17:49 2017 (r434622) +++ head/databases/mysql80-server/files/mysql-server.in Wed Feb 22 17:25:22 2017 (r434623) @@ -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 Modified: head/databases/mysql80-server/pkg-message ============================================================================== --- head/databases/mysql80-server/pkg-message Wed Feb 22 17:17:49 2017 (r434622) +++ head/databases/mysql80-server/pkg-message Wed Feb 22 17:25:22 2017 (r434623) @@ -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. *****************************************************************************