Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 24 Dec 2011 16:53:22 +0200
From:      Maxim Ignatenko <gelraen.ua@gmail.com>
To:        Chris Rees <crees@freebsd.org>
Cc:        freebsd-rc@freebsd.org
Subject:   Re: conf/163508: [rc.subr] [patch] Add &quot;enable&quot; and &quot;disable&quot; commands to rc.subr
Message-ID:  <CABWTX-bSa4B26g74mrYAZXym--HYWYMy7O_kdCRqTPR8W75O_g@mail.gmail.com>
In-Reply-To: <CADLo83-SK%2Bo0b9GysjhH0N=TxsZXLRAuKL-n%2Btt6%2BCcr1gAJWQ@mail.gmail.com>
References:  <201112241230.pBOCUF3h064098@freefall.freebsd.org> <CADLo83-SK%2Bo0b9GysjhH0N=TxsZXLRAuKL-n%2Btt6%2BCcr1gAJWQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 24 December 2011 15:15, Chris Rees <crees@freebsd.org> wrote:
> On 24 December 2011 12:30, Maxim Ignatenko <gelraen.ua@gmail.com> wrote:
>> The following reply was made to PR conf/163508; it has been noted by GNA=
TS.
>>
>> From: Maxim Ignatenko <gelraen.ua@gmail.com>
>> To: Doug Barton <dougb@freebsd.org>
>> Cc: bug-followup@freebsd.org
>> Subject: Re: conf/163508: [rc.subr] [patch] Add &quot;enable&quot; and
>> =C2=A0&quot;disable&quot; commands to rc.subr
>> Date: Sat, 24 Dec 2011 14:20:19 +0200
>>
>> =C2=A0On 24 December 2011 04:15, Doug Barton <dougb@freebsd.org> wrote:
>> =C2=A0> This idea has been considered before and rejected because it's t=
oo
>> =C2=A0> difficult to catch all the corner cases, and actually editing a =
config
>> =C2=A0> file is not really all that hard of a thing to do.
>> =C2=A0>
>>
>> =C2=A0The idea was to make enabling/disabling services less error-prone.=
 It
>> =C2=A0don't need to catch _all_ corner cases, because if administrator d=
o
>> =C2=A0something unusual with startup configuration he should be able to
>> =C2=A0manipulate it in proper way, or even have tools that do something
>> =C2=A0similar.
>> =C2=A0Proposed patch handles /etc/rc.conf, /etc/rc.conf.local and
>> =C2=A0/etc/rc.conf.d/* properly (I hope), so it should fit nicely in 95%=
 of
>> =C2=A0cases.
>> =C2=A0Doing `service someserive enable` is much faster and less error-pr=
one
>> =C2=A0that `service someservice rcvar ; echo someservicercvar_enable=3DY=
ES >>
>> =C2=A0/etc/rc.conf`
>
> Disagree, sorry.
>
> If we're going to implement these ideas we should do it properly, not
> for 95% of cases.
>

It's impossible to handle all cases. For example, how this can be
detected and properly altered without bloating code:

for c in n a m e d _ e n a b l e; do
var=3D${var}${c}
done
for c in y e s; do
val=3D${val}${c}
done
eval ${var}=3D\$${val}

Since proposed patch adds variable to last included file, it will not
actually work only if user changed /etc/rc.subr to include one more
file after /etc/rc.conf.d/${name}. So, while /etc/rc.subr is
unmdified, it will do the job.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CABWTX-bSa4B26g74mrYAZXym--HYWYMy7O_kdCRqTPR8W75O_g>