From 1673ed39e514325315b89c45f13ad621782f2683 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Cohen=20Arazi?= Date: Tue, 10 Mar 2026 15:05:57 -0300 Subject: [PATCH] Bug 40901: Add koha-sysv package for SysV init support This patch introduces the koha-sysv package, which provides traditional SysV init.d scripts for managing Koha instances. All services (Plack, Zebra, SIP, Z3950, workers, indexers) are managed through a single init script using the daemon wrapper. The package includes: - /etc/init.d/koha-common (SysV init script) - /lib/systemd/system/koha-common.service (systemd wrapper for init.d) This package is intended for legacy systems, containers without systemd (like KTD), or environments where SysV init is preferred. The package provides 'koha-init' and conflicts with koha-systemd to ensure only one init system is active at a time. Test plan: 1. Build and install the package 2. Start services with /etc/init.d/koha-common start 3. Verify all services start correctly 4. Check that koha-systemd cannot be installed alongside --- debian/control.in | 16 ++++++++++++++++ debian/koha-sysv.install | 2 ++ debian/koha-sysv.postinst | 13 +++++++++++++ debian/koha-sysv.postrm | 15 +++++++++++++++ debian/koha-sysv.prerm | 16 ++++++++++++++++ 5 files changed, 62 insertions(+) create mode 100644 debian/koha-sysv.install create mode 100755 debian/koha-sysv.postinst create mode 100755 debian/koha-sysv.postrm create mode 100755 debian/koha-sysv.prerm diff --git a/debian/control.in b/debian/control.in index 10f8801495..afeac3feb6 100644 --- a/debian/control.in +++ b/debian/control.in @@ -162,3 +162,19 @@ Description: systemd units for Koha ILS This allows granular control over individual services per instance and leverages systemd features like dependency management, resource limits, and journald logging. + +Package: koha-sysv +Architecture: all +Depends: ${misc:Depends}, daemon, koha-common +Provides: koha-init +Conflicts: koha-systemd +Description: SysV init scripts for Koha ILS + Koha is an Integrated Library Management system for real-world libraries + (the kinds with books). + . + This package provides traditional SysV init.d scripts for managing Koha + instances. All services (Plack, Zebra, SIP, Z3950, workers, indexers) are + managed through a single init script using the daemon wrapper. + . + This package is intended for legacy systems, containers without systemd + (like KTD), or environments where SysV init is preferred. diff --git a/debian/koha-sysv.install b/debian/koha-sysv.install new file mode 100644 index 0000000000..4f89cde45d --- /dev/null +++ b/debian/koha-sysv.install @@ -0,0 +1,2 @@ +debian/koha-common.init etc/init.d/koha-common +debian/koha-common.service lib/systemd/system/ diff --git a/debian/koha-sysv.postinst b/debian/koha-sysv.postinst new file mode 100755 index 0000000000..54c5ad42e6 --- /dev/null +++ b/debian/koha-sysv.postinst @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e + +#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 +fi + +exit 0 diff --git a/debian/koha-sysv.postrm b/debian/koha-sysv.postrm new file mode 100755 index 0000000000..3936c791c1 --- /dev/null +++ b/debian/koha-sysv.postrm @@ -0,0 +1,15 @@ +#!/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 new file mode 100755 index 0000000000..ad89ea127c --- /dev/null +++ b/debian/koha-sysv.prerm @@ -0,0 +1,16 @@ +#!/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 -- 2.50.1 (Apple Git-155)