Two problems in how the units consume koha-generate-env's output:
1. koha-z3950@.service passed ${Z3950_ADDITIONAL_OPTS}. In systemd unit
files "${VAR}" always expands to exactly one argument, and to a single
empty argument when the variable is empty; only unbraced "$VAR" is
word-split. So a configured value like "--add-item-status k -t 5"
reached z3950_responder.pl as one unknown option, and the default
empty value reached it as a "" listener address. Verified with
systemd-run: ${X}="--a --b" gives ["--a --b"], ${Y}="" gives [""],
$X gives ["--a"] ["--b"]. Use the unbraced form.
2. koha-indexer@.service hardcoded rebuild_zebra.pl -daemon -sleep,
ignoring ALTERNATE_INDEXER_DAEMON and INDEXER_PARAMS from
/etc/default/koha-common that the SysV path honours. koha-generate-env
now resolves INDEXER_DAEMON and INDEXER_PARAMS exactly like
koha-indexer and the unit runs them through /usr/bin/env, so any
configured indexer works.
koha-generate-env is also tightened up: numeric values are validated
and fall back to their defaults, every value is forced onto one line
without quote characters so the EnvironmentFile always parses, the
debug_mode test matches is_debug_mode, Z3950_ADDITIONAL_OPTS is read
from /etc/default/koha-common first (as before this patchset), the
Z39.50 config dir uses the same config.xml test as is_z3950_enabled,
the env dir is created with the instance's ownership if it does not
exist yet, and unknown services get an empty env file instead of a
chmod failure. The responder is invoked through /usr/bin/perl like the
other Perl daemons.
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>