From 622fb2763b16c532075fad3a1a558b1bdd44acaa Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Thu, 7 Jul 2011 17:22:24 +0200 Subject: Fix bug#45415: "rpm upgrade recreates test database" Let the creation of the "test" database happen only during a new installation, not in an RPM upgrade. --- support-files/mysql.spec.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'support-files/mysql.spec.sh') diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 0baffd5444f..006dea45e64 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -798,13 +798,12 @@ else fi # echo "Analyzed: SERVER_TO_START=$SERVER_TO_START" if [ ! -d $mysql_datadir/mysql ] ; then - mkdir $mysql_datadir/mysql; + mkdir $mysql_datadir/mysql $mysql_datadir/test echo "MySQL RPM installation of version $NEW_VERSION" >> $STATUS_FILE else # If the directory exists, we may assume it is an upgrade. echo "MySQL RPM upgrade to version $NEW_VERSION" >> $STATUS_FILE fi -if [ ! -d $mysql_datadir/test ] ; then mkdir $mysql_datadir/test; fi # ---------------------------------------------------------------------- # Make MySQL start/shutdown automatically when the machine does it. @@ -837,7 +836,12 @@ chown -R %{mysqld_user}:%{mysqld_group} $mysql_datadir # ---------------------------------------------------------------------- # Initiate databases if needed # ---------------------------------------------------------------------- -%{_bindir}/mysql_install_db --rpm --user=%{mysqld_user} +if ! grep '^MySQL RPM upgrade' $STATUS_FILE >/dev/null 2>&1 ; then + # Fix bug#45415: no "mysql_install_db" on an upgrade + # Do this as a negative to err towards more "install" runs + # rather than to miss one. + %{_bindir}/mysql_install_db --rpm --user=%{mysqld_user} +fi # ---------------------------------------------------------------------- # Upgrade databases if needed would go here - but it cannot be automated yet @@ -1161,6 +1165,12 @@ fi # merging BK trees) ############################################################################## %changelog +* Thu Jul 07 2011 Joerg Bruehe + +- Fix bug#45415: "rpm upgrade recreates test database" + Let the creation of the "test" database happen only during a new installation, + not in an RPM upgrade. + This affects both the "mkdir" and the call of "mysql_install_db". * Thu Feb 03 2011 Joerg Bruehe -- cgit v1.2.1 From c32e476dd9a165f5f1df3493cc08e6e4e4484d5e Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Fri, 19 Aug 2011 18:48:14 +0200 Subject: Fix bug#37165 "((Generic rpm)) fail to install on Fedora 9 x86_64" On Fedora, certain accesses to "/var/lib/mysql/HOSTNAME.err" were blocked by SELinux policy, this made the server start fail with the message Manager of pid-file quit without updating file Calling "/sbin/restorecon -R /var/lib/mysql" fixes this. --- support-files/mysql.spec.sh | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'support-files/mysql.spec.sh') diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 006dea45e64..28f2b0f773a 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -382,7 +382,7 @@ sh -c "PATH=\"${MYSQL_BUILD_PATH:-$PATH}\" \ --enable-local-infile \ --with-fast-mutexes \ --with-mysqld-user=%{mysqld_user} \ - --with-unix-socket-path=/var/lib/mysql/mysql.sock \ + --with-unix-socket-path=%{mysqldatadir}/mysql.sock \ --with-pic \ --prefix=/ \ %if %{CLUSTER_BUILD} @@ -858,6 +858,13 @@ chown -R %{mysqld_user}:%{mysqld_group} $mysql_datadir # ---------------------------------------------------------------------- chmod -R og-rw $mysql_datadir/mysql +# ---------------------------------------------------------------------- +# Deal with SELinux, if it is installed / used +# ---------------------------------------------------------------------- +if [ -x /sbin/restorecon ] ; then + /sbin/restorecon -R %{mysqldatadir} +fi + # Was the server running before the upgrade? If so, restart the new one. if [ "$SERVER_TO_START" = "true" ] ; then # Restart in the same way that mysqld will be started normally. @@ -1165,6 +1172,15 @@ fi # merging BK trees) ############################################################################## %changelog +* Fri Aug 19 2011 Joerg Bruehe + +- Fix bug#37165 "((Generic rpm)) fail to install on Fedora 9 x86_64" + On Fedora, certain accesses to "/var/lib/mysql/HOSTNAME.err" were blocked + by SELinux policy, this made the server start fail with the message + Manager of pid-file quit without updating file + Calling "/sbin/restorecon -R /var/lib/mysql" fixes this. +- Replace occurrences of that path name by the spec file variable %{mysqldatadir}. + * Thu Jul 07 2011 Joerg Bruehe - Fix bug#45415: "rpm upgrade recreates test database" -- cgit v1.2.1