From a46f1aa4ca27f0765338f610d5ced782aa2b1282 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 24 Jul 2026 12:12:04 -0400 Subject: [PATCH] Bug 40901: (QA follow-up) Don't stop all Koha services on every koha-systemd upgrade The postinst stopped and disabled koha-common.service on every configure, which after migration means every upgrade of this package shuts down every Koha instance. Now it only happens on first install, where it exists to stop the old SysV-started services. The hand-rolled deletion of the old init script is replaced with dpkg's standard rm_conffile mechanism. https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40901#c130 Signed-off-by: Martin Renvoize Signed-off-by: Pedro Amorim --- debian/koha-common.maintscript | 1 + debian/koha-systemd.postinst | 31 ++++++++++++++----------------- 2 files changed, 15 insertions(+), 17 deletions(-) create mode 100644 debian/koha-common.maintscript diff --git a/debian/koha-common.maintscript b/debian/koha-common.maintscript new file mode 100644 index 0000000000..8489567029 --- /dev/null +++ b/debian/koha-common.maintscript @@ -0,0 +1 @@ +rm_conffile /etc/init.d/koha-common 25.11~ diff --git a/debian/koha-systemd.postinst b/debian/koha-systemd.postinst index 117d90c4c8..74f0eb8c22 100644 --- a/debian/koha-systemd.postinst +++ b/debian/koha-systemd.postinst @@ -6,26 +6,23 @@ case "$1" in # Reload systemd daemon systemctl daemon-reload || true - # Stop and disable the legacy SysV koha-common.service if present. - # This service is auto-generated by systemd-sysv-generator from - # /etc/init.d/koha-common and would run in parallel with the native - # systemd units, causing double-starts. - if systemctl is-active --quiet koha-common.service 2>/dev/null; then - systemctl stop koha-common.service || true - fi - if systemctl is-enabled --quiet koha-common.service 2>/dev/null; then - systemctl disable koha-common.service || true - fi - # Remove the orphaned SysV init script if it was left behind by - # the old koha-common package (pre-split) and koha-sysv is not installed. - if [ -f /etc/init.d/koha-common ] && ! dpkg -s koha-sysv >/dev/null 2>&1; then - rm -f /etc/init.d/koha-common - systemctl daemon-reload || true - fi - # On first install (no previous version), enable units for all existing instances # This handles migration from SysV init to systemd if [ -z "$2" ]; then + # Stop and disable the legacy SysV koha-common.service if present. + # This service is auto-generated by systemd-sysv-generator from + # /etc/init.d/koha-common and would run in parallel with the native + # systemd units, causing double-starts. Only do this on first + # install: after migration, koha-common.service is our own compat + # unit, and stopping it here would stop every instance on each + # upgrade of this package. + if systemctl is-active --quiet koha-common.service 2>/dev/null; then + systemctl stop koha-common.service || true + fi + if systemctl is-enabled --quiet koha-common.service 2>/dev/null; then + systemctl disable koha-common.service || true + fi + for instance in $(koha-list --enabled 2>/dev/null); do # Core services: always enable systemctl enable koha-zebra@${instance}.service 2>/dev/null || true