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