diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2020-05-30 11:44:06 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2020-05-30 11:44:06 +0100 |
commit | f516638b7fe9592837389826a6152a7e1b251c54 (patch) | |
tree | 8bfecb640b7b6403d7a3d662d923eed630033da7 /dev-db/mysql/mysql-8.0.19-r1.ebuild | |
parent | 1a61119f9f7b057830e2ce0563f913ec86f282ad (diff) |
gentoo resync : 30.05.2020
Diffstat (limited to 'dev-db/mysql/mysql-8.0.19-r1.ebuild')
-rw-r--r-- | dev-db/mysql/mysql-8.0.19-r1.ebuild | 183 |
1 files changed, 106 insertions, 77 deletions
diff --git a/dev-db/mysql/mysql-8.0.19-r1.ebuild b/dev-db/mysql/mysql-8.0.19-r1.ebuild index 404aa98a36e3..827c57daf940 100644 --- a/dev-db/mysql/mysql-8.0.19-r1.ebuild +++ b/dev-db/mysql/mysql-8.0.19-r1.ebuild @@ -576,43 +576,6 @@ pkg_postinst() { } pkg_config() { - local mysqld_binary="${EROOT}/usr/sbin/mysqld" - if [[ ! -x "${mysqld_binary}" ]] ; then - die "'${mysqld_binary}' not found! Please re-install ${CATEGORY}/${PN}!" - fi - - local mysql_binary="${EROOT}/usr/bin/mysql" - if [[ ! -x "${mysql_binary}" ]] ; then - die "'${mysql_binary}' not found! Please re-install ${CATEGORY}/${PN}!" - fi - - local my_print_defaults_binary="${EROOT}/usr/bin/my_print_defaults" - if [[ ! -x "${my_print_defaults_binary}" ]] ; then - die "'${my_print_defaults_binary}' not found! Please re-install dev-db/mysql-connector-c!" - fi - - if [[ -z "${MYSQL_USER}" ]] ; then - MYSQL_USER=mysql - if use prefix ; then - MYSQL_USER=$(id -u -n 2>/dev/null) - if [[ -z "${MYSQL_USER}" ]] ; then - die "Failed to determine current username!" - fi - fi - fi - - if [[ -z "${MYSQL_GROUP}" ]] ; then - MYSQL_GROUP=mysql - if use prefix ; then - MYSQL_GROUP=$(id -g -n 2>/dev/null) - if [[ -z "${MYSQL_GROUP}" ]] ; then - die "Failed to determine current user groupname!" - fi - fi - fi - - einfo "Will use username '${MYSQL_USER}' and group '${MYSQL_GROUP}' ..." - _getoptval() { local section="$1" local flag="--${2}=" @@ -677,6 +640,41 @@ pkg_config() { done } + local mysqld_binary="${EROOT}/usr/sbin/mysqld" + if [[ ! -x "${mysqld_binary}" ]] ; then + die "'${mysqld_binary}' not found! Please re-install ${CATEGORY}/${PN}!" + fi + + local mysql_binary="${EROOT}/usr/bin/mysql" + if [[ ! -x "${mysql_binary}" ]] ; then + die "'${mysql_binary}' not found! Please re-install ${CATEGORY}/${PN}!" + fi + + local my_print_defaults_binary="${EROOT}/usr/bin/my_print_defaults" + if [[ ! -x "${my_print_defaults_binary}" ]] ; then + die "'${my_print_defaults_binary}' not found! Please re-install dev-db/mysql-connector-c!" + fi + + if [[ -z "${MYSQL_USER}" ]] ; then + MYSQL_USER=mysql + if use prefix ; then + MYSQL_USER=$(id -u -n 2>/dev/null) + if [[ -z "${MYSQL_USER}" ]] ; then + die "Failed to determine current username!" + fi + fi + fi + + if [[ -z "${MYSQL_GROUP}" ]] ; then + MYSQL_GROUP=mysql + if use prefix ; then + MYSQL_GROUP=$(id -g -n 2>/dev/null) + if [[ -z "${MYSQL_GROUP}" ]] ; then + die "Failed to determine current user groupname!" + fi + fi + fi + # my_print_defaults needs to read stuff in $HOME/.my.cnf local -x HOME="${EROOT}/root" @@ -696,8 +694,6 @@ pkg_config() { ewarn "Looks like your data directory '${MY_DATADIR}' is already initialized!" ewarn "Please rename or delete its content if you wish to initialize a new data directory." die "${PN} data directory at '${MY_DATADIR}' looks already initialized!" - else - einfo "${PN} data directory detected as '${MY_DATADIR}' ..." fi MYSQL_TMPDIR="$(_getoptval mysqld tmpdir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" @@ -751,7 +747,7 @@ pkg_config() { su -s /bin/sh -c "touch ${_my_datadir_testfile}" ${MYSQL_USER} &>/dev/null fi - if [[ $? -ne 0 ]]; then + if [[ $? -ne 0 ]] ; then die "${MYSQL_USER} user cannot write into data directory '${MY_DATADIR}'!" else rm "${_my_datadir_testfile}" || die @@ -764,28 +760,8 @@ pkg_config() { || die "Failed to create ${PN} tmpdir '${MYSQL_TMPDIR}'!" fi - if [[ -n "${MYSQL_TMPDIR}" ]] ; then - local _my_tmpdir_testfile="$(_mktemp_dry "${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX")" - [[ -z "${_my_tmpdir_testfile}" ]] \ - && die "_mktemp_dry() for '${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX' failed!" - - if use prefix ; then - touch "${_my_tmpdir_testfile}" &>/dev/null - else - su -s /bin/sh -c "touch ${_my_tmpdir_testfile}" ${MYSQL_USER} &>/dev/null - fi - - if [[ $? -ne 0 ]]; then - die "${MYSQL_USER} user cannot write into data directory '${MYSQL_TMPDIR}'!" - else - rm "${_my_tmpdir_testfile}" || die - unset _my_tmpdir_testfile - fi - else - # If no tmpdir is set, mysqld will use default system tmpdir. - # However, we are using tmpdir from package manager at the - # moment which maybe isn't writeable for $MYSQL_USER... - MYSQL_TMPDIR="$(_mktemp_dry "${T}/mysqld-tmp.XXXXXXXXX")" + if [[ -z "${MYSQL_TMPDIR}" ]] ; then + MYSQL_TMPDIR="$(_mktemp_dry "${EROOT}/tmp/mysqld-tmp.XXXXXXXXX")" [[ -z "${MYSQL_TMPDIR}" ]] \ && die "_mktemp_dry() for '${MYSQL_TMPDIR}' failed!" @@ -793,6 +769,24 @@ pkg_config() { chown ${MYSQL_USER} "${MYSQL_TMPDIR}" || die fi + # Now we need to test MYSQL_TMPDIR... + local _my_tmpdir_testfile="$(_mktemp_dry "${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX")" + [[ -z "${_my_tmpdir_testfile}" ]] \ + && die "_mktemp_dry() for '${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX' failed!" + + if use prefix ; then + touch "${_my_tmpdir_testfile}" &>/dev/null + else + su -s /bin/sh -c "touch ${_my_tmpdir_testfile}" ${MYSQL_USER} &>/dev/null + fi + + if [[ $? -ne 0 ]] ; then + die "${MYSQL_USER} user cannot write into tmpdir '${MYSQL_TMPDIR}'!" + else + rm "${_my_tmpdir_testfile}" || die + unset _my_tmpdir_testfile + fi + if [[ -n "${MYSQL_LOG_BIN}" && ! -d "${MYSQL_LOG_BIN}" ]] ; then einfo "Creating ${PN} log-bin directory '${MYSQL_LOG_BIN}' ..." install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_LOG_BIN}" \ @@ -810,7 +804,7 @@ pkg_config() { su -s /bin/sh -c "touch ${_my_logbin_testfile}" ${MYSQL_USER} &>/dev/null fi - if [[ $? -ne 0 ]]; then + if [[ $? -ne 0 ]] ; then die "${MYSQL_USER} user cannot write into log-bin directory '${MYSQL_LOG_BIN}'!" else rm "${_my_logbin_testfile}" || die @@ -835,7 +829,7 @@ pkg_config() { su -s /bin/sh -c "touch ${_my_relaylog_testfile}" ${MYSQL_USER} &>/dev/null fi - if [[ $? -ne 0 ]]; then + if [[ $? -ne 0 ]] ; then die "${MYSQL_USER} user cannot write into relay-log directory '${MYSQL_RELAY_LOG}'!" else rm "${_my_relaylog_testfile}" || die @@ -843,6 +837,44 @@ pkg_config() { fi fi + local mysql_install_log="$(_mktemp_dry "${MYSQL_TMPDIR}/install_db.XXXXXXXXX.log")" + if [[ -z "${mysql_install_log}" ]] ; then + die "_mktemp_dry() for '${MYSQL_TMPDIR}/install_db.XXXXXXXXX.log' failed!" + else + # make sure file is writable for MYSQL_USER... + touch "${mysql_install_log}" || die + chown ${MYSQL_USER} "${mysql_install_log}" || die + fi + + local mysqld_logfile="$(_mktemp_dry "${MYSQL_TMPDIR}/install_mysqld.XXXXXXXXX.log")" + if [[ -z "${mysqld_logfile}" ]] ; then + die "_mktemp_dry() for '${MYSQL_TMPDIR}/install_mysqld.XXXXXXXXX.log' failed!" + else + # make sure file is writable for MYSQL_USER... + touch "${mysqld_logfile}" || die + chown ${MYSQL_USER} "${mysqld_logfile}" || die + fi + + echo "" + einfo "Detected settings:" + einfo "==================" + einfo "MySQL User:\t\t\t\t${MYSQL_USER}" + einfo "MySQL Group:\t\t\t\t${MYSQL_GROUP}" + einfo "MySQL DATA directory:\t\t${MY_DATADIR}" + einfo "MySQL TMP directory:\t\t\t${MYSQL_TMPDIR}" + + if [[ -n "${MYSQL_LOG_BIN}" ]] ; then + einfo "MySQL Binary Log File location:\t${MYSQL_LOG_BIN}" + fi + + if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then + einfo "MySQL Relay Log File location:\t${MYSQL_RELAY_LOG}" + fi + + einfo "PID DIR:\t\t\t\t${PID_DIR}" + einfo "Install db log:\t\t\t${mysql_install_log}" + einfo "Install server log:\t\t\t${mysqld_logfile}" + local -a config_files local config_file="${EROOT}/etc/mysql/mysql.d/50-distro-client.cnf" @@ -888,6 +920,8 @@ pkg_config() { ;; esac + echo "Selected authentication plugin: ${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}" >> "${mysql_install_log}" + unset user_answer fi @@ -993,19 +1027,16 @@ pkg_config() { # Prepare timezones, see # https://dev.mysql.com/doc/mysql/en/time-zone-support.html - local tz_sql="${TMPDIR}/tz.sql" + local tz_sql="$(_mktemp_dry "${MYSQL_TMPDIR}/tz.XXXXXXXXX.sql")" + [[ -z "${tz_sql}" ]] \ + && die "_mktemp_dry() for '${MYSQL_TMPDIR}/tz.XXXXXXXXX.sql' failed!" + echo "USE mysql;" >"${tz_sql}" "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" >> "${tz_sql}" 2>/dev/null if [[ $? -ne 0 ]] ; then die "mysql_tzinfo_to_sql failed!" fi - chown ${MYSQL_USER} "${tz_sql}" || die - - local mysql_install_log="${TMPDIR}/mysql_install_db.log" - touch "${mysql_install_log}" || die - chown ${MYSQL_USER} "${mysql_install_log}" || die - # --initialize-insecure will not set root password # --initialize would set a random one in the log which we don't need as we set it ourselves local cmd=( @@ -1028,15 +1059,13 @@ pkg_config() { die "Failed to initialize ${PN} data directory. Please review '${mysql_install_log}'!" fi + rm "${tz_sql}" || die + local x=${RANDOM} - local socket="${EROOT}/run/mysqld/mysqld${x}.sock" - local pidfile="${EROOT}/run/mysqld/mysqld${x}.pid" + local socket="${EROOT}${PID_DIR}/mysqld${x}.sock" + local pidfile="${EROOT}${PID_DIR}/mysqld${x}.pid" unset x - local mysqld_logfile="${TMPDIR}/mysqld.log" - touch "${mysqld_logfile}" || die - chown ${MYSQL_USER} "${mysqld_logfile}" || die - cmd=( "${mysqld_binary}" "${mysqld_options[@]}" |