commit:     8078688abb58c9301fc88dcedef32e5549c5f499
Author:     Peter Leese <inbox <AT> peterleese <DOT> org>
AuthorDate: Wed Sep  3 06:20:06 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Sep  6 14:29:36 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8078688a

net-misc/kea: Stop old kea service on upgrade to >= 3.0

Add pkg_preinst to stop previous kea service, if we are using openrc and
the previous version is < 1.3. Unfortunately there is no simple and fool
proof way to re-instate the services using the new init skeleton without user
intervention and if we don't stop the old service first the user
will find it hard to do post install.

Signed-off-by: Peter Leese <inbox <AT> peterleese.org>
Part-of: https://github.com/gentoo/gentoo/pull/43614
Signed-off-by: Sam James <sam <AT> gentoo.org>

 net-misc/kea/kea-3.0.1.ebuild | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/net-misc/kea/kea-3.0.1.ebuild b/net-misc/kea/kea-3.0.1.ebuild
index 387feda88fe8..79d8c16602f1 100644
--- a/net-misc/kea/kea-3.0.1.ebuild
+++ b/net-misc/kea/kea-3.0.1.ebuild
@@ -261,6 +261,21 @@ src_install() {
        fperms 750 /var/lib/${PN} /var/log/${PN}
 }
 
+pkg_preinst() {
+       if ver_replacing -lt 3.0; then
+               if [[ ${ROOT} ]]; then
+                       return
+               elif [[ -d /run/openrc ]]; then
+                       # There is no easy way to automatically switch to new 
init.d kea scripts, so we have to stop the
+                       # old kea service if running otherwise the user will 
find it is not possible stop the old kea
+                       # service post install
+                       ebegin "Previous kea service will be stopped"
+                       rc-service -q --ifstarted --nodeps kea stop
+                       eend $?
+               fi
+       fi
+}
+
 pkg_postinst() {
        tmpfiles_process ${PN}.conf
 

Reply via email to