Browse Source

Make '-f' only affects the "start" action.

There is no reason we couldn't reload|stop a daemon even when _flags is
set to NO.
As a bonus side effect, we can now see usage() on disabled scripts.
discussed with sthen@ and espie@
ok sthen@
OPENBSD_5_3
ajacoutot 12 years ago
parent
commit
4ff3f48cb4
1 changed files with 5 additions and 10 deletions
  1. +5
    -10
      src/etc/rc.d/rc.subr

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

@ -1,4 +1,4 @@
# $OpenBSD: rc.subr,v 1.63 2012/08/21 06:38:52 ajacoutot Exp $
# $OpenBSD: rc.subr,v 1.64 2012/09/01 07:08:37 ajacoutot Exp $
# #
# Copyright (c) 2010, 2011 Antoine Jacoutot <ajacoutot@openbsd.org> # Copyright (c) 2010, 2011 Antoine Jacoutot <ajacoutot@openbsd.org>
# Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org> # Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org>
@ -101,15 +101,6 @@ rc_cmd() {
[ X"${rc_usercheck}" != X"NO" -a X"$1" = "Xcheck" ] || \ [ X"${rc_usercheck}" != X"NO" -a X"$1" = "Xcheck" ] || \
rc_err "$0: need root privileges" rc_err "$0: need root privileges"
if [ -z "${_RC_FORCE}" ] && [ X"${daemon_flags}" = X"NO" ]
then
if [ -n "${_RC_DEBUG}" ]
then
rc_err "$0: no $1 without -f, ${_name}_flags=NO"
fi
exit 1
fi
eval _enotsup=\${rc_${1}} eval _enotsup=\${rc_${1}}
[ X"${_enotsup}" != X"NO" ] || rc_err "$0: $1 is not supported" [ X"${_enotsup}" != X"NO" ] || rc_err "$0: $1 is not supported"
@ -123,6 +114,10 @@ rc_cmd() {
rc_do rc_check rc_do rc_check
;; ;;
start) start)
if [ X"${daemon_flags}" = X"NO" ]; then
rc_err "$0: no $1 without -f, ${_name}_flags=NO"
exit 1
fi
[ -z "${INRC}" ] && rc_do rc_check && exit 0 [ -z "${INRC}" ] && rc_do rc_check && exit 0
echo $_n "${INRC:+ }${_name}" echo $_n "${INRC:+ }${_name}"
while true; do # no real loop, only needed to break while true; do # no real loop, only needed to break


Loading…
Cancel
Save