From 219ce416905a74b184e453221ff2e85d0a14b197 Mon Sep 17 00:00:00 2001 From: ajacoutot <> Date: Tue, 4 Jan 2011 16:02:24 +0000 Subject: [PATCH] Check for a login class that match the rc script name and if we find one let's use it. If not, then fall back to using daemon. While here, do some reordering. "I like this" sthen@, ok robert@ --- src/etc/rc.d/rc.subr | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/etc/rc.d/rc.subr b/src/etc/rc.d/rc.subr index 8e2970cf..ddd29fb6 100644 --- a/src/etc/rc.d/rc.subr +++ b/src/etc/rc.d/rc.subr @@ -1,4 +1,4 @@ -# $OpenBSD: rc.subr,v 1.17 2010/12/29 15:28:01 ajacoutot Exp $ +# $OpenBSD: rc.subr,v 1.18 2011/01/04 16:02:24 ajacoutot Exp $ rc_err() { echo $1 @@ -62,18 +62,19 @@ rc_cmd() { _name=`basename $0` eval _rcflags=\${${_name}_flags} -eval _rcuser=\${${_name}_user} -eval _rcclass=\${${_name}_class} eval _rcshell=\${${_name}_shell} +eval _rcuser=\${${_name}_user} + +getcap -f /etc/login.conf ${_name} 1>/dev/null 2>&1 && \ + daemon_class=${_name} [ -z "${daemon_class}" ] && daemon_class=daemon [ -z "${daemon_shell}" ] && daemon_shell=/bin/sh [ -z "${daemon_user}" ] && daemon_user=root [ -n "${_rcflags}" ] && daemon_flags=${_rcflags} -[ -n "${_rcuser}" ] && daemon_user=${_rcuser} -[ -n "${_rcclass}" ] && daemon_class=${_rcclass} [ -n "${_rcshell}" ] && daemon_shell=${_rcshell} +[ -n "${_rcuser}" ] && daemon_user=${_rcuser} daemon_flags=`echo ${daemon_flags} | tr -s "[:space:]"`