From 1425743c10eef1cf6a2553293f099f409c3c0ffb Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 12 May 2026 11:27:41 -0400 Subject: [PATCH] Bug 40901: (follow-up) koha-remove leaves koha@.target enabled Disable koha@.target and koha-create-dirs@.service so their koha.target.wants/ symlinks don't outlive the instance. Signed-off-by: Kyle M Hall Signed-off-by: Martin Renvoize Signed-off-by: Pedro Amorim --- debian/scripts/koha-remove | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/debian/scripts/koha-remove b/debian/scripts/koha-remove index 90b94b506a..24426b5865 100755 --- a/debian/scripts/koha-remove +++ b/debian/scripts/koha-remove @@ -102,6 +102,16 @@ eof koha-es-indexer --disable $name || /bin/true fi + # Under systemd, disable the per-instance target and create-dirs + # oneshot so we don't leave dangling symlinks under + # /etc/systemd/system/koha.target.wants/ once the instance is gone. + if [ "$(koha_init_backend)" = "systemd" ]; then + systemctl stop "koha@${name}.target" 2>/dev/null || true + systemctl disable "koha@${name}.target" 2>/dev/null || true + systemctl stop "koha-create-dirs@${name}.service" 2>/dev/null || true + systemctl disable "koha-create-dirs@${name}.service" 2>/dev/null || true + fi + instancefile=$(get_apache_config_for $name) le_opacdomain=$(letsencrypt_get_opacdomain_for $name)