Koha-clms/debian/systemd
Martin Renvoize 0bdb94bfbb
Bug 40901: (QA follow-up) Harden the service abstraction in koha-functions.sh
- koha_init_backend relied on "systemctl list-unit-files" exiting
  non-zero when nothing matches. That behaviour is version dependent,
  and on a systemd host running koha-sysv a false positive would send
  every koha-* helper to units that do not exist. Test for the
  koha-plack@.service unit file instead: unambiguous, and no systemctl
  fork per call. The _KOHA_INIT_BACKEND cache is dropped; every caller
  ran the function in a $(...) subshell so it never took effect anyway.
- The _sysv_worker and _sysv_z3950 code moved here from bash-only
  scripts brought "((error_count++))" and "[[ ! $VAR ]]" into a
  #!/bin/sh library that koha-disable, koha-enable, koha-remove,
  koha-list and the init script source under dash. Use POSIX
  equivalents.
- _sysv_restart_zebra and _sysv_restart_sip lost the explicit
  "return 0" of the original quiet not-running branch, so a start
  failure now aborted the caller's whole instance loop under set -e
  (including the init script's restart across all instances). Restore
  it.
- systemctl status is run with --no-pager from koha_service_ctl and
  koha-systemd-ctl so the helpers never block on a pager.
- koha-plack --enable/--disable ran systemctl before editing the Apache
  configuration, so a systemctl failure under set -e left the vhost
  untouched. Do the systemd half after the Apache edits and warn
  instead of aborting.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
2026-09-29 09:02:35 +00:00
..
koha-common.service Bug 40901: (QA follow-up) Make koha-common.service a dependency-free shim 2026-09-29 09:02:30 +00:00
koha-create-dirs@.service Bug 40901: (follow-up) Order per-component units after koha-create-dirs 2026-09-29 09:01:56 +00:00
koha-es-indexer@.service Bug 40901: (QA follow-up) Polish the per-component units 2026-09-29 09:02:32 +00:00
koha-indexer@.service Bug 40901: (QA follow-up) Polish the per-component units 2026-09-29 09:02:32 +00:00
koha-plack@.service Bug 40901: (QA follow-up) Polish the per-component units 2026-09-29 09:02:32 +00:00
koha-sip@.service Bug 40901: (QA follow-up) Polish the per-component units 2026-09-29 09:02:32 +00:00
koha-systemd-ctl Bug 40901: (QA follow-up) Harden the service abstraction in koha-functions.sh 2026-09-29 09:02:35 +00:00
koha-worker-long_tasks@.service Bug 40901: (QA follow-up) Polish the per-component units 2026-09-29 09:02:32 +00:00
koha-worker@.service Bug 40901: (QA follow-up) Polish the per-component units 2026-09-29 09:02:32 +00:00
koha-z3950@.service Bug 40901: (QA follow-up) Polish the per-component units 2026-09-29 09:02:32 +00:00
koha-zebra@.service Bug 40901: (QA follow-up) Polish the per-component units 2026-09-29 09:02:32 +00:00
koha.target
…
koha@.target Bug 40901: (QA follow-up) Polish the per-component units 2026-09-29 09:02:32 +00:00