conf/88913: wrapper support for rc.subr
Michael Reynolds
michael.reynolds at gmail.com
Sun Nov 13 01:10:19 PST 2005
>Number: 88913
>Category: conf
>Synopsis: wrapper support for rc.subr
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Sun Nov 13 09:10:16 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator: Michael Reynolds
>Release: 5.4-STABLE
>Organization:
>Environment:
FreeBSD home.box 5.4-STABLE FreeBSD 5.4-STABLE #15: Sat Nov 12 19:54:21 EST 2005 root at home.box:/usr/obj/usr/src/sys/HOME i386
>Description:
This proposed patch adds the ability to execute rc daemons inside of wrappers. Could be useful to initialize per daemon MAC policies, resource limits, and the like.
>How-To-Repeat:
>Fix:
See attached file. Patch is against:
# $NetBSD: rc.subr,v 1.60 2003/07/26 05:13:47 lukem Exp $
# $FreeBSD: src/etc/rc.subr,v 1.31.2.4 2005/11/06 15:54:43 jhb Exp $
--- rc.subr.diff begins here ---
--- /usr/src/etc/rc.subr Fri Nov 11 09:46:38 2005
+++ /etc/rc.subr Sun Nov 13 03:42:26 2005
@@ -525,7 +525,8 @@
fi
eval _chdir=\$${name}_chdir _chroot=\$${name}_chroot \
_nice=\$${name}_nice _user=\$${name}_user \
- _group=\$${name}_group _groups=\$${name}_groups
+ _group=\$${name}_group _groups=\$${name}_groups \
+ _wrapper=\$${name}_wrapper _wrapper_flags=\$${name}_wrapper_flags
if [ -n "$_user" ]; then # unset $_user if running as that user
if [ "$_user" = "$(eval $IDCMD)" ]; then
@@ -601,6 +602,13 @@
exit 1
fi
+ if [ -n "$_wrapper" ] ; then
+ if [ ! -x $_wrapper ] ; then
+ info "run_rc_command: cannot run wrapper ($_wrapper) for $command."
+ return 0
+ fi
+ fi
+
if [ ! -x ${_chroot}${command} ]; then
info "run_rc_command: cannot run ($command)."
return 0
@@ -651,12 +659,14 @@
if [ -n "$_chroot" ]; then
_doit="\
${_nice:+nice -n $_nice }\
+$_wrapper $_wrapper_flags \
chroot ${_user:+-u $_user }${_group:+-g $_group }${_groups:+-G $_groups }\
$_chroot $command $rc_flags $command_args"
else
_doit="\
${_chdir:+cd $_chdir; }\
${_nice:+nice -n $_nice }\
+$_wrapper $_wrapper_flags \
$command $rc_flags $command_args"
if [ -n "$_user" ]; then
_doit="su -m $_user -c 'sh -c \"$_doit\"'"
--- rc.subr.diff ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list