From 69964c4425778efdecf7bc4f0006eb76e77e91a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Otto=20Kek=C3=A4l=C3=A4inen?= Date: Wed, 22 Apr 2020 00:48:14 +0300 Subject: [PATCH] Deb: Add manually dh_systemd_start snippets These do now show up automatically due to init and systemd customizations, so the handiest fix is to add them manually. This has been the praxis in downstream MariaDB packaging for a couple years now, and works fine. - Ensure service is loaded and started after installation, (fixes service start issues in Debian/Ubuntu upgrades where otherwise service mysql status stayed stopped) - Ensure service stopped before removal/purge (fixes unstopped processes detected by piuparts) - Ensure systemd daemon is reloaded after removal/purge when service has been removed --- debian/mariadb-server-10.5.postinst | 11 +++++++++++ debian/mariadb-server-10.5.postrm | 5 +++++ debian/mariadb-server-10.5.prerm | 8 ++++++++ 3 files changed, 24 insertions(+) diff --git a/debian/mariadb-server-10.5.postinst b/debian/mariadb-server-10.5.postinst index c83c545ca81..abf3355e18a 100644 --- a/debian/mariadb-server-10.5.postinst +++ b/debian/mariadb-server-10.5.postinst @@ -235,3 +235,14 @@ if [ -x "$(command -v deb-systemd-helper)" ]; then fi #DEBHELPER# + +# Modified dh_systemd_start snippet that's not added automatically +if [ -d /run/systemd/system ]; then + systemctl --system daemon-reload >/dev/null || true + deb-systemd-invoke start mariadb.service >/dev/null || true +# Modified dh_installinit snippet to only run with sysvinit +elif [ -x "/etc/init.d/mariadb" ]; then + if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]; then + invoke-rc.d mariadb start || exit $? + fi +fi diff --git a/debian/mariadb-server-10.5.postrm b/debian/mariadb-server-10.5.postrm index a92aef90698..fc3a4a67a60 100644 --- a/debian/mariadb-server-10.5.postrm +++ b/debian/mariadb-server-10.5.postrm @@ -89,3 +89,8 @@ if [ "$1" = "purge" ] && [ -f "/var/lib/mysql/debian-$MAJOR_VER.flag" ]; then fi #DEBHELPER# + +# Modified dh_systemd_start snippet that's not added automatically +if [ -d /run/systemd/system ]; then + systemctl --system daemon-reload >/dev/null || true +fi diff --git a/debian/mariadb-server-10.5.prerm b/debian/mariadb-server-10.5.prerm index 6060c4fb6b1..8fd172da9d2 100644 --- a/debian/mariadb-server-10.5.prerm +++ b/debian/mariadb-server-10.5.prerm @@ -2,3 +2,11 @@ set -e #DEBHELPER# + +# Modified dh_systemd_start snippet that's not added automatically +if [ -d /run/systemd/system ]; then + deb-systemd-invoke stop mariadb.service >/dev/null +# Modified dh_installinit snippet to only run with sysvinit +elif [ -x "/etc/init.d/mariadb" ]; then + invoke-rc.d mariadb stop || exit $? +fi