diff options
Diffstat (limited to 'support-files/rpm')
-rw-r--r-- | support-files/rpm/server-postin.sh | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/support-files/rpm/server-postin.sh b/support-files/rpm/server-postin.sh index 253350512ae..5b95b751212 100644 --- a/support-files/rpm/server-postin.sh +++ b/support-files/rpm/server-postin.sh @@ -1,12 +1,20 @@ - -# Make MySQL start/shutdown automatically when the machine does it. -if [ $1 = 1 ] ; then +if [ -f /usr/lib/systemd/system/mariadb.service -a -x /usr/bin/systemctl ]; then systemd_conf=/etc/systemd/system/mariadb.service.d/migrated-from-my.cnf-settings.conf - if [ -x /usr/bin/mariadb-service-convert -a ! -f "${systemd_conf}" ]; then - mkdir -p /etc/systemd/system/mariadb.service.d - /usr/bin/mariadb-service-convert > "${systemd_conf}" + if [ -x %{_bindir}/mariadb-service-convert -a ! -f "${systemd_conf}" ]; then + # Either fresh install or upgrade non-systemd -> systemd + mkdir -p /etc/systemd/system/mariadb.service.d + %{_bindir}/mariadb-service-convert > "${systemd_conf}" + # Make sure old possibly non-systemd instance is down + if [ $1 = 2 ]; then + SYSTEMCTL_SKIP_REDIRECT=1 %{_sysconfdir}/init.d/mysql stop >/dev/null 2>&1 || : + systemctl start mariadb >/dev/null 2>&1 || : + fi + systemctl enable mariadb.service >/dev/null 2>&1 || : fi +fi +# Make MySQL start/shutdown automatically when the machine does it. +if [ $1 = 1 ] ; then if [ -x /usr/bin/systemctl ] ; then /usr/bin/systemctl daemon-reload >/dev/null 2>&1 fi |