git: 0bee17af48dd - stable/15 - etc/rc.subr: svcj - use the filename for services

Alexander Leidinger <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.src
Message-ID <6a897d4e.1d64c.6c054fa1__10175.8619233564$1787395428$gmane$org@gitrepo.freebsd.org>
The branch stable/15 has been updated by netchild:

URL: https://cgit.FreeBSD.org/src/commit/?id=0bee17af48ddd09ff3fa83e6e3b537b89d131bb0

commit 0bee17af48ddd09ff3fa83e6e3b537b89d131bb0
Author:     Alexander Leidinger <[email protected]>
AuthorDate: 2026-08-14 07:49:35 +0000
Commit:     Alexander Leidinger <[email protected]>
CommitDate: 2026-08-22 10:43:01 +0000

    etc/rc.subr: svcj - use the filename for services
    
    We have ports and basesystem services, where the internal name and the
    filename differ. While the documentation recommends to keep them in
    sync, the reality is different. For service jails use the basename of
    the service filename.
    Fixes:          2efbd48 rc: add service jails framework
    Suggested by:   joneum
    MFC after:      1 week
    MFC to:         stable/15
    
    (cherry picked from commit d0f0a3b89b932b776b76278fa6885f19e8b30cbb)
---
 libexec/rc/rc.subr | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/libexec/rc/rc.subr b/libexec/rc/rc.subr
index 0c5d616f2c07..2a5e835d3ca6 100644
--- a/libexec/rc/rc.subr
+++ b/libexec/rc/rc.subr
@@ -1401,8 +1401,8 @@ run_rc_command()
 						fi
 						if [ ${_do_jailing} -eq 1 ]; then
 							$JAIL_CMD -c $_svcj_generic_params $_svcj_cmd_options \
-							    exec.start="${SERVICE} -E _rc_svcj=jailing ${name} ${_rc_prefix}start $rc_extra_args" \
-							    exec.stop="${SERVICE} -E _rc_svcj=jailing ${name} ${_rc_prefix}stop $rc_extra_args" \
+							    exec.start="${SERVICE} -E _rc_svcj=jailing ${rc_service##*/} ${_rc_prefix}start $rc_extra_args" \
+							    exec.stop="${SERVICE} -E _rc_svcj=jailing ${rc_service##*/} ${_rc_prefix}stop $rc_extra_args" \
 							    exec.consolelog="/var/log/svcj_${name}_console.log" \
 							    name=svcj-${name} && _return=0
 						fi
@@ -1412,7 +1412,7 @@ run_rc_command()
 					;;
 				stop)
 					if [ "${_rc_svcj}" != jailing ]; then
-						$SERVICE -E _rc_svcj=jailing -j svcj-${name} ${name} ${_rc_prefix}stop $rc_extra_args || _return=1
+						$SERVICE -E _rc_svcj=jailing -j svcj-${name} ${rc_service##*/} ${_rc_prefix}stop $rc_extra_args || _return=1
 						$JAIL_CMD -r svcj-${name} 2>/dev/null
 					else
 						_run_rc_doit "$_cmd $rc_extra_args" || _return=1
@@ -1423,7 +1423,7 @@ run_rc_command()
 					eval _rc_svcj_extra_cmd=\$${name}_${rc_arg}_svcj_enable
 					: ${_rc_svcj_extra_cmd:=NO}
 					if checkyesno _rc_svcj_extra_cmd && [ "${_rc_svcj}" != jailing ]; then
-						$SERVICE -v -E _rc_svcj=jailing -j svcj-${name} ${name} ${_rc_prefix}${rc_arg} $rc_extra_args || _return=1
+						$SERVICE -v -E _rc_svcj=jailing -j svcj-${name} ${rc_service##*/} ${_rc_prefix}${rc_arg} $rc_extra_args || _return=1
 					else
 						_run_rc_doit "$_cmd $rc_extra_args" || _return=1
 					fi
@@ -1503,8 +1503,8 @@ run_rc_command()
 						fi
 					fi
 					$JAIL_CMD -c $_svcj_generic_params $_svcj_cmd_options\
-					    exec.start="${SERVICE} -E _rc_svcj=jailing ${name} ${_rc_prefix}start $rc_extra_args" \
-					    exec.stop="${SERVICE} -E _rc_svcj=jailing ${name} ${_rc_prefix}stop $rc_extra_args" \
+					    exec.start="${SERVICE} -E _rc_svcj=jailing ${rc_service##*/} ${_rc_prefix}start $rc_extra_args" \
+					    exec.stop="${SERVICE} -E _rc_svcj=jailing ${rc_service##*/} ${_rc_prefix}stop $rc_extra_args" \
 					    exec.consolelog="/var/log/svcj_${name}_console.log" \
 					    name=svcj-${name} || return 1
 				fi
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.