Bug 40901: (QA follow-up) Keep /etc conffiles under their koha-common names

The cron, logrotate and defaults files were renamed from koha-common.*
to koha-core.*, so debhelper installed them as /etc/cron.d/koha-core,
/etc/logrotate.d/koha-core and /etc/default/koha-core. dpkg never
deletes a conffile that a package stops shipping, so after an upgrade
both the old and the new files exist side by side:

- every cron job (process_message_queue.pl every 15 minutes,
  overdue_notices.pl, fines.pl, backups...) runs twice
- logrotate complains about duplicate log entries every night
- the admin's /etc/default/koha-common (USE_INDEXER_DAEMON,
  INDEXER_PARAMS, ES_* tuning) is replaced by a symlink to a fresh
  copy of the packaged defaults, silently losing every customisation

Keep the on-disk names instead: koha-core now ships the files as
debian/koha-core.koha-common.* and debian/rules passes
--name=koha-common to dh_installinit, dh_installcron and
dh_installlogrotate. Because koha-core Replaces the old koha-common,
dpkg hands each conffile over with the admin's content intact and no
duplicates are left behind. The defaults file content is byte-identical
to the old koha-common.default so nobody gets a spurious conffile
prompt, and koha-generate-env reads the single canonical name again.

The experimental pre-split koha-core (used by koha-full) had its own
/etc/default/koha-core and /etc/init.d/koha-core; a new
koha-core.maintscript migrates the former with mv_conffile and removes
the latter, with the matching rc.d links dropped in the postinst.
/etc/koha/koha-worker@.service, whose template was deleted, is removed
from upgrading systems too. koha-core.preinst gains the #DEBHELPER#
token the maintscript machinery needs.

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>
This commit is contained in:
Martin Renvoize 2026-09-15 17:29:28 +01:00 committed by Pedro Amorim
parent 760641c550
commit 9485938333
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
13 changed files with 34 additions and 14 deletions

View File

@ -1 +1,2 @@
rm_conffile /etc/init.d/koha-common 26.06~
rm_conffile /etc/koha/koha-worker@.service 26.06~

View File

@ -1,4 +1,4 @@
## General koha-core default options file
## General koha-common default options file
PERL5LIB="/usr/share/koha/lib"
KOHA_HOME="/usr/share/koha"
@ -57,4 +57,4 @@ ES_VERBOSE="no"
# Equivalent to '--where'
#ES_WHERE_QUERY_SQL=""
## End of general koha-core default options
## End of general koha-common default options

View File

@ -4,5 +4,3 @@ usr/sbin/koha-zebra usr/sbin/koha-restart-zebra
usr/sbin/koha-sip usr/sbin/koha-enable-sip
usr/sbin/koha-sip usr/sbin/koha-start-sip
usr/sbin/koha-sip usr/sbin/koha-stop-sip
usr/sbin/koha-sip usr/sbin/koha-stop-sip
etc/default/koha-core etc/default/koha-common

5
debian/koha-core.maintscript vendored Normal file
View File

@ -0,0 +1,5 @@
# The experimental pre-split koha-core shipped its own init script and
# defaults file. The defaults now live under the koha-common name shared with
# every other install; the init script is provided by koha-sysv/koha-systemd.
mv_conffile /etc/default/koha-core /etc/default/koha-common 26.06~
rm_conffile /etc/init.d/koha-core 26.06~

View File

@ -13,6 +13,12 @@ if [ -r $CONFIG ]; then
. $CONFIG
fi
# The pre-split koha-core shipped /etc/init.d/koha-core; the file itself is
# removed by koha-core.maintscript, drop its rc.d links as well.
if [ "$1" = "configure" ] && dpkg --compare-versions "$2" lt-nl 26.06~; then
update-rc.d koha-core remove >/dev/null 2>&1 || true
fi
conf=/etc/mysql/koha-common.cnf
if [ ! -e "$conf" ] && [ ! -L "$conf" ]; then
ln -s debian.cnf "$conf"

View File

@ -8,4 +8,6 @@ set -e
# Bug 25485: remove the tiny_mce symlink if there's one in the way preventing upgrades
[ -h /usr/share/koha/intranet/htdocs/intranet-tmpl/lib/tiny_mce ] && rm /usr/share/koha/intranet/htdocs/intranet-tmpl/lib/tiny_mce
#DEBHELPER#
exit 0

19
debian/rules vendored
View File

@ -8,13 +8,24 @@ export PERL_MM_USE_DEFAULT=1
%:
dh $@ --fail-missing --with bash-completion
# koha-sysv ships the SysV init script under its historical name so that
# dpkg hands /etc/init.d/koha-common over from the old monolithic koha-common
# package and debhelper generates the matching update-rc.d/invoke-rc.d code.
# Files under /etc keep their historical koha-common names: koha-core takes
# them over from the old monolithic koha-common package (Replaces), so dpkg
# transfers the admin's edited conffiles instead of leaving obsolete copies
# behind next to freshly named ones. koha-sysv ships the SysV init script
# under the same name so debhelper generates the update-rc.d/invoke-rc.d
# handling for /etc/init.d/koha-common.
override_dh_installinit:
dh_installinit -pkoha-sysv --name=koha-common
dh_installinit -pkoha-core -pkoha-sysv --name=koha-common
dh_installinit --remaining-packages
override_dh_installcron:
dh_installcron -pkoha-core --name=koha-common
dh_installcron --remaining-packages
override_dh_installlogrotate:
dh_installlogrotate -pkoha-core --name=koha-common
dh_installlogrotate --remaining-packages
override_dh_gencontrol:
debian/bd-to-depends >> debian/koha-common.substvars
debian/bd-to-depends >> debian/koha-core.substvars

View File

@ -75,13 +75,10 @@ EOF
;;
indexer)
# Read from /etc/default/koha-core (fall back to the legacy
# /etc/default/koha-common name on systems upgrading from the
# pre-split packaging).
# /etc/default/koha-common is the defaults file shared by every
# koha-* helper (shipped by koha-core under its historical name).
INDEXER_TIMEOUT=5
if [ -f /etc/default/koha-core ]; then
. /etc/default/koha-core
elif [ -f /etc/default/koha-common ]; then
if [ -f /etc/default/koha-common ]; then
. /etc/default/koha-common
fi