Browse Source

Do not overwrite the settings in the rc scripts itself, so use the same

method to handle  _class, _user and _shell as we do for _flags.
discussed with and ok ajacoutot@
OPENBSD_4_9
robert 14 years ago
parent
commit
97fd28dab8
1 changed files with 10 additions and 5 deletions
  1. +10
    -5
      src/etc/rc.d/rc.subr

+ 10
- 5
src/etc/rc.d/rc.subr View File

@ -1,4 +1,4 @@
# $OpenBSD: rc.subr,v 1.9 2010/12/10 21:25:50 robert Exp $
# $OpenBSD: rc.subr,v 1.10 2010/12/11 09:55:37 robert Exp $
[ -z "${local_rcconf}" ] && . /etc/rc.conf [ -z "${local_rcconf}" ] && . /etc/rc.conf
@ -9,8 +9,8 @@ rc_err() {
rc_start() { rc_start() {
type rc_pre >/dev/null && rc_pre type rc_pre >/dev/null && rc_pre
su -c ${_rcclass:-daemon} -s ${_rcshell:-/bin/sh} \
${_rcuser:-root} -c "${daemon} ${daemon_flags}" >/dev/null
su -c ${daemon_class:-daemon} -s ${daemon_shell:-/bin/sh} \
${daemon_user:-root} -c "${daemon} ${daemon_flags}" >/dev/null
} }
rc_check() { rc_check() {
@ -28,6 +28,7 @@ rc_stop() {
rc_cmd() { rc_cmd() {
_name=`basename $0` _name=`basename $0`
eval _rcflags=\${${_name}_flags} eval _rcflags=\${${_name}_flags}
eval _rcuser=\${${_name}_user} eval _rcuser=\${${_name}_user}
eval _rcclass=\${${_name}_class} eval _rcclass=\${${_name}_class}
@ -35,9 +36,13 @@ rc_cmd() {
[ `id -u` -eq 0 -o X"$1" = "Xcheck" ] || \ [ `id -u` -eq 0 -o X"$1" = "Xcheck" ] || \
rc_err "$0: need root privileges" rc_err "$0: need root privileges"
[ -n "${daemon}" ] || rc_err "$0: daemon is not set"
[ -n "${daemon}" ] || rc_err "$0: daemon is not set"
[ -n "${_rcflags}" ] && daemon_flags=${_rcflags} [ -n "${_rcflags}" ] && daemon_flags=${_rcflags}
[ -n "${pexp}" ] || pexp="${daemon}${daemon_flags:+ ${daemon_flags}}"
[ -n "${_rcuser}" ] && daemon_user=${_rcuser}
[ -n "${_rcclass}" ] && daemon_class=${_rcclass}
[ -n "${_rcshell}" ] && daemon_shell=${_rcshell}
[ -n "${pexp}" ] || \
pexp="${daemon}${daemon_flags:+ ${daemon_flags}}"
case "$1" in case "$1" in
check) check)


Loading…
Cancel
Save