Skip to content

Commit

Permalink
Bug#29702050 TMPFILES.D FILES MISSING IN DEB PACKAGE
Browse files Browse the repository at this point in the history
To better support manual execution of the daemon, we replace the systemd
RuntimeDirectory setting with a more general tmpfiles entry.
Also, the packaging scripts contain bash logic for creating the runtime
directory (var/run/mysqld). This logic is only relevant for old non-systemd
platforms, as we have systemd's RuntimeDirectory setting which does the
same thing in a better way. Since we only support systemd system currently
we can drop this logic.

Change-Id: I6b874b17786f264159def8201893483127702cdf
  • Loading branch information
ltangvald committed Aug 22, 2019
1 parent 572018f commit 71f1555
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 39 deletions.
5 changes: 0 additions & 5 deletions packaging/deb-in/extra/mysql-helpers
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ verify_ready() {
MYSQLFILES=$(get_mysql_option ${INSTANCE} secure-file-priv "/var/lib/mysql-files")
MYSQLKEYRING=$(dirname $(get_mysql_option ${INSTANCE} keyring-file-data "/var/lib/mysql-keyring/keyring"))
MYSQLLOG=$(dirname $(get_mysql_option ${INSTANCE} log-error "/var/log/mysql/error.log"))
MYSQLRUN=/var/run/mysqld

if ! getent group mysql >/dev/null; then
addgroup --system mysql >/dev/null
Expand Down Expand Up @@ -142,10 +141,6 @@ verify_ready() {
echo "Errors found. Aborting."
exit 1
fi

if [ ! -d ${MYSQLRUN} -a ! -L ${MYSQLRUN} ]; then
install -d -m0755 -omysql -gmysql ${MYSQLRUN}
fi
}

# Verify the database exists and is ssl ready
Expand Down
3 changes: 0 additions & 3 deletions packaging/deb-in/mysql-packagesource-server.mysql.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,3 @@ RestartForceExitStatus=16

# Set enviroment variable MYSQLD_PARENT_PID. This is required for restart.
Environment=MYSQLD_PARENT_PID=1

RuntimeDirectory=mysqld
RuntimeDirectoryMode=755
23 changes: 23 additions & 0 deletions packaging/deb-in/mysql-packagesource-server.mysql.tmpfile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2.0,
# as published by the Free Software Foundation.
#
# This program is also distributed with certain software (including
# but not limited to OpenSSL) that is licensed under separate terms,
# as designated in a particular file or component or in included license
# documentation. The authors of MySQL hereby grant you an additional
# permission to link the program and your derivative works with the
# separately licensed software that they have included with MySQL.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License, version 2.0, for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

d /var/run/mysqld 0755 mysql mysql -
3 changes: 0 additions & 3 deletions packaging/deb-in/mysql-packagesource-server.mysql@.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,3 @@ RestartForceExitStatus=16

# Set enviroment variable MYSQLD_PARENT_PID. This is required for restart.
Environment=MYSQLD_PARENT_PID=1

RuntimeDirectory=mysqld
RuntimeDirectoryMode=755
9 changes: 0 additions & 9 deletions packaging/deb-in/mysql-packagesource-server.postrm.in
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ case "$1" in
MYSQLFILES=/var/lib/mysql-files
MYSQLKEYRING=/var/lib/mysql-keyring
MYSQLLOG=/var/log/mysql
MYSQLRUN=/var/run/mysqld

server_stop

Expand All @@ -92,10 +91,6 @@ case "$1" in
db_get mysql-@DEB_PRODUCTNAME@-server/remove-data-dir && RMDATADIR=${RET}
if [ "${RMDATADIR}" = "true" ];
then
if [ -d ${MYSQLRUN} ] || [ -L ${MYSQLRUN} ];
then
rm -rf ${MYSQLRUN}
fi

if [ -d ${MYSQLLOG} ] || [ -L ${MYSQLLOG} ];
then
Expand Down Expand Up @@ -142,10 +137,6 @@ case "$1" in
then
invoke-rc.d mysql start || exit $?
else
if [ -d ${MYSQLRUN} ] || [ -L ${MYSQLRUN} ];
then
rm -rf ${MYSQLRUN}
fi

if [ -d ${MYSQLLOG} ] || [ -L ${MYSQLLOG} ];
then
Expand Down
27 changes: 8 additions & 19 deletions packaging/deb-in/mysql-packagesource-server.preinst.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2.0,
Expand All @@ -22,29 +22,20 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

set -e
case "$1" in
install)

if [ -z "$2" ];
then

set -e

# Native 5.5 packages create a /var/run/mysqld owned by root. This can cause
# errors in the systemd service, so we reset ownership if it exists.
MYSQLRUN=/var/run/mysqld
if [ -d ${MYSQLRUN} ]; then
install -d -m0755 -omysql -gmysql ${MYSQLRUN}
fi

set +e

# The tmpfiles.d config will fail if the user does not exist
if ! getent group mysql >/dev/null; then
addgroup --system mysql >/dev/null
fi
if ! getent passwd mysql >/dev/null; then
adduser --ingroup mysql --system --disabled-login --no-create-home --home /var/lib/mysql --shell /bin/false --gecos "MySQL Server" mysql >/dev/null
fi

;;

upgrade)

;;

abort-upgrade)
Expand All @@ -55,5 +46,3 @@ case "$1" in
exit 1
;;
esac

exit 0

0 comments on commit 71f1555

Please sign in to comment.