|
|
@ -1,4 +1,4 @@ |
|
|
|
# $OpenBSD: rc.subr,v 1.122 2017/05/28 09:31:45 ajacoutot Exp $ |
|
|
|
# $OpenBSD: rc.subr,v 1.123 2017/05/28 10:12:42 ajacoutot Exp $ |
|
|
|
# |
|
|
|
# Copyright (c) 2010, 2011, 2014-2017 Antoine Jacoutot <ajacoutot@openbsd.org> |
|
|
|
# Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org> |
|
|
@ -156,7 +156,8 @@ _rc_parse_conf() { |
|
|
|
_val=${_val%%#*} |
|
|
|
_val=${_val%%*([[:blank:]])} |
|
|
|
# remove leading and trailing quotes (backwards compat) |
|
|
|
[[ $_val == @(\"*\"|\'*\') ]] && _val=${_val#?} _val=${_val%?} |
|
|
|
[[ $_val == @(\"*\"|\'*\') ]] && |
|
|
|
_val=${_val#?} _val=${_val%?} |
|
|
|
eval "${_key}=\${_val}" |
|
|
|
done < $_rcfile |
|
|
|
done |
|
|
@ -184,7 +185,7 @@ rc_stop() { |
|
|
|
} |
|
|
|
|
|
|
|
rc_cmd() { |
|
|
|
local _msg _n _ret |
|
|
|
local _to _n _ret |
|
|
|
|
|
|
|
[ -n "${1}" ] && echo "${_rc_actions}" | grep -qw -- ${1} || _rc_usage |
|
|
|
|
|
|
@ -224,9 +225,9 @@ rc_cmd() { |
|
|
|
wait ${_TIMERSUB} 2>/dev/null # don't print Alarm clock |
|
|
|
[[ "${_ret}" == @(0|142) ]] && _rc_do rc_check || break |
|
|
|
[[ "${_ret}" == 142 ]] && [ X"${rc_bg}" != X"YES" ] && |
|
|
|
_msg="timeout" |
|
|
|
_to="timeout" |
|
|
|
_rc_do _rc_write_runfile |
|
|
|
_rc_exit ${_msg:=ok} |
|
|
|
_rc_exit ${_to:=ok} |
|
|
|
done |
|
|
|
# handle failure |
|
|
|
type rc_post >/dev/null && _rc_do rc_post |
|
|
@ -312,4 +313,5 @@ readonly daemon_class |
|
|
|
unset _rcflags _rcrtable _rcuser _rctimeout |
|
|
|
pexp="${daemon}${daemon_flags:+ ${daemon_flags}}" |
|
|
|
rcexec="su -l -c ${daemon_class} -s /bin/sh ${daemon_user} -c" |
|
|
|
[ "${daemon_rtable}" -eq 0 ] || rcexec="route -T ${daemon_rtable} exec ${rcexec}" |
|
|
|
[ "${daemon_rtable}" -eq 0 ] || |
|
|
|
rcexec="route -T ${daemon_rtable} exec ${rcexec}" |