summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Hall <halex@cvs.openbsd.org>2011-09-25 17:55:15 +0000
committerAlexander Hall <halex@cvs.openbsd.org>2011-09-25 17:55:15 +0000
commit29d040186015c68877a0a01d277e5ffa1453e8fe (patch)
tree8502aff9b5a6a3be70dddb7c75609c4c7226bd53
parent016010c3a6f7dc012263f9fabb6ff6aac7be7ba3 (diff)
revert previous and pass on the RC_DEBUG and RC_FORCE flags in the start+stop
dance on restart rather than exporting them and expose the script to a potentially polluted environment ok ajacoutot@ robert@
-rw-r--r--etc/rc.d/rc.subr18
1 files changed, 10 insertions, 8 deletions
diff --git a/etc/rc.d/rc.subr b/etc/rc.d/rc.subr
index 5fbe41bb2a3..96551d3fa9c 100644
--- a/etc/rc.d/rc.subr
+++ b/etc/rc.d/rc.subr
@@ -1,4 +1,4 @@
-# $OpenBSD: rc.subr,v 1.48 2011/09/24 17:35:15 ajacoutot Exp $
+# $OpenBSD: rc.subr,v 1.49 2011/09/25 17:55:14 halex Exp $
#
# Copyright (c) 2010, 2011 Antoine Jacoutot <ajacoutot@openbsd.org>
# Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -45,7 +45,7 @@ rc_stop() {
}
rc_do() {
- if [ -n "${_RC_DEBUG}" ]; then
+ if [ -n "${RC_DEBUG}" ]; then
echo "doing $@" && "$@"
else
"$@" >/dev/null 2>&1
@@ -83,13 +83,13 @@ rc_cmd() {
[ $(id -u) -eq 0 ] || \
rc_err "$0: need root privileges"
- [ -z "${_RC_FORCE}" ] && [ X"${daemon_flags}" = X"NO" ] && exit 1
+ [ -z "${RC_FORCE}" ] && [ X"${daemon_flags}" = X"NO" ] && exit 1
eval _enotsup=\${rc_${1}}
[ X"${_enotsup}" != X"NO" ] || rc_err "$0: $1 is not supported"
[ X"${rc_bg}" = X"YES" ] && local _bg="&"
- [ -n "${_RC_DEBUG}" ] || local _n="-n"
+ [ -n "${RC_DEBUG}" ] || local _n="-n"
case "$1" in
check)
@@ -131,7 +131,8 @@ rc_cmd() {
rc_exit ok
;;
restart)
- /etc/rc.d/${_name} stop && /etc/rc.d/${_name} start
+ /etc/rc.d/${_name} ${RC_DEBUG} ${RC_FORCE} stop &&
+ /etc/rc.d/${_name} ${RC_DEBUG} ${RC_FORCE} start
;;
*)
rc_usage
@@ -143,10 +144,11 @@ rc_cmd() {
[ -n "${daemon}" ] || rc_err "$0: daemon is not set"
+unset RC_DEBUG RC_FORCE
while getopts "df" c; do
case "$c" in
- d) export _RC_DEBUG=1;;
- f) export _RC_FORCE=1;;
+ d) RC_DEBUG=-d;;
+ f) RC_FORCE=-f;;
*) rc_usage;;
esac
done
@@ -162,7 +164,7 @@ getcap -f /etc/login.conf ${_name} 1>/dev/null 2>&1 && \
[ -z "${daemon_class}" ] && daemon_class=daemon
[ -z "${daemon_user}" ] && daemon_user=root
-[ -n "${_RC_FORCE}" ] && [ X"${_rcflags}" = X"NO" ] && unset _rcflags
+[ -n "${RC_FORCE}" ] && [ X"${_rcflags}" = X"NO" ] && unset _rcflags
[ -n "${_rcflags}" ] && daemon_flags=${_rcflags}
[ -n "${_rcuser}" ] && daemon_user=${_rcuser}