git: 91f78c32befa - main - rc.d/kdc: Support start of MIT krb5kdc

From: Cy Schubert <cy_at_FreeBSD.org>
Date: Mon, 22 Jan 2024 00:06:52 UTC
The branch main has been updated by cy:

URL: https://cgit.FreeBSD.org/src/commit/?id=91f78c32befa08bf4010db7afd4407277a3e585f

commit 91f78c32befa08bf4010db7afd4407277a3e585f
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2024-01-20 13:52:35 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2024-01-22 00:06:26 +0000

    rc.d/kdc: Support start of MIT krb5kdc
    
    Some users wishing to use the MIT krb5kdc have discovered the
    kdc script workaround applied to the MIT krb5 ports is insufficient.
    Let's build into this rc script the smarts to determine whether
    base or ports Hiemdal kdc is being invoked or the MIT krb5kdc.
    
    While at it, remove kdc_start_precmd(). This will simplify a future
    jail patch.
    
    Suggested by:           netchild
    Original patch:         netchild
    Reviewed by:            emaste, netchild
    MFC after:              1 week
    Differential Revision:  https://reviews.freebsd.org/D43523
---
 libexec/rc/rc.d/kdc | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/libexec/rc/rc.d/kdc b/libexec/rc/rc.d/kdc
index 4b8cf87197e8..c3059f261e09 100755
--- a/libexec/rc/rc.d/kdc
+++ b/libexec/rc/rc.d/kdc
@@ -12,17 +12,15 @@
 name=kdc
 desc="Kerberos 5 server"
 rcvar=${name}_enable
-start_precmd=${name}_start_precmd
 
 set_rcvar_obsolete kerberos5_server_enable kdc_enable
 set_rcvar_obsolete kerberos5_server kdc_program
 set_rcvar_obsolete kerberos5_server_flags kdc_flags
 
-kdc_start_precmd()
-{
-
-	command_args="$command_args --detach"
-}
 
 load_rc_config $name
+if [ "${kdc_program}" = /usr/libexec/kdc -o \
+     "${kdc_program}" = /usr/local/libexec/kdc ]; then
+	command_args="$command_args --detach"
+fi
 run_rc_command "$1"