From 760641c550836f22fa7d2d334eb4a8013579540b Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 15 Sep 2026 17:28:42 +0100 Subject: [PATCH] Bug 40901: (QA follow-up) Install the SysV init script through dh_installinit debhelper treats debian/.init as that package's init script, so koha-sysv would have shipped /etc/init.d/koha-sysv (with generated update-rc.d and invoke-rc.d handling) as well as the .install-copied /etc/init.d/koha-common (with none). That meant two identical init scripts, two generated units on systemd hosts, and on a fresh non-systemd install the "update-rc.d koha-common disable" call in the postinst aborting with "no runlevel symlinks to modify" because nothing had ever created them. Rename the script to debian/koha-sysv.koha-common.init and run dh_installinit --name=koha-common for koha-sysv. debhelper now installs it as /etc/init.d/koha-common, registers the rc.d links, starts it on install, restarts it on upgrade, stops it on removal and removes the links on purge, which is exactly what the old koha-common package did. The hand-written prerm/postrm and the Bug 18250 disable/enable dance (a one-off link reshuffle from 2017 that is a no-op under dependency-based boot) are dropped in favour of the generated code. Co-Authored-By: Claude Fable 5.1 Signed-off-by: Martin Renvoize Signed-off-by: Pedro Amorim --- debian/koha-sysv.install | 1 - ...oha-sysv.init => koha-sysv.koha-common.init} | 0 debian/koha-sysv.postinst | 17 ++++------------- debian/koha-sysv.postrm | 15 --------------- debian/koha-sysv.prerm | 16 ---------------- debian/rules | 7 +++++++ 6 files changed, 11 insertions(+), 45 deletions(-) delete mode 100644 debian/koha-sysv.install rename debian/{koha-sysv.init => koha-sysv.koha-common.init} (100%) delete mode 100755 debian/koha-sysv.postrm delete mode 100755 debian/koha-sysv.prerm diff --git a/debian/koha-sysv.install b/debian/koha-sysv.install deleted file mode 100644 index c2dca6c03c..0000000000 --- a/debian/koha-sysv.install +++ /dev/null @@ -1 +0,0 @@ -debian/koha-sysv.init etc/init.d/koha-common diff --git a/debian/koha-sysv.init b/debian/koha-sysv.koha-common.init similarity index 100% rename from debian/koha-sysv.init rename to debian/koha-sysv.koha-common.init diff --git a/debian/koha-sysv.postinst b/debian/koha-sysv.postinst index ec8edf56f9..81b3e74a0c 100755 --- a/debian/koha-sysv.postinst +++ b/debian/koha-sysv.postinst @@ -2,19 +2,10 @@ 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 hosts, systemd-sysv-generator wraps /etc/init.d/koha-common - # as koha-common.service and honors the rc.d symlinks; no manual - # enable needed. - if [ ! -d /run/systemd/system ]; then - update-rc.d koha-common disable - update-rc.d koha-common enable - fi - ;; -esac +# /etc/init.d/koha-common is installed by dh_installinit --name=koha-common +# (see debian/rules), which also generates the update-rc.d / invoke-rc.d +# handling below. On systemd hosts systemd-sysv-generator wraps the script +# as koha-common.service and honours those rc.d links. #DEBHELPER# diff --git a/debian/koha-sysv.postrm b/debian/koha-sysv.postrm deleted file mode 100755 index 3936c791c1..0000000000 --- a/debian/koha-sysv.postrm +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -set -e - -if [ "$1" = "purge" ]; then - # Disable the service on systemd systems - if [ -d /run/systemd/system ]; then - deb-systemd-helper purge koha-common.service >/dev/null || true - deb-systemd-helper unmask koha-common.service >/dev/null || true - fi -fi - -#DEBHELPER# - -exit 0 diff --git a/debian/koha-sysv.prerm b/debian/koha-sysv.prerm deleted file mode 100755 index ad89ea127c..0000000000 --- a/debian/koha-sysv.prerm +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -set -e - -if [ "$1" = "remove" ]; then - # Stop the service - if [ -d /run/systemd/system ]; then - deb-systemd-invoke stop koha-common.service >/dev/null || true - else - invoke-rc.d koha-common stop || true - fi -fi - -#DEBHELPER# - -exit 0 diff --git a/debian/rules b/debian/rules index 8027ea5299..852a5a2b9b 100755 --- a/debian/rules +++ b/debian/rules @@ -8,6 +8,13 @@ export PERL_MM_USE_DEFAULT=1 %: dh $@ --fail-missing --with bash-completion +# koha-sysv ships the SysV init script under its historical name so that +# dpkg hands /etc/init.d/koha-common over from the old monolithic koha-common +# package and debhelper generates the matching update-rc.d/invoke-rc.d code. +override_dh_installinit: + dh_installinit -pkoha-sysv --name=koha-common + dh_installinit --remaining-packages + override_dh_gencontrol: debian/bd-to-depends >> debian/koha-common.substvars debian/bd-to-depends >> debian/koha-core.substvars