tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Making powerd=YES default



On Aug 1, 2011, at 1:40 56PM, David Holland wrote:

> On Mon, Aug 01, 2011 at 12:55:09PM -0400, Mouse wrote:
>>> Now how the script is expected to know that "powerd=NO" came from
>>> /etc/rc.conf, and not /etc/defaults/rc.conf?
>> 
>> I've seen the mailer variables handle this through setting the variable
>> to "check" and then seeing if it's still set that way later.  See
>> rc.d/postfix in 4.0.1 (possibly other versions too; 4.0.1 is the one I
>> checked).  Perhaps that could be adapted?
> 
> That would make far too much sense...
> 
How about this: read defaults/rc.conf *after* reading rc.conf, but use

        : ${varname:=defaultvalue}

to set it.  The semantics of it, in the ksh man page, are

       ${name:=word}
              if name is set and not null, it is substituted, otherwise it  is
              assigned word and the resulting value of name is substituted.

but it works in out /bin/sh as well.

                --Steve Bellovin, https://www.cs.columbia.edu/~smb







Home | Main Index | Thread Index | Old Index