Index: etc/rc.subr =================================================================== --- etc/rc.subr +++ etc/rc.subr @@ -746,6 +746,28 @@ # ${name}_chdir n Directory to cd to before running ${command} # (if not using ${name}_chroot). # +# ${name}_daemon n Arguments to pass to daemon(8) before +# running ${command}. +# +# ${name}_flags n Arguments to call ${command} with. +# NOTE: $flags from the parent environment +# can be used to override this. +# +# ${name}_env n Environment variables to run ${command} with. +# +# ${name}_fib n Routing table number to run ${command} with. +# +# ${name}_nice n Nice level to run ${command} at. +# +# ${name}_oomprotect n Don't kill ${command} when swap space is exhausted. +# +# ${name}_user n User to run ${command} as, using su(1) if not +# using ${name}_chroot. +# Requires /usr to be mounted. +# +# ${name}_group n Group to run chrooted ${command} as. +# Requires /usr to be mounted. +# # ${name}_flags n Arguments to call ${command} with. # NOTE: $flags from the parent environment # can be used to override this. @@ -949,6 +971,7 @@ fi eval _chdir=\$${name}_chdir _chroot=\$${name}_chroot \ _nice=\$${name}_nice _user=\$${name}_user \ + _daemon=\$${name}_daemon _daemon=\$${name}_daemon \ _group=\$${name}_group _groups=\$${name}_groups \ _fib=\$${name}_fib _env=\$${name}_env \ _prepend=\$${name}_prepend _login_class=\${${name}_login_class:-daemon} \ @@ -1044,19 +1067,22 @@ # setup the full command to run # check_startmsgs && echo "Starting ${name}." + _doit="$command $rc_flags $command_args" + if [ -n "$_daemon" ]; then + _doit="daemon $_daemon $_doit" + fi if [ -n "$_chroot" ]; then _doit="\ ${_nice:+nice -n $_nice }\ ${_fib:+setfib -F $_fib }\ ${_env:+env $_env }\ chroot ${_user:+-u $_user }${_group:+-g $_group }${_groups:+-G $_groups }\ -$_chroot $command $rc_flags $command_args" +$_chroot $_doit" else _doit="\ ${_chdir:+cd $_chdir && }\ ${_fib:+setfib -F $_fib }\ -${_env:+env $_env }\ -$command $rc_flags $command_args" +${_env:+env $_env } $_doit" if [ -n "$_user" ]; then _doit="su -m $_user -c 'sh -c \"$_doit\"'" fi