From c5651640c93e980971df3a9375fc23b5b8bebc70 Mon Sep 17 00:00:00 2001 From: Antoine Jacoutot Date: Tue, 26 Apr 2016 18:39:30 +0000 Subject: It's ok to disable a non-existing daemon. Think "pkg_delete foobar && rcctl disable foobar". --- usr.sbin/rcctl/rcctl.sh | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/usr.sbin/rcctl/rcctl.sh b/usr.sbin/rcctl/rcctl.sh index 848da7188fc..9e2b17b6005 100644 --- a/usr.sbin/rcctl/rcctl.sh +++ b/usr.sbin/rcctl/rcctl.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# $OpenBSD: rcctl.sh,v 1.94 2016/04/26 17:58:42 ajacoutot Exp $ +# $OpenBSD: rcctl.sh,v 1.95 2016/04/26 18:39:29 ajacoutot Exp $ # # Copyright (c) 2014, 2015 Antoine Jacoutot # Copyright (c) 2014 Ingo Schwarze @@ -474,10 +474,13 @@ case ${action} in shift 1 svcs="$*" [ -z "${svcs}" ] && usage - for svc in ${svcs}; do - svc_is_avail ${svc} || \ - rcctl_err "service ${svc} does not exist" 2 - done + # it's ok to disable a non-existing daemon + if [ "${action}" != "disable" ]; then + for svc in ${svcs}; do + svc_is_avail ${svc} || \ + rcctl_err "service ${svc} does not exist" 2 + done + fi ;; get|getdef) svc=$2 @@ -503,8 +506,11 @@ case ${action} in [ $# -ge 3 ] && shift 3 || shift $# args="$*" [ -z "${svc}" ] && usage - svc_is_avail ${svc} || \ - rcctl_err "service ${svc} does not exist" 2 + # it's ok to disable a non-existing daemon + if [ "${action} ${var} ${args}" != "set status off" ]; then + svc_is_avail ${svc} || \ + rcctl_err "service ${svc} does not exist" 2 + fi [[ ${var} != @(class|flags|rtable|status|timeout|user) ]] && usage svc_is_meta ${svc} && [ "${var}" != "status" ] && \ rcctl_err "/etc/rc.d/${svc} is a meta script, cannot \"${action} ${var}\"" -- cgit v1.2.3