Date: Mon, 29 Mar 2010 12:03:05 -0700 From: Xin LI <delphij@gmail.com> To: John Baldwin <jhb@freebsd.org> Cc: Doug Barton <dougb@freebsd.org>, freebsd-rc@freebsd.org Subject: Re: mountd and reload Message-ID: <a78074951003291203p2bb86f95g8a6752c8d33db750@mail.gmail.com> In-Reply-To: <201003291433.55567.jhb@freebsd.org> References: <201003261410.35830.jhb@freebsd.org> <201003291203.18304.jhb@freebsd.org> <4BB0E38D.1010605@FreeBSD.org> <201003291433.55567.jhb@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] What about this one... (rc.subr in checkyesno would accept a list of variables and return 0 if any of them was set to "YES", and 1 if none of them was set or, when there is at least one "NO" and no "YES" set). Cheers, -- Xin LI <delphij@delphij.net> http://www.delphij.net [-- Attachment #2 --] Index: rc.subr =================================================================== --- rc.subr (revision 205846) +++ rc.subr (working copy) @@ -138,24 +138,28 @@ # checkyesno() { - eval _value=\$${1} - debug "checkyesno: $1 is set to $_value." - case $_value in + local _no _varname _value + _no=false + for _varname in $*; do + eval _value=\$${_varname} + debug "checkyesno: $_varname is set to $_value." + case $_value in - # "yes", "true", "on", or "1" - [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) - return 0 - ;; + # "yes", "true", "on", or "1" + [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) + return 0 + ;; - # "no", "false", "off", or "0" - [Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0) - return 1 - ;; - *) - warn "\$${1} is not set properly - see ${rcvar_manpage}." - return 1 - ;; - esac + # "no", "false", "off", or "0" + [Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0) + _no=true + ;; + esac + done + if [ "${_no}" = false ]; then + warn "\$$* is not set properly - see ${rcvar_manpage}." + fi + return 1 } # Index: rc.d/mountd =================================================================== --- rc.d/mountd (revision 205846) +++ rc.d/mountd (working copy) @@ -10,7 +10,7 @@ . /etc/rc.subr name="mountd" -rcvar=`set_rcvar` +rcvar="`set_rcvar` nfs_server_enable nfsd_enable" command="/usr/sbin/${name}" pidfile="/var/run/${name}.pid" required_files="/etc/exports"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?a78074951003291203p2bb86f95g8a6752c8d33db750>
