summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'eclass/mysql-multilib.eclass')
-rw-r--r--eclass/mysql-multilib.eclass23
1 files changed, 9 insertions, 14 deletions
diff --git a/eclass/mysql-multilib.eclass b/eclass/mysql-multilib.eclass
index aa0930e4475..b172bc0c40a 100644
--- a/eclass/mysql-multilib.eclass
+++ b/eclass/mysql-multilib.eclass
@@ -843,14 +843,9 @@ mysql-multilib_pkg_postinst() {
# Make sure the vars are correctly initialized
mysql_init_vars
- # Check FEATURES="collision-protect" before removing this
+ # Create log directory securely if it does not exist
[[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}"
- # Secure the logfiles
- touch "${ROOT}${MY_LOGDIR}"/mysql.{log,err}
- chown mysql:mysql "${ROOT}${MY_LOGDIR}"/mysql*
- chmod 0660 "${ROOT}${MY_LOGDIR}"/mysql*
-
# Minimal builds don't have the MySQL server
if use_if_iuse minimal ; then
:
@@ -1070,28 +1065,28 @@ mysql-multilib_pkg_config() {
# Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it
PID_DIR="${EROOT}/var/run/mysqld"
if [[ ! -d "${PID_DIR}" ]]; then
- mkdir -p "${PID_DIR}" || die "Could not create pid directory"
- chown mysql:mysql "${PID_DIR}" || die "Could not set ownership on pid directory"
- chmod 755 "${PID_DIR}" || die "Could not set permissions on pid directory"
+ install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory"
+ fi
+
+ if [[ ! -d "${MY_DATADIR}" ]]; then
+ install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory"
fi
- pushd "${TMPDIR}" &>/dev/null
+ pushd "${TMPDIR}" &>/dev/null || die
#cmd="'${EROOT}/usr/share/mysql/scripts/mysql_install_db' '--basedir=${EPREFIX}/usr' ${options}"
cmd=${EROOT}usr/share/mysql/scripts/mysql_install_db
[[ -f ${cmd} ]] || cmd=${EROOT}usr/bin/mysql_install_db
cmd="'$cmd' '--basedir=${EPREFIX}/usr' ${options} '--datadir=${ROOT}/${MY_DATADIR}' '--tmpdir=${ROOT}/${MYSQL_TMPDIR}'"
einfo "Command: $cmd"
- eval $cmd \
+ su -s /bin/sh -c "${cmd}" mysql \
>"${TMPDIR}"/mysql_install_db.log 2>&1
if [ $? -ne 0 ]; then
grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2
die "Failed to run mysql_install_db. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log"
fi
- popd &>/dev/null
+ popd &>/dev/null || die
[[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \
|| die "MySQL databases not installed"
- chown -R mysql:mysql "${ROOT}/${MY_DATADIR}" 2>/dev/null
- chmod 0750 "${ROOT}/${MY_DATADIR}" 2>/dev/null
# Filling timezones, see
# http://dev.mysql.com/doc/mysql/en/time-zone-support.html