From 9485938333efb0e19ae8654d4654b4f92b30be0a Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 15 Sep 2026 17:29:28 +0100 Subject: [PATCH] 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 Signed-off-by: Martin Renvoize Signed-off-by: Pedro Amorim --- debian/koha-common.maintscript | 1 + ...re.cron.d => koha-core.koha-common.cron.d} | 0 ...daily => koha-core.koha-common.cron.daily} | 0 ...urly => koha-core.koha-common.cron.hourly} | 0 ...hly => koha-core.koha-common.cron.monthly} | 0 ....default => koha-core.koha-common.default} | 4 ++-- ...rotate => koha-core.koha-common.logrotate} | 0 debian/koha-core.links | 2 -- debian/koha-core.maintscript | 5 +++++ debian/koha-core.postinst | 6 ++++++ debian/koha-core.preinst | 2 ++ debian/rules | 19 +++++++++++++++---- debian/scripts/koha-generate-env | 9 +++------ 13 files changed, 34 insertions(+), 14 deletions(-) rename debian/{koha-core.cron.d => koha-core.koha-common.cron.d} (100%) rename debian/{koha-core.cron.daily => koha-core.koha-common.cron.daily} (100%) rename debian/{koha-core.cron.hourly => koha-core.koha-common.cron.hourly} (100%) rename debian/{koha-core.cron.monthly => koha-core.koha-common.cron.monthly} (100%) rename debian/{koha-core.default => koha-core.koha-common.default} (95%) rename debian/{koha-core.logrotate => koha-core.koha-common.logrotate} (100%) create mode 100644 debian/koha-core.maintscript diff --git a/debian/koha-common.maintscript b/debian/koha-common.maintscript index 13514fda1f..d27d8abd31 100644 --- a/debian/koha-common.maintscript +++ b/debian/koha-common.maintscript @@ -1 +1,2 @@ rm_conffile /etc/init.d/koha-common 26.06~ +rm_conffile /etc/koha/koha-worker@.service 26.06~ diff --git a/debian/koha-core.cron.d b/debian/koha-core.koha-common.cron.d similarity index 100% rename from debian/koha-core.cron.d rename to debian/koha-core.koha-common.cron.d diff --git a/debian/koha-core.cron.daily b/debian/koha-core.koha-common.cron.daily similarity index 100% rename from debian/koha-core.cron.daily rename to debian/koha-core.koha-common.cron.daily diff --git a/debian/koha-core.cron.hourly b/debian/koha-core.koha-common.cron.hourly similarity index 100% rename from debian/koha-core.cron.hourly rename to debian/koha-core.koha-common.cron.hourly diff --git a/debian/koha-core.cron.monthly b/debian/koha-core.koha-common.cron.monthly similarity index 100% rename from debian/koha-core.cron.monthly rename to debian/koha-core.koha-common.cron.monthly diff --git a/debian/koha-core.default b/debian/koha-core.koha-common.default similarity index 95% rename from debian/koha-core.default rename to debian/koha-core.koha-common.default index 6c108e4fe1..bbe7524ab7 100644 --- a/debian/koha-core.default +++ b/debian/koha-core.koha-common.default @@ -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 diff --git a/debian/koha-core.logrotate b/debian/koha-core.koha-common.logrotate similarity index 100% rename from debian/koha-core.logrotate rename to debian/koha-core.koha-common.logrotate diff --git a/debian/koha-core.links b/debian/koha-core.links index 31ecd3f14c..f330f5b745 100644 --- a/debian/koha-core.links +++ b/debian/koha-core.links @@ -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 diff --git a/debian/koha-core.maintscript b/debian/koha-core.maintscript new file mode 100644 index 0000000000..d2b9df418d --- /dev/null +++ b/debian/koha-core.maintscript @@ -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~ diff --git a/debian/koha-core.postinst b/debian/koha-core.postinst index 3b312507c4..2862c705df 100644 --- a/debian/koha-core.postinst +++ b/debian/koha-core.postinst @@ -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" diff --git a/debian/koha-core.preinst b/debian/koha-core.preinst index 648a2e1632..0e73b369ba 100644 --- a/debian/koha-core.preinst +++ b/debian/koha-core.preinst @@ -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 diff --git a/debian/rules b/debian/rules index 852a5a2b9b..05c9eb23db 100755 --- a/debian/rules +++ b/debian/rules @@ -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 diff --git a/debian/scripts/koha-generate-env b/debian/scripts/koha-generate-env index 6b908afb49..fe05cfdadc 100755 --- a/debian/scripts/koha-generate-env +++ b/debian/scripts/koha-generate-env @@ -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