diff --git a/debian/control b/debian/control index a9acc27f0e..b7f8286b71 100644 --- a/debian/control +++ b/debian/control @@ -498,6 +498,8 @@ Architecture: all Depends: ${misc:Depends}, daemon, koha-core Provides: koha-init Conflicts: koha-systemd +Replaces: koha-common (<< 25.11) +Breaks: koha-common (<< 25.11) Description: SysV init scripts for Koha ILS Koha is an Integrated Library Management system for real-world libraries (the kinds with books). diff --git a/debian/control.in b/debian/control.in index 8b9a02450a..9703bc3f40 100644 --- a/debian/control.in +++ b/debian/control.in @@ -162,6 +162,8 @@ Architecture: all Depends: ${misc:Depends}, daemon, koha-core Provides: koha-init Conflicts: koha-systemd +Replaces: koha-common (<< 25.11) +Breaks: koha-common (<< 25.11) Description: SysV init scripts for Koha ILS Koha is an Integrated Library Management system for real-world libraries (the kinds with books). diff --git a/debian/koha-systemd.postinst b/debian/koha-systemd.postinst index ab66ad23b0..3e5593e0a5 100644 --- a/debian/koha-systemd.postinst +++ b/debian/koha-systemd.postinst @@ -6,6 +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