From 6d3b026d916e0ccd6d12c1a446f49ba6e0fef74d Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 21 May 2026 17:50:42 +0100 Subject: [PATCH] Bug 40901: (QA follow-up) Fix koha-sysv.postinst configure guard and double-enable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two problems in the original koha-sysv.postinst: 1. #DEBHELPER# was placed at the top (line 5) before any case statement, so whatever dh_installsystemd expands it to ran for ALL postinst invocations (abort-upgrade, abort-remove, triggered…), not just configure. 2. The custom block manually called `deb-systemd-helper enable koha-common.service` on systemd hosts. Because koha-sysv also ships koha-sysv.service (which dh_installsystemd enables via #DEBHELPER#), both koha-sysv.service and the sysv-generator-created koha-common.service could end up enabled, resulting in a double-start of the init script at boot. Fix both by wrapping the custom code in `case "$1" in configure)`, moving manual enable: dh_installsystemd already enables and starts koha-sysv.service correctly. Signed-off-by: Martin Renvoize Signed-off-by: Pedro Amorim --- debian/koha-sysv.postinst | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/debian/koha-sysv.postinst b/debian/koha-sysv.postinst index 10a3d0ff6d..d9be8f79fe 100755 --- a/debian/koha-sysv.postinst +++ b/debian/koha-sysv.postinst @@ -2,18 +2,19 @@ set -e +case "$1" in + configure) + # Bug 18250: Correct startup order of koha-common and memcached. + # On non-systemd systems only: force the rc.d ordering. + # On systemd, dh_installsystemd (via #DEBHELPER# below) enables and + # starts koha-sysv.service automatically; no manual enable needed. + if [ ! -d /run/systemd/system ]; then + update-rc.d koha-common disable + update-rc.d koha-common enable + fi + ;; +esac + #DEBHELPER# -# Enable and start the service on systemd systems -if [ -d /run/systemd/system ]; then - deb-systemd-helper enable koha-common.service >/dev/null || true - deb-systemd-invoke start koha-common.service >/dev/null || true -else - # Bug 18250: Correct startup order of koha-common and memcached - # Since the init script has been updated, we can force the order in rc.d - # by disabling and enabling again. - update-rc.d koha-common disable - update-rc.d koha-common enable -fi - exit 0