diff options
author | Robert Nagy <robert@cvs.openbsd.org> | 2010-12-11 09:55:38 +0000 |
---|---|---|
committer | Robert Nagy <robert@cvs.openbsd.org> | 2010-12-11 09:55:38 +0000 |
commit | 7f49e80d74c0a1480562fb68816a4ddedaf520c1 (patch) | |
tree | 399a5dd9711e8cba5ed0171e5ad708541ecdb27b /etc | |
parent | 5bfc90c2c1bb57cc673b79663dbf9dd67ba63ad4 (diff) |
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@
Diffstat (limited to 'etc')
-rw-r--r-- | etc/rc.d/rc.subr | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/etc/rc.d/rc.subr b/etc/rc.d/rc.subr index ce1991e5f41..7819c03c36b 100644 --- a/etc/rc.d/rc.subr +++ b/etc/rc.d/rc.subr @@ -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 @@ -9,8 +9,8 @@ rc_err() { rc_start() { 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() { @@ -28,6 +28,7 @@ rc_stop() { rc_cmd() { _name=`basename $0` + eval _rcflags=\${${_name}_flags} eval _rcuser=\${${_name}_user} eval _rcclass=\${${_name}_class} @@ -35,9 +36,13 @@ rc_cmd() { [ `id -u` -eq 0 -o X"$1" = "Xcheck" ] || \ 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 "${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 check) |