Bugzilla – Attachment 195099 Details for
Bug 40901
koha-common.service bundles all sub-daemons under one systemd service instead of per-instance services
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40901: Restructure packages - koha-common becomes metapackage
b844bea.patch (text/plain), 17.82 KB, created by
Tomás Cohen Arazi (tcohen)
on 2026-03-10 19:15:44 UTC
(
hide
)
Description:
Bug 40901: Restructure packages - koha-common becomes metapackage
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2026-03-10 19:15:44 UTC
Size:
17.82 KB
patch
obsolete
>From b844bea011cc88b4d0fc612031eae648d6c73e50 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Tom=C3=A1s=20Cohen=20Arazi?= <tomascohen@theke.io> >Date: Tue, 10 Mar 2026 15:21:31 -0300 >Subject: [PATCH] Bug 40901: Restructure packages - koha-common becomes > metapackage > >This patch restructures the Koha packaging to support both systemd and >SysV init systems through a clean separation of concerns. > >Package hierarchy: >- koha-core: Core application files (no init system) >- koha-systemd: Native systemd units (Provides: koha-init) >- koha-sysv: SysV init scripts (Provides: koha-init, Conflicts: koha-systemd) >- koha-common: Metapackage (Depends: koha-core, koha-systemd | koha-sysv) > >Changes: >- koha-core: Removed 'daemon' dependency, updated description to clarify > it provides core files without init system >- koha-systemd: Now depends on koha-core instead of koha-common, provides > koha-init virtual package >- koha-sysv: Now depends on koha-core instead of koha-common, provides > koha-init virtual package >- koha-common: Converted to metapackage that depends on koha-core and > prefers koha-systemd on systemd-based systems >- Removed koha-common.install (files now installed by koha-core) >- Simplified koha-common.postinst (metapackage has minimal logic) > >Benefits: >- Clean separation between core application and init system >- Users can explicitly choose their init system >- KTD can use koha-sysv without systemd >- Modern systems get native systemd by default >- Conflicts prevent both init systems being active simultaneously > >Test plan: >1. Build packages >2. Install koha-common on a systemd system, verify koha-systemd is pulled in >3. Try installing both koha-systemd and koha-sysv, verify conflict >4. Install koha-core + koha-sysv explicitly, verify it works >--- > debian/control.in | 40 ++--- > debian/koha-common.install | 40 ----- > debian/koha-common.postinst | 295 ------------------------------------ > 3 files changed, 16 insertions(+), 359 deletions(-) > delete mode 100644 debian/koha-common.install > >diff --git a/debian/control.in b/debian/control.in >index afeac3feb6..d0213a1296 100644 >--- a/debian/control.in >+++ b/debian/control.in >@@ -16,26 +16,14 @@ Build-Depends:__AUTODEPENDS__, > > Package: koha-common > Architecture: all >-Depends: ${misc:Depends}, ${koha:Depends}, >+Depends: ${misc:Depends}, >+ koha-core, >+ koha-systemd | koha-sysv, > apache2, > apache2-mpm-itk | libapache2-mpm-itk, >- at, >- cron-daemon, >- daemon, >- debconf, > idzebra-2.0, >- koha-l10n, > memcached, >- mysql-client | virtual-mysql-client, >- perl-doc, >- pwgen, >- rabbitmq-server, >- sudo, >- fonts-dejavu | ttf-dejavu, >- unzip, >- weasyprint, >- xmlstarlet, >- yaz >+ rabbitmq-server > Suggests: mysql-server | virtual-mysql-server, > letsencrypt, > Homepage: http://koha-community.org/ >@@ -43,8 +31,9 @@ Description: integrated (physical) library management system > Koha is an Integrated Library Management system for real-world libraries > (the kinds with books). > . >- This package contains everything needed to run Koha, except the site >- specific configuration files. See the package koha for the rest. >+ This metapackage installs the complete Koha system with all dependencies. >+ On systemd-based systems, it will use native systemd units (koha-systemd). >+ On other systems or containers, it will use SysV init scripts (koha-sysv). > > Package: koha > Architecture: all >@@ -108,14 +97,15 @@ Description: integrated (physical) library management system > Koha is an Integrated Library Management system for real-world libraries > (the kinds with books). > . >- This package provides a version of Koha identical to that of koha-full, >- but without third-party systems such as MariaDB, RabbitMQ, et cetera. >+ This package provides the core Koha application files, scripts, and >+ configuration without any init system. It requires either koha-sysv or >+ koha-systemd to manage services. > . >- This package is EXPERIMENTAL and not recommended for production use. >+ Most users should install koha-common instead, which will automatically >+ select the appropriate init system. > Depends: ${misc:Depends}, ${koha:Depends}, > at, > cron-daemon, >- daemon, > debconf, > koha-l10n, > mysql-client | virtual-mysql-client, >@@ -150,7 +140,9 @@ Description: integrated (physical) library management system > > Package: koha-systemd > Architecture: all >-Depends: ${misc:Depends}, systemd, koha-common >+Depends: ${misc:Depends}, systemd, koha-core >+Provides: koha-init >+Conflicts: koha-sysv > Description: systemd units for Koha ILS > Koha is an Integrated Library Management system for real-world libraries > (the kinds with books). >@@ -165,7 +157,7 @@ Description: systemd units for Koha ILS > > Package: koha-sysv > Architecture: all >-Depends: ${misc:Depends}, daemon, koha-common >+Depends: ${misc:Depends}, daemon, koha-core > Provides: koha-init > Conflicts: koha-systemd > Description: SysV init scripts for Koha ILS >diff --git a/debian/koha-common.install b/debian/koha-common.install >deleted file mode 100644 >index 2b8c0f4646..0000000000 >--- a/debian/koha-common.install >+++ /dev/null >@@ -1,40 +0,0 @@ >-debian/tmp/usr/* usr >-debian/tmp/etc/koha/zebradb/[!z]* >-debian/tmp/etc/koha/z3950 >-debian/templates/* etc/koha >-debian/koha-post-install-setup usr/sbin >-debian/unavailable.html usr/share/koha/intranet/htdocs >-debian/unavailable.html usr/share/koha/opac/htdocs >-debian/templates/* etc/koha >-debian/scripts/koha-functions.sh usr/share/koha/bin >-debian/scripts/koha-create usr/sbin >-debian/scripts/koha-create-dirs usr/sbin >-debian/scripts/koha-disable usr/sbin >-debian/scripts/koha-dump usr/sbin >-debian/scripts/koha-dump-defaults usr/sbin >-debian/scripts/koha-elasticsearch usr/sbin >-debian/scripts/koha-email-disable usr/sbin >-debian/scripts/koha-email-enable usr/sbin >-debian/scripts/koha-enable usr/sbin >-debian/scripts/koha-es-indexer usr/sbin >-debian/scripts/koha-foreach usr/sbin >-debian/scripts/koha-indexer usr/sbin >-debian/scripts/koha-list usr/sbin >-debian/scripts/koha-mysql usr/sbin >-debian/scripts/koha-passwd usr/sbin >-debian/scripts/koha-plack usr/sbin >-debian/scripts/koha-rebuild-zebra usr/sbin >-debian/scripts/koha-remove usr/sbin >-debian/scripts/koha-reset-passwd usr/sbin >-debian/scripts/koha-restore usr/sbin >-debian/scripts/koha-run-backups usr/sbin >-debian/scripts/koha-shell usr/sbin >-debian/scripts/koha-sip usr/sbin >-debian/scripts/koha-sitemap usr/sbin >-debian/scripts/koha-translate usr/sbin >-debian/scripts/koha-upgrade-schema usr/sbin >-debian/scripts/koha-upgrade-to-3.4 usr/sbin >-debian/scripts/koha-worker usr/sbin >-debian/scripts/koha-z3950-responder usr/sbin >-debian/scripts/koha-zebra usr/sbin >-debian/tmp_docbook/*.8 usr/share/man/man8 >diff --git a/debian/koha-common.postinst b/debian/koha-common.postinst >index 083dcebfc4..b7ec5041d5 100644 >--- a/debian/koha-common.postinst >+++ b/debian/koha-common.postinst >@@ -2,301 +2,6 @@ > > set -e > >-# Default to "yes" >-AUTOMATIC_TRANSLATIONS_UPDATE="yes" >- >-. /usr/share/debconf/confmodule >- >-# Read configuration variable file if it is present >-CONFIG=/etc/koha/koha-common.conf >-if [ -r $CONFIG ]; then >- . $CONFIG >-fi >- >-conf=/etc/mysql/koha-common.cnf >-if [ ! -e "$conf" ] && [ ! -L "$conf" ]; then >- ln -s debian.cnf "$conf" >-fi >- > #DEBHELPER# > >-koha-upgrade-schema $(koha-list) >- >-# Generate a config file if one doesn't exist already >-if [ ! -e $CONFIG ]; then >- cat <<EOF >$CONFIG >-## Automatic template translation update >-# >-# This variable controls whether template translations should >-# be updated automatically on koha-common package upgrades. >-# Options: 'yes' (default) >-# 'no' >-# Note: if you choose 'no' then you will have to issue >-# $ koha-translate --update <lang_code> >-# >-AUTOMATIC_TRANSLATIONS_UPDATE="yes" >-EOF >-fi >- >-# Substitute the values from debconf into the file. >-db_get koha-common/automatically-update-translations >-UPDATE="$RET" >-if [ "$UPDATE" = "false" ]; then >- UPDATE="no" >-else >- UPDATE="yes" >-fi >-# In case they were removed/commented out, we add it in. >-grep -Eq '^ *AUTOMATIC_TRANSLATIONS_UPDATE=' $CONFIG || >- echo "AUTOMATIC_TRANSLATIONS_UPDATE=" >>$CONFIG >- >-sed -e "s/^ *AUTOMATIC_TRANSLATIONS_UPDATE=.*/AUTOMATIC_TRANSLATIONS_UPDATE=\"$UPDATE\"/" <$CONFIG >$CONFIG.tmp >-mv -f $CONFIG.tmp $CONFIG >- >-if [ "$AUTOMATIC_TRANSLATIONS_UPDATE" = "yes" ]; then >- for lang in $(koha-translate --list | grep -v -x "en"); do >- if koha-translate --update $lang; then >- echo "Updated the $lang translations." >- else >- cat <<EOF >&2 >-ERROR: an error was found when updating '$lang' translations. Please manually >-run 'koha-translate --update $lang'. Run man koha-translate for more options. >-EOF >- fi >- done >-else >- # no auto-update, check update needed and warn if needed >- if koha-translate --list | grep -v -q -x "en"; then >- # translations installed, update needed >- cat <<EOF >&2 >-Warning: template translations are not set to be automatically updated. >-Please manually run 'koha-translate --update lang_code' to update them. >- >-You can run 'koha-translate --list' to get a list of the installed translations codes. >-EOF >- fi >-fi >- >-# Check if we need to rename the Apache vhost files >-RENAME_APACHE_FILES="no" >-for vhost in $(koha-list); do >- if [ -f "/etc/apache2/sites-available/$vhost" ] && >- [ ! -f "/etc/apache2/sites-available/$vhost.conf" ]; then >- RENAME_APACHE_FILES="yes" >- break # at least one, trigger renaming >- fi >-done >- >-if [ "$RENAME_APACHE_FILES" = "yes" ]; then >- # If the user agreed we now rename their Apache files >- db_get koha-common/rename-apache-vhost-files >- if [ "$RET" = "false" ]; then >- # We're not renaming the files, just print a warning >- cat <<EOF >&2 >-Warning: you have chosen not to migrate your Apache virtual hosts files to the >-Apache 2.4 naming schema. You can do it manually by running this for each >-Koha instance: >- >- $ sudo a2dissite instance >- $ sudo mv /etc/apache2/sites-available/instance \ >- /etc/apache2/sites-available/instance.conf >- $ sudo a2ensite instance >-EOF >- else >- # We have to rename the Apache files >- for site in $(koha-list); do >- ENABLE_VHOST="yes" >- if [ -f "/etc/apache2/sites-available/$site" ] && >- [ ! -f "/etc/apache2/sites-available/$site.conf" ]; then >- if [ ! -f "/etc/apache2/sites-enabled/$site" ]; then >- ENABLE_VHOST="no" >- fi >- a2dissite $site >/dev/null 2>&1 || true >- rm -f "/etc/apache2/sites-enabled/$site" >- # Rename the vhost definition files >- mv "/etc/apache2/sites-available/$site" \ >- "/etc/apache2/sites-available/$site.conf" >- >- if [ "$ENABLE_VHOST" = "yes" ]; then >- if ! { >- a2ensite "$site" >/dev/null 2>&1 || >- a2ensite "${site}.conf" >/dev/null 2>&1 >- }; then >- echo "Warning: problem enabling $site in Apache" >&2 >- fi >- fi >- fi >- done >- fi >-fi >- >-log4perl_component() { >- local config=$1 >- local component=$2 >- >- if grep -q "log4perl.logger.$component" $config; then >- return 0 >- else >- return 1 >- fi >-} >- >-# Take care of the instance's log4perl.conf file >-for site in $(koha-list); do >- log4perl_config="/etc/koha/sites/$site/log4perl.conf" >- if ! log4perl_component $log4perl_config "z3950"; then >- cat <<EOF >>$log4perl_config >-log4perl.logger.z3950 = WARN, Z3950 >-log4perl.appender.Z3950=Log::Log4perl::Appender::File >-log4perl.appender.Z3950.filename=/var/log/koha/$site/z3950-error.log >-log4perl.appender.Z3950.mode=append >-log4perl.appender.Z3950.layout=PatternLayout >-log4perl.appender.Z3950.layout.ConversionPattern=[%d] [%p] %m %l%n >-log4perl.appender.Z3950.utf8=1 >- >-EOF >- fi >- >- if ! log4perl_component $log4perl_config "api"; then >- cat <<EOF >>$log4perl_config >-log4perl.logger.api = WARN, API >-log4perl.appender.API=Log::Log4perl::Appender::File >-log4perl.appender.API.filename=/var/log/koha/$site/api-error.log >-log4perl.appender.API.mode=append >-log4perl.appender.API.layout=PatternLayout >-log4perl.appender.API.layout.ConversionPattern=[%d] [%p] %m %l%n >-log4perl.appender.API.utf8=1 >- >-EOF >- fi >-done >- >-for site in $(koha-list); do >- log4perl_config="/etc/koha/sites/$site/log4perl.conf" >- if ! log4perl_component $log4perl_config "sip"; then >- cat <<EOF >>$log4perl_config >-log4perl.logger.sip = DEBUG, SIP >-log4perl.appender.SIP=Log::Log4perl::Appender::File >-log4perl.appender.SIP.filename=/var/log/koha/$site/sip-output.log >-log4perl.appender.SIP.mode=append >-log4perl.appender.SIP.layout=PatternLayout >-log4perl.appender.SIP.layout.ConversionPattern=[%d] [%P] [%p] %X{accountid}@%X{peeraddr}: %m %l%n >-log4perl.appender.SIP.utf8=1 >- >-EOF >- fi >-done >- >-for site in $(koha-list); do >- log4perl_config="/etc/koha/sites/$site/log4perl.conf" >- if ! log4perl_component $log4perl_config "plack-opac"; then >- cat <<EOF >>$log4perl_config >-log4perl.logger.plack-opac = WARN, PLACKOPAC >-log4perl.appender.PLACKOPAC=Log::Log4perl::Appender::File >-log4perl.appender.PLACKOPAC.filename=/var/log/koha/$site/plack-opac-error.log >-log4perl.appender.PLACKOPAC.mode=append >-log4perl.appender.PLACKOPAC.layout=PatternLayout >-log4perl.appender.PLACKOPAC.layout.ConversionPattern=[%d] [%p] %m%n >-log4perl.appender.PLACKOPAC.utf8=1 >- >-EOF >- fi >-done >- >-for site in $(koha-list); do >- log4perl_config="/etc/koha/sites/$site/log4perl.conf" >- if ! log4perl_component $log4perl_config "plack-api"; then >- cat <<EOF >>$log4perl_config >-log4perl.logger.plack-api = WARN, PLACKAPI >-log4perl.appender.PLACKAPI=Log::Log4perl::Appender::File >-log4perl.appender.PLACKAPI.filename=/var/log/koha/$site/plack-api-error.log >-log4perl.appender.PLACKAPI.mode=append >-log4perl.appender.PLACKAPI.layout=PatternLayout >-log4perl.appender.PLACKAPI.layout.ConversionPattern=[%d] [%p] %m%n >-log4perl.appender.PLACKAPI.utf8=1 >- >-EOF >- fi >-done >- >-for site in $(koha-list); do >- log4perl_config="/etc/koha/sites/$site/log4perl.conf" >- if ! log4perl_component $log4perl_config "plack-intranet"; then >- cat <<EOF >>$log4perl_config >-log4perl.logger.plack-intranet = WARN, PLACKINTRANET >-log4perl.appender.PLACKINTRANET=Log::Log4perl::Appender::File >-log4perl.appender.PLACKINTRANET.filename=/var/log/koha/$site/plack-intranet-error.log >-log4perl.appender.PLACKINTRANET.mode=append >-log4perl.appender.PLACKINTRANET.layout=PatternLayout >-log4perl.appender.PLACKINTRANET.layout.ConversionPattern=[%d] [%p] %m%n >-log4perl.appender.PLACKINTRANET.utf8=1 >- >-EOF >- fi >-done >- >-for site in $(koha-list); do >- log4perl_config="/etc/koha/sites/$site/log4perl.conf" >- if ! log4perl_component $log4perl_config "worker"; then >- cat <<EOF >>$log4perl_config >-log4perl.logger.worker = WARN, WORKER >-log4perl.appender.WORKER=Log::Log4perl::Appender::Screen >-log4perl.appender.WORKER.stderr=1 >-log4perl.appender.WORKER.layout=PatternLayout >-log4perl.appender.WORKER.layout.ConversionPattern=[%d] [%p] %m %l%n >-log4perl.appender.WORKER.utf8=1 >- >-EOF >- fi >-done >- >-for site in $(koha-list); do >- log4perl_config="/etc/koha/sites/$site/log4perl.conf" >- if ! log4perl_component $log4perl_config "edi"; then >- cat <<EOF >>$log4perl_config >-log4perl.logger.edi = TRACE, EDI >-log4perl.appender.EDI=Log::Log4perl::Appender::File >-log4perl.appender.EDI.filename=/var/log/koha/$site/editrace.log >-log4perl.appender.EDI.mode=append >-log4perl.appender.EDI.layout=PatternLayout >-log4perl.appender.EDI.layout.ConversionPattern=[%d] [%P] [%p] %X{accountid}@%X{peeraddr}: %m %l%n >-log4perl.appender.EDI.utf8=1 >- >-EOF >- fi >-done >- >-for site in $(koha-list); do >- kohaconfig="/etc/koha/sites/$site/koha-conf.xml" >- logdir="$(xmlstarlet sel -t -v 'yazgfs/config/logdir' $kohaconfig)" >- if [ "$logdir" != "" ] && [ "$logdir" != "0" ]; then >- chown -R $site-koha:$site-koha $logdir >- else >- chown -R $site-koha:$site-koha /var/log/koha/$site >- fi >-done >- >-# Bug 14106 - fix the modulePath of existing koha instances so that it'll >-# continue to work. This will only patch the files if the exact original string >-# that we're fixing them from is there, so we just run it every time. Maybe >-# in many years time we can get rid of this, when no one will be running >-# Koha < 3.20. >-for zfile in $(find /etc/koha/sites -name zebra-authorities-dom.cfg -or -name zebra-biblios-dom.cfg); do >- perl -p -i -e 's{^modulePath: /usr/lib/idzebra-2.0/modules$}{modulePath: /usr/lib/idzebra-2.0/modules:/usr/lib/x86_64-linux-gnu/idzebra-2.0/modules:/usr/lib/i386-linux-gnu/idzebra-2.0/modules:/usr/lib/aarch64-linux-gnu/idzebra-2.0/modules:/usr/lib/arm-linux-gnueabi/idzebra-2.0/modules:/usr/lib/arm-linux-gnueabihf/idzebra-2.0/modules:/usr/lib/mips-linux-gnu/idzebra-2.0/modules:/usr/lib/mipsel-linux-gnu/idzebra-2.0/modules:/usr/lib/powerpc-linux-gnu/idzebra-2.0/modules:/usr/lib/powerpc64le-linux-gnu/idzebra-2.0/modules:/usr/lib/s390x-linux-gnu/idzebra-2.0/modules}' $zfile >-done >- >-db_stop >- >-rabbitmq-plugins enable rabbitmq_stomp >-service rabbitmq-server restart >- >-# Bug 35242: Force memcache restart after koha install/upgrade >-service memcached restart >- >-# Bug 18250: Correct startup order of koha-common and memcached >-# Since the init script has been updated, we can force the order in rc.d >-# by disabling and enabling again. >-update-rc.d koha-common disable >-update-rc.d koha-common enable >- > exit 0 >-- >2.50.1 (Apple Git-155) >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 40901
:
195097
|
195098
| 195099